%PDF- %PDF-
Mini Shell

Mini Shell

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

�

���e�
���dZddlmZddlmZddlmZddlmZddl	m
Z
dd	lZdd	lm
cmZ
Gd
�de�ZGd�d
e�ZGd�de�Zd�Zy	)z�
This extension adds abbreviation handling to Python-Markdown.

See the [documentation](https://Python-Markdown.github.io/extensions/abbreviations)
for details.
�)�annotations�)�	Extension�)�BlockProcessor)�InlineProcessor)�AtomicStringNc��eZdZdZd�Zy)�
AbbrExtensionz- Abbreviation Extension for Python-Markdown. c�x�|jjjt|j�dd�y)z; Insert `AbbrPreprocessor` before `ReferencePreprocessor`. �abbr�N)�parser�blockprocessors�register�AbbrPreprocessor)�self�mds  �:/usr/lib/python3/dist-packages/markdown/extensions/abbr.py�extendMarkdownzAbbrExtension.extendMarkdown$s)��
�	�	�!�!�*�*�+;�B�I�I�+F��PR�S�N)�__name__�
__module__�__qualname__�__doc__r�rrrr!s��7�Trrc�b�eZdZdZej
dej�Zdd�Zdd�Z	d	d�Z
y)
rz= Abbreviation Preprocessor - parse text for abbr references. z6^[*]\[(?P<abbr>[^\]]*)\][ ]?:[ ]*\n?[ ]*(?P<title>.*)$c��y)NTr)r�parent�blocks   r�testzAbbrPreprocessor.test.s��rc���|jd�}|jj|�}|�r2|jd�j	�}|jd�j	�}|j
jjjt|j|�|�d|zd�||j�dj	�r2|jd||j�djd��|d|j�j	�r2|jd|d|j�jd��y|jd|�y	)
z�
        Find and remove all Abbreviation references from the text.
        Each reference is set as a new `AbbrPattern` in the markdown instance.

        rr
�titlezabbr-%srN�
TF)�pop�RE�search�group�striprr�inlinePatternsr�AbbrInlineProcessor�_generate_pattern�end�insert�lstrip�start�rstrip)rr�blocksr �mr
r#s       r�runzAbbrPreprocessor.run1s!���
�
�1�
���G�G�N�N�5�!����7�7�6�?�(�(�*�D��G�G�G�$�*�*�,�E��K�K�N�N�)�)�2�2�#�D�$:�$:�4�$@�%�H�)�VZ�JZ�\]�
��Q�U�U�W�X��$�$�&��
�
�a��q�u�u�w�x��!7�!7��!=�>��Z�a�g�g�i� �&�&�(��
�
�a��z����	�!2�!9�!9�$�!?�@���
�
�a���rc��t|�}tt|��D]
}d||z||<�ddj|�zS)z�
        Given a string, returns an regex pattern to match that string.

        'HTML' -> r'(?P<abbr>[H][T][M][L])'

        Note: we force each char as a literal match (in brackets) as we don't
        know what they will be beforehand.

        z[%s]z(?P<abbr>\b%s\b)�)�list�range�len�join)r�text�chars�is    rr,z"AbbrPreprocessor._generate_patternJsJ���T�
���s�5�z�"�	*�A���q��)�E�!�H�	*�"�c�h�h�u�o�6�6rN)r�
etree.Elementr �str�return�bool)rr>r2z	list[str]r@rA)r;r?r@r?)rrrr�re�compile�	MULTILINEr&r!r4r,rrrrr)s+��G�	����M�r�|�|�	\�B���2
7rrc�,��eZdZdZd�fd�Zdd�Z�xZS)r+z Abbreviation inline pattern. c�2��t�|�|�||_y)N)�super�__init__r#)r�patternr#�	__class__s   �rrHzAbbrInlineProcessor.__init__]s���
����!���
rc���tjd�}t|jd��|_|jd|j�||jd�|jd�fS)Nr
r#r)	�etree�Elementr	r(r;�setr#r0r-)rr3�datar
s    r�handleMatchzAbbrInlineProcessor.handleMatchasS���}�}�V�$�� ������1��	�����$�*�*�%��Q�W�W�Q�Z����q��)�)r)rIr?r#r?)r3z
re.Match[str]rOr?r@ztuple[etree.Element, int, int])rrrrrHrP�
__classcell__)rJs@rr+r+Zs���(��*rr+c��tdi|��S)Nr)r)�kwargss r�
makeExtensionrThs���"�6�"�"r)r�
__future__rr6rrr�inlinepatternsr�utilr	rB�xml.etree.ElementTreerL�ElementTreerrr+rTrrr�<module>rZsP�� �#��,�,��	�%�%�T�I�T�.7�~�.7�b*�/�*�#r

Zerion Mini Shell 1.0