ó
    "njÇ  ã                  óþ   • S r SSKJr  SSKJr  SSKJrJr  SSKJ	r	  SSK
r
\(       a  SSKJr  SS	 jr " S
 S\	R                  5      r " S S\5      r " S S\5      r\	R$                  " S5       " S S\5      5       rg)a5  

Post-processors run on the text of the entire document after is has been serialized into a string.
Postprocessors should be used to work with the text just before output. Usually, they are used add
back sections that were extracted in a preprocessor, fix up outgoing encodings, or wrap the whole
document.

é    )Úannotations)ÚOrderedDict)ÚTYPE_CHECKINGÚAnyé   )ÚutilN)ÚMarkdownc                óž   • [         R                  " 5       nUR                  [        U 5      SS5        UR                  [	        5       SS5        U$ )z/Build the default postprocessors for Markdown. Úraw_htmlé   Úamp_substituteé   )r   ÚRegistryÚregisterÚRawHtmlPostprocessorÚAndSubstitutePostprocessor)ÚmdÚkwargsÚpostprocessorss      Ú9/usr/lib/python3/dist-packages/markdown/postprocessors.pyÚbuild_postprocessorsr   (   sB   € ä—]’]“_€NØ×ÑÔ0°Ó4°jÀ"ÔEØ×ÑÔ6Ó8Ð:JÈBÔOØÐó    c                  ó"   • \ rS rSrSrSS jrSrg)ÚPostprocessoré0   a  
Postprocessors are run after the ElementTree it converted back into text.

Each Postprocessor implements a `run` method that takes a pointer to a
text string, modifies it as necessary and returns a text string.

Postprocessors must extend `Postprocessor`.

c                ó   • g)z¡
Subclasses of `Postprocessor` should implement a `run` method, which
takes the html document as a single text string and returns a
(possibly modified) string.

N© ©ÚselfÚtexts     r   ÚrunÚPostprocessor.run;   s   € ð 	r   r   N©r    ÚstrÚreturnr$   ©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r!   Ú__static_attributes__r   r   r   r   r   0   s   † ñ÷r   r   c                  óZ   • \ rS rSrSr\R                  " S5      rS	S jrS
S jr	S	S jr
Srg)r   éE   z"Restore raw html to the document. z^\<\/?([^ >]+)c                óš  ^• [        5       m[        U R                  R                  R                  5       Hª  nU R                  U R                  R                  R                  U   5      nU R                  U5      (       a7  UTSR                  U R                  R                  R                  U5      5      '   UTU R                  R                  R                  U5      '   M¬     SU4S jjnT(       aA  [        R                  S-  n[        R                  " SU SU 35      nUR                  XA5      nOU$ Xq:X  a  U$ U R                  U5      $ )z*Iterate over html stash and restore html. z	<p>{}</p>c                ój   >• U R                  S5      nUT;  a  USS T;   a  STUSS     S3$ U$ TU   $ )Nr   é   éüÿÿÿú<p>z</p>)Úgroup)ÚmÚkeyÚreplacementss     €r   Úsubstitute_matchÚ2RawHtmlPostprocessor.run.<locals>.substitute_matchT   sQ   ø€ Ø—'‘'˜!“*ˆCà˜,Ó&Ø�q˜�9 Ó,Ø  ,¨s°1°R¨yÑ"9Ð ;¸4Ð@Ð@à�Jà Ñ$Ð$r   z([0-9]+)r3   z</p>|©r5   zre.Match[str]r%   r$   )r   Úranger   Ú	htmlStashÚhtml_counterÚstash_to_stringÚrawHtmlBlocksÚisblocklevelÚformatÚget_placeholderr   ÚHTML_PLACEHOLDERÚreÚcompileÚsubr!   )	r   r    ÚiÚhtmlr8   Úbase_placeholderÚpatternÚprocessed_textr7   s	           @r   r!   ÚRawHtmlPostprocessor.runJ   s  ø€ ä"“}ˆÜ�t—w‘w×(Ñ(×5Ñ5Ö6ˆAØ×'Ñ'¨¯©×(9Ñ(9×(GÑ(GÈÑ(JÓKˆDØ× Ñ  ×&Ñ&à=Að ˜[×/Ñ/Ø—G‘G×%Ñ%×5Ñ5°aÓ8ó:ñ ;àAEˆL˜Ÿ™×*Ñ*×:Ñ:¸1Ó=Ó>ñ 7÷		%ö Ü#×4Ñ4°{ÑBÐÜ—j’j 3Ð(8Ð&:¸%ÐAQÐ?SÐ!TÓUˆGØ$Ÿ[™[Ð)9Ó@‰NàˆKàÓ!Ø!Ð!à—8‘8˜NÓ+Ð+r   c                óÎ   • U R                   R                  U5      nU(       aC  UR                  S5      S   S;   a  gU R                  R	                  UR                  S5      5      $ g)z'Check is block of HTML is block-level. r   r   )Ú!Ú?Ú@Ú%TF)ÚBLOCK_LEVEL_REGEXÚmatchr4   r   Úis_block_level)r   rH   r5   s      r   r@   Ú!RawHtmlPostprocessor.isblocklevelk   sS   € à×"Ñ"×(Ñ(¨Ó.ˆÞØ�w‰w�q‹z˜!‰}Ð 4Ó4àØ—7‘7×)Ñ)¨!¯'©'°!«*Ó5Ð5Ør   c                ó   • [        U5      $ )z&Convert a stashed object to a string. )r$   r   s     r   r>   Ú$RawHtmlPostprocessor.stash_to_stringu   s   € ä�4‹yÐr   r   Nr#   )rH   r$   r%   Úbool)r'   r(   r)   r*   r+   rD   rE   rR   r!   r@   r>   r,   r   r   r   r   r   E   s%   † Ù-àŸ
š
Ð#4Ó5Ðô,ôB÷r   r   c                  ó"   • \ rS rSrSrSS jrSrg)r   éz   zRestore valid entities c                óF   • UR                  [        R                  S5      nU$ )NÚ&)Úreplacer   ÚAMP_SUBSTITUTEr   s     r   r!   ÚAndSubstitutePostprocessor.run}   s   € Ø�|‰|œD×/Ñ/°Ó5ˆØˆr   r   Nr#   r&   r   r   r   r   r   z   s
   † Ù"÷r   r   z‘This class is deprecated and will be removed in the future; use [`UnescapeTreeprocessor`][markdown.treeprocessors.UnescapeTreeprocessor] instead.c                  ó˜   • \ rS rSrSr\R                  " SR                  \R                  \R                  5      5      rSS jrS	S jrSrg)
ÚUnescapePostprocessoré‚   zRestore escaped chars. z	{}(\d+){}c                óH   • [        [        UR                  S5      5      5      $ )Nr   )ÚchrÚintr4   )r   r5   s     r   ÚunescapeÚUnescapePostprocessor.unescape‹   s   € Ü”3�q—w‘w˜q“z“?Ó#Ð#r   c                óN   • U R                   R                  U R                  U5      $ )N)ÚRErF   rf   r   s     r   r!   ÚUnescapePostprocessor.runŽ   s   € Ø�w‰w�{‰{˜4Ÿ=™=¨$Ó/Ð/r   r   Nr:   r#   )r'   r(   r)   r*   r+   rD   rE   rA   r   ÚSTXÚETXri   rf   r!   r,   r   r   r   ra   ra   ‚   s4   † ñ
 #à	�Š�L×'Ñ'¨¯©°$·(±(Ó;Ó	<€Bô$÷0r   ra   )r   r	   r   r   r%   zutil.Registry[Postprocessor])r+   Ú
__future__r   Úcollectionsr   Útypingr   r   Ú r   rD   Úmarkdownr	   r   Ú	Processorr   r   r   Ú
deprecatedra   r   r   r   Ú<module>rt      sy   ðñ(õ #å #ß %Ý Û 	æÝ!ôô�D—N‘Nô ô*2˜=ô 2ôj ô ð ‡‚ð\óô	0˜Mó 	0ó	ñ	0r   