§
    )P„j�  ã                  óø   — d Z ddlmZ ddlmZmZ ddlmZ ddlZerddl	m
Z
 dd„Z G d„ dej        ¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z ej        d¦  «         G d„ de¦  «        ¦   «         ZdS )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)ÚTYPE_CHECKINGÚAnyé   )ÚutilN)ÚMarkdownÚmdr   Úkwargsr   Úreturnúutil.Registry[Postprocessor]c                óº   — t          j        ¦   «         }|                     t          | ¦  «        dd¦  «         |                     t	          ¦   «         dd¦  «         |S )z0 Build the default postprocessors for Markdown. Úraw_htmlé   Úamp_substituteé   )r   ÚRegistryÚregisterÚRawHtmlPostprocessorÚAndSubstitutePostprocessor)r	   r
   Úpostprocessorss      ú\/root/disk_3tb/conda_envs/Huy-visual/lib/python3.11/site-packages/markdown/postprocessors.pyÚbuild_postprocessorsr   '   sT   € å”]‘_”_€NØ×ÒÕ0°Ñ4Ô4°jÀ"ÑEÔEÐEØ×ÒÕ6Ñ8Ô8Ð:JÈBÑOÔOÐOØÐó    c                  ó   — e Zd ZdZdd„ZdS )ÚPostprocessora  
    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`.

    ÚtextÚstrr   c                ó   — dS )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© ©Úselfr   s     r   ÚrunzPostprocessor.run:   s	   € ð 	ˆr   N©r   r   r   r   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r"   r   r   r   r   r   /   s2   € € € € € ðð ðð ð ð ð ð r   r   c                  óJ   — e Zd ZdZ ej        d¦  «        Zdd„Zdd	„Zdd
„Z	dS )r   z# Restore raw html to the document. z^\<\/?([^ >]+)r   r   r   c                ó¼   ‡ ‡‡— d
ˆˆ ˆfd„Š‰ j         j        j        r?t          j        dz  }t          j        d|› d|› �¦  «        Š‰                     ‰|¦  «        S |S )z+ Iterate over html stash and restore html. Úmúre.Match[str]r   r   c                óº  •— |                       d¦  «        x}rd}n|                       d¦  «        }d}t          |¦  «        x}‰j        j        j        k    r|                       d¦  «        S ‰                     ‰j        j        j        |         ¦  «        }|r‰                     |¦  «        r‰                     ‰|¦  «        S ‰                     ‰d|› d�¦  «        S )Nr   Té   Fr   ú<p>z</p>)	ÚgroupÚintr	   Ú	htmlStashÚhtml_counterÚstash_to_stringÚrawHtmlBlocksÚisblocklevelÚsub)r+   ÚkeyÚwrappedÚhtmlÚpatternr!   Úsubstitute_matchs       €€€r   r<   z2RawHtmlPostprocessor.run.<locals>.substitute_matchK   sÕ   ø€ Ø—g’g˜a‘j”jÐ ˆsð  Ø��à—g’g˜a‘j”j�Ø�Ý˜3‘x”x�� D¤GÔ$5Ô$BÒBÐBØ—w’w˜q‘z”zÐ!Ø×'Ò'¨¬Ô(9Ô(GÈÔ(LÑMÔMˆDØð ;˜d×/Ò/°Ñ5Ô5ð ;Ø—{’{Ð#3°TÑ:Ô:Ð:Ø—;’;Ð/Ð1A°tÐ1AÐ1AÐ1AÑBÔBÐBr   z([0-9]+)r/   z</p>|N©r+   r,   r   r   )r	   r2   r3   r   ÚHTML_PLACEHOLDERÚreÚcompiler7   )r!   r   Úbase_placeholderr;   r<   s   `  @@r   r"   zRawHtmlPostprocessor.runI   s‘   øøø€ ð	Cð 	Cð 	Cð 	Cð 	Cð 	Cð 	Cð 	Cð Œ7ÔÔ)ð 	Ý#Ô4°{ÑBÐÝ”jÐ!TÐ(8Ð!TÐ!TÐAQÐ!TÐ!TÑUÔUˆGØ—;’;Ð/°Ñ6Ô6Ð6àˆKr   r:   Úboolc                óÖ   — | j                              |¦  «        }|rL|                     d¦  «        d         dv rdS | j                             |                     d¦  «        ¦  «        S dS )z( Check is block of HTML is block-level. r   r   )ú!ú?ú@ú%TF)ÚBLOCK_LEVEL_REGEXÚmatchr0   r	   Úis_block_level)r!   r:   r+   s      r   r6   z!RawHtmlPostprocessor.isblocklevel_   sd   € àÔ"×(Ò(¨Ñ.Ô.ˆØð 	6Ø�wŠw�q‰zŒz˜!Œ}Ð 4Ð4Ð4à�tØ”7×)Ò)¨!¯'ª'°!©*¬*Ñ5Ô5Ð5Øˆur   c                ó    — t          |¦  «        S )z' Convert a stashed object to a string. )r   r    s     r   r4   z$RawHtmlPostprocessor.stash_to_stringi   s   € å�4‰yŒyÐr   Nr#   )r:   r   r   rB   )
r%   r&   r'   r(   r?   r@   rH   r"   r6   r4   r   r   r   r   r   D   si   € € € € € Ø-Ð-à"˜œ
Ð#4Ñ5Ô5Ððð ð ð ð,ð ð ð ðð ð ð ð ð r   r   c                  ó   — e Zd ZdZdd„ZdS )r   z Restore valid entities r   r   r   c                óF   — |                      t          j        d¦  «        }|S )Nú&)Úreplacer   ÚAMP_SUBSTITUTEr    s     r   r"   zAndSubstitutePostprocessor.runq   s   € Ø�|Š|�DÔ/°Ñ5Ô5ˆØˆr   Nr#   r$   r   r   r   r   r   n   s.   € € € € € Ø"Ð"ðð ð ð ð ð r   r   z‘This class is deprecated and will be removed in the future; use [`UnescapeTreeprocessor`][markdown.treeprocessors.UnescapeTreeprocessor] instead.c                  ó~   — e Zd ZdZ ej        d                     ej        ej	        ¦  «        ¦  «        Z
dd„Zdd	„Zd
S )ÚUnescapePostprocessorz Restore escaped chars. z	{}(\d+){}r+   r,   r   r   c                ó`   — t          t          |                     d¦  «        ¦  «        ¦  «        S )Nr   )Úchrr1   r0   )r!   r+   s     r   ÚunescapezUnescapePostprocessor.unescape   s    € Ý•3�q—w’w˜q‘z”z‘?”?Ñ#Ô#Ð#r   r   c                óB   — | j                              | j        |¦  «        S )N)ÚREr7   rU   r    s     r   r"   zUnescapePostprocessor.run‚   s   € ØŒw�{Š{˜4œ=¨$Ñ/Ô/Ð/r   Nr=   r#   )r%   r&   r'   r(   r?   r@   Úformatr   ÚSTXÚETXrW   rU   r"   r   r   r   rR   rR   v   si   € € € € € ð
 #Ð"à	ˆŒ�L×'Ò'¨¬°$´(Ñ;Ô;Ñ	<Ô	<€Bð$ð $ð $ð $ð0ð 0ð 0ð 0ð 0ð 0r   rR   )r	   r   r
   r   r   r   )r(   Ú
__future__r   Útypingr   r   Ú r   r?   Úmarkdownr   r   Ú	Processorr   r   r   Ú
deprecatedrR   r   r   r   ú<module>ra      s\  ðð(ð ð #Ð "Ð "Ð "Ð "Ð "à %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø 	€	€	€	àð "Ø!Ð!Ð!Ð!Ð!Ð!ðð ð ð ðð ð ð ð �D”Nñ ô ð ð*'ð 'ð 'ð 'ð '˜=ñ 'ô 'ð 'ðTð ð ð ð  ñ ô ð ð €„ð\ñô ð	0ð 	0ð 	0ð 	0ð 	0˜Mñ 	0ô 	0ñ	ô ð	0ð 	0ð 	0r   