ó
    ›ökj�  ã                  óò   • S 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)Ú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      Ú¥C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-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é/   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   /   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   éD   z"Restore raw html to the document. z^\<\/?([^ >]+)c                óì   ^ ^^• SUU U4S jjmT R                   R                  R                  (       aA  [        R                  S-  n[
        R                  " SU SU 35      mTR                  TU5      $ U$ )z*Iterate over html stash and restore html. c                óÎ  >• U R                  S5      =n(       a  SnOU R                  S5      nSn[        U5      =nTR                  R                  R                  :¼  a  U R                  S5      $ TR                  TR                  R                  R                  U   5      nU(       a  TR                  U5      (       a  TR                  TU5      $ TR                  TSU S35      $ )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?   Ú2RawHtmlPostprocessor.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Ñ5Ø—{‘{Ð#3°TÓ:Ð:Ø—;‘;Ð/°3°t°f¸DÐ1AÓBÐBr   z([0-9]+)r1   z</p>|©r:   zre.Match[str]r$   r#   )r   r4   r5   r   ÚHTML_PLACEHOLDERÚreÚcompiler9   )r   r   Úbase_placeholderr>   r?   s   `  @@r   r    ÚRawHtmlPostprocessor.runI   sk   ú€ ÷	Cñ 	Cð �7‰7×Ñ×)×)Ü#×4Ñ4°{ÑBÐÜ—j’j 3Ð(8Ð&:¸%ÐAQÐ?SÐ!TÓUˆGØ—;‘;Ð/°Ó6Ð6àˆKr   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Úmatchr2   r   Úis_block_level)r   r=   r:   s      r   r8   Ú!RawHtmlPostprocessor.isblocklevel_   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   r6   Ú$RawHtmlPostprocessor.stash_to_stringi   s   € ä�4‹yÐr   r   Nr"   )r=   r#   r$   Úbool)r&   r'   r(   r)   r*   rC   rD   rL   r    r8   r6   r+   r   r   r   r   r   D   s$   † Ù-àŸ
š
Ð#4Ó5Ðôô,÷r   r   c                  ó"   • \ rS rSrSrSS jrSrg)r   én   zRestore valid entities c                óF   • UR                  [        R                  S5      nU$ )NÚ&)Úreplacer   ÚAMP_SUBSTITUTEr   s     r   r    ÚAndSubstitutePostprocessor.runq   s   € Ø�|‰|œD×/Ñ/°Ó5ˆØˆr   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                  ó˜   • \ 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év   zRestore escaped chars. z	{}(\d+){}c                óH   • [        [        UR                  S5      5      5      $ )Nr   )Úchrr3   r2   )r   r:   s     r   ÚunescapeÚUnescapePostprocessor.unescape   s   € Ü”3�q—w‘w˜q“z“?Ó#Ð#r   c                óN   • U R                   R                  U R                  U5      $ )N)ÚREr9   r_   r   s     r   r    ÚUnescapePostprocessor.run‚   s   € Ø�w‰w�{‰{˜4Ÿ=™=¨$Ó/Ð/r   r   NrA   r"   )r&   r'   r(   r)   r*   rC   rD   Úformatr   ÚSTXÚETXrb   r_   r    r+   r   r   r   r[   r[   v   s4   † ñ
 #à	�Š�L×'Ñ'¨¯©°$·(±(Ó;Ó	<€Bô$÷0r   r[   )r   r   r   r   r$   zutil.Registry[Postprocessor])r*   Ú
__future__r   Útypingr   r   Ú r   rC   Úmarkdownr   r   Ú	Processorr   r   r   Ú
deprecatedr[   r   r   r   Ú<module>rm      sv   ðñ(õ #ç %Ý Û 	æÝ!ôô�D—N‘Nô ô*'˜=ô 'ôT ô ð ‡‚ð\óô	0˜Mó 	0ó	ñ	0r   