Ë
    Á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y)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)ÚMarkdownc                óœ   — t        j                  «       }|j                  t        | «      dd«       |j                  t	        «       dd«       |S )z0 Build the default postprocessors for Markdown. Úraw_htmlé   Úamp_substituteé   )r   ÚRegistryÚregisterÚRawHtmlPostprocessorÚAndSubstitutePostprocessor)ÚmdÚkwargsÚpostprocessorss      úJ/var/www/html/venv/lib/python3.12/site-packages/markdown/postprocessors.pyÚbuild_postprocessorsr   '   sB   € ä—]‘]“_€NØ×ÑÔ0°Ó4°jÀ"ÔEØ×ÑÔ6Ó8Ð:JÈBÔOØÐó    c                  ó   — e Zd ZdZdd„Zy)Ú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`.

    c                 ó   — y)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   ÚrunzPostprocessor.run:   s   € ð 	r   N©r   ÚstrÚreturnr!   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   /   s   „ ñôr   r   c                  óL   — e Zd ZdZ ej
                  d«      Zdd„Zdd„Zdd„Z	y)	r   z# Restore raw html to the document. z^\<\/?([^ >]+)c                óÜ   ‡ ‡‡— dˆˆ ˆfd„Š‰ j                   j                  j                  r@t        j                  dz  }t        j                  d|› d|› �«      Š‰j                  ‰|«      S |S )z+ Iterate over html stash and restore html. c                ó®  •— | j                  d«      x}rd}n| j                  d«      }d}t        |«      x}‰j                  j                  j                  k\  r| j                  d«      S ‰j                  ‰j                  j                  j                  |   «      }|r‰j                  |«      r‰j                  ‰|«      S ‰j                  ‰d|› d�«      S )Nr   Té   Fr   ú<p>z</p>)	ÚgroupÚintr   Ú	htmlStashÚhtml_counterÚstash_to_stringÚrawHtmlBlocksÚisblocklevelÚsub)ÚmÚkeyÚwrappedÚhtmlÚpatternr   Úsubstitute_matchs       €€€r   r:   z2RawHtmlPostprocessor.run.<locals>.substitute_matchK   s½   ø€ Ø—g‘g˜a“jÐ ˆsÐ Ø‘à—g‘g˜a“j�Ø�Ü˜3“x�� D§G¡G×$5Ñ$5×$BÑ$BÒBØ—w‘w˜q“zÐ!Ø×'Ñ'¨¯©×(9Ñ(9×(GÑ(GÈÑ(LÓMˆDÙ˜d×/Ñ/°Ô5Ø—{‘{Ð#3°TÓ:Ð:Ø—;‘;Ð/°3°t°f¸DÐ1AÓBÐBr   z([0-9]+)r,   z</p>|©r5   zre.Match[str]r"   r!   )r   r/   r0   r   ÚHTML_PLACEHOLDERÚreÚcompiler4   )r   r   Úbase_placeholderr9   r:   s   `  @@r   r   zRawHtmlPostprocessor.runI   se   ú€ ÷	Cð �7‰7×Ñ×)Ò)Ü#×4Ñ4°{ÑBÐÜ—j‘j 3Ð(8Ð&:¸%ÐAQÐ?SÐ!TÓUˆGØ—;‘;Ð/°Ó6Ð6àˆKr   c                óÀ   — | j                   j                  |«      }|rA|j                  d«      d   dv ry| j                  j	                  |j                  d«      «      S y)z( Check is block of HTML is block-level. r   r   )Ú!Ú?Ú@Ú%TF)ÚBLOCK_LEVEL_REGEXÚmatchr-   r   Úis_block_level)r   r8   r5   s      r   r3   z!RawHtmlPostprocessor.isblocklevel_   sS   € à×"Ñ"×(Ñ(¨Ó.ˆÙØ�w‰w�q‹z˜!‰}Ð 4Ñ4àØ—7‘7×)Ñ)¨!¯'©'°!«*Ó5Ð5Ør   c                ó   — t        |«      S )z' Convert a stashed object to a string. )r!   r   s     r   r1   z$RawHtmlPostprocessor.stash_to_stringi   s   € ä�4‹yÐr   Nr    )r8   r!   r"   Úbool)
r$   r%   r&   r'   r=   r>   rE   r   r3   r1   r   r   r   r   r   D   s&   „ Ù-à"˜Ÿ
™
Ð#4Ó5Ðóó,ôr   r   c                  ó   — e Zd ZdZdd„Zy)r   z Restore valid entities c                óF   — |j                  t        j                  d«      }|S )NÚ&)Úreplacer   ÚAMP_SUBSTITUTEr   s     r   r   zAndSubstitutePostprocessor.runq   s   € Ø�|‰|œD×/Ñ/°Ó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j                  ej                  ej                  «      «      Z
dd„Zdd„Zy)ÚUnescapePostprocessorz Restore escaped chars. z	{}(\d+){}c                óH   — t        t        |j                  d«      «      «      S )Nr   )Úchrr.   r-   )r   r5   s     r   ÚunescapezUnescapePostprocessor.unescape   s   € Ü”3�q—w‘w˜q“z“?Ó#Ð#r   c                óN   — | j                   j                  | j                  |«      S )N)ÚREr4   rS   r   s     r   r   zUnescapePostprocessor.run‚   s   € Ø�w‰w�{‰{˜4Ÿ=™=¨$Ó/Ð/r   Nr;   r    )r$   r%   r&   r'   r=   r>   Úformatr   ÚSTXÚETXrU   rS   r   r   r   r   rP   rP   v   s6   „ ñ
 #à	ˆ�‰�L×'Ñ'¨¯©°$·(±(Ó;Ó	<€Bó$ô0r   rP   )r   r   r   r   r"   zutil.Registry[Postprocessor])r'   Ú
__future__r   Útypingr   r   Ú r   r=   Úmarkdownr   r   Ú	Processorr   r   r   Ú
deprecatedrP   r   r   r   Ú<module>r_      sx   ðñ(õ #ç %Ý Û 	áÝ!óô�D—N‘Nô ô*'˜=ô 'ôT ô ð €‡�ð\óô	0˜Mó 	0ó	ñ	0r   