%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/markdown/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/markdown/__pycache__/postprocessors.cpython-312.pyc

�

���e�����dZddlmZddlmZddlmZmZddlm	Z	ddl
Z
erddlmZdd	�Z
Gd
�de	j�ZGd�d
e�ZGd�de�Ze	j$d�Gd�de��Zy)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��tj�}|jt|�dd�|jt	�dd�|S)z0 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��eZdZdZdd�Zy)�
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�runzPostprocessor.run;s��	
rN�r�str�returnr"��__name__�
__module__�__qualname__�__doc__r rrrrr0s���
rrc�L�eZdZdZej
d�Zdd�Zdd�Zdd�Z	y)	rz# Restore raw html to the document. z^\<\/?([^ >]+)c�~��t��t|jjj�D]�}|j|jjj|�}|j|�r7|�dj|jjj|��<|�|jjj|�<��d�fd�}�rAtjdz}tjd|�d|���}|j||�}n|S||k(r|S|j|�S)z+ Iterate over html stash and restore html. z	<p>{}</p>c�b��|jd�}|�vr|dd�vrd�|dd�d�S|S�|S)Nr�����<p>z</p>)�group)�m�key�replacementss  �r�substitute_matchz2RawHtmlPostprocessor.run.<locals>.substitute_matchTsQ����'�'�!�*�C��,�&��q��9��,� �,�s�1�R�y�"9� ;�4�@�@��J���$�$rz([0-9]+)r.z</p>|�r0z
re.Match[str]r#r")r�ranger�	htmlStash�html_counter�stash_to_string�
rawHtmlBlocks�isblocklevel�format�get_placeholderr�HTML_PLACEHOLDER�re�compile�subr )	rr�i�htmlr3�base_placeholder�pattern�processed_textr2s	        @rr zRawHtmlPostprocessor.runJs!���"�}���t�w�w�(�(�5�5�6�	F�A��'�'����(9�(9�(G�(G��(J�K�D�� � ��&�=A��[�/�/��G�G�%�%�5�5�a�8�:�;�AE�L����*�*�:�:�1�=�>�	F�		%��#�4�4�{�B���j�j�3�(8�&:�%�AQ�?S�!T�U�G�$�[�[�)9�4�@�N��K��T�!�!�!��8�8�N�+�+rc��|jj|�}|rA|jd�ddvry|jj	|jd��Sy)z( Check is block of HTML is block-level. rr)�!�?�@�%TF)�BLOCK_LEVEL_REGEX�matchr/r�is_block_level)rrBr0s   rr:z!RawHtmlPostprocessor.isblocklevelksS���"�"�(�(��.����w�w�q�z�!�}� 4�4���7�7�)�)�!�'�'�!�*�5�5�rc��t|�S)z' Convert a stashed object to a string. )r"rs  rr8z$RawHtmlPostprocessor.stash_to_stringus���4�y�rNr!)rBr"r#�bool)
r%r&r'r(r>r?rKr r:r8rrrrrEs'��-�"��
�
�#4�5��,�B�rrc��eZdZdZdd�Zy)rz Restore valid entities c�F�|jtjd�}|S)N�&)�replacer�AMP_SUBSTITUTErs  rr zAndSubstitutePostprocessor.run}s���|�|�D�/�/��5���rNr!r$rrrrrzs
��"�rrz�This class is deprecated and will be removed in the future; use [`UnescapeTreeprocessor`][markdown.treeprocessors.UnescapeTreeprocessor] instead.c��eZdZdZej
dj
ejej��Z
dd�Zdd�Zy)�UnescapePostprocessorz Restore escaped chars. z	{}(\d+){}c�H�tt|jd���S)Nr)�chr�intr/)rr0s  r�unescapezUnescapePostprocessor.unescape�s���3�q�w�w�q�z�?�#�#rc�N�|jj|j|�S)N)�REr@rZrs  rr zUnescapePostprocessor.run�s���w�w�{�{�4�=�=�$�/�/rNr4r!)
r%r&r'r(r>r?r;r�STX�ETXr\rZr rrrrVrV�s6��
#�	����L�'�'����$�(�(�;�	<�B�$�0rrV)rr	rrr#zutil.Registry[Postprocessor])r(�
__future__r�collectionsr�typingrr�rr>�markdownr	r�	Processorrrr�
deprecatedrVrrr�<module>rfs{��(�#�#�%��	��!��
�D�N�N�
�*2�=�2�j�������\��	0�M�	0�	�	0r

Zerion Mini Shell 1.0