%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__/admonition.cpython-312.pyc

�

���e����dZddlmZddlmZddlmZddlmcm	Zddl
Z
ddlmZerdd	l
mZGd
�de�ZGd�d
e�Zd�Zy)a
Adds rST-style admonitions. Inspired by [rST][] feature with the same name.

[rST]: http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions

See the [documentation](https://Python-Markdown.github.io/extensions/admonition)
for details.
�)�annotations�)�	Extension�)�BlockProcessorN)�
TYPE_CHECKING)�blockparserc��eZdZdZd�Zy)�AdmonitionExtensionz+ Admonition extension for Python-Markdown. c��|j|�|jjjt	|j�dd�y)z& Add Admonition to Markdown instance. �
admonition�iN)�registerExtension�parser�blockprocessors�register�AdmonitionProcessor)�self�mds  �@/usr/lib/python3/dist-packages/markdown/extensions/admonition.py�extendMarkdownz"AdmonitionExtension.extendMarkdown*s7��
���T�"�
�	�	�!�!�*�*�+>�r�y�y�+I�<�Y\�]�N)�__name__�
__module__�__qualname__�__doc__r�rrrr's��5�^rrc���eZdZdZdZejd�Zejd�Zd
�fd�Z	dd�Z
dd�Zd
d�Zdd	�Z
�xZS)rr
zadmonition-titlez<(?:^|\n)!!! ?([\w\-]+(?: +[\w\-]+)*)(?: +"(.*?)")? *(?:\n|$)z  +c�@��t�|�|�d|_d|_y)zInitialization.Nr)�super�__init__�current_sibling�content_indent)rr�	__class__s  �rr!zAdmonitionProcessor.__init__8s"���	���� �59�����rc��|}d}|j�>|j}|j||j�\}}d|_d|_|||fS|j|�}|�=|jdk7s.|jdd�j
|j�dk(rd}n�|j|�}d}|�}|�v|jd|jzdz�rU|�S|jd	vrE|j|�}|�|j|�nd}||jd}||jz
}nd}|��}|jd|jz�sd}|�2||jz
}|j||�\}}||_||_|||fS)
z�Get sibling admonition.

        Retrieve the appropriate sibling element. This can get tricky when
        dealing with lists.

        �Nr�div�class���� r)�ul�ol�dl)
r"�detabr#�	lastChild�tag�get�find�	CLASSNAME�
startswith�
tab_length)r�parent�block�	old_block�the_rest�sibling�
last_child�indents        r�
parse_contentz!AdmonitionProcessor.parse_content@s����	������+��*�*�G�"�j�j���0C�0C�D�O�E�8�#'�D� �"#�D���E�8�+�+��.�.��(���?�g�k�k�U�2�g�k�k�'�2�6N�6S�6S�TX�Tb�Tb�6c�gi�6i��G�����0�J��F��(��'�E�,<�,<�S�4�?�?�=R�UV�=V�,W��*�z�~�~�AS�/S�
#�n�n�Z�8�G�<C�<O�����!8�UY�J�
"�$�/�/�"2�3�E��d�o�o�-�F�!%�J�#�(�&�#�#�C�$�/�/�$9�:����"��$�/�/�)��"&�*�*�Y��"?���x�'.��$�&,��#���x�'�'rc�h�|jj|�ry|j||�dduS)NTr)�RE�searchr=)rr6r7s   r�testzAdmonitionProcessor.testzs2���7�7�>�>�%� ���%�%�f�e�4�Q�7�t�C�Crc��|jd�}|jj|�}|ri|j�dkDr.|jj||d|j�g�||j
�d}|j|�\}}n|j||�\}}}|r�|j|�\}}tj|d�}	|	jddj|j|��|r�tj|	d�}
||
_|
jd|j �nLj"dvr<|jr0|j}d|_tj|d�}
||
_|}	|jj%|	|�|r|j'd|�yy)Nrr'r(z{} {}�p)�li�ddr&)�popr?r@�startr�parseBlocks�endr.r=�get_class_and_title�etree�
SubElement�set�formatr3�text�CLASSNAME_TITLEr0�
parseChunk�insert)rr6�blocksr7�m�theRestr:�klass�titler'rCrOs            r�runzAdmonitionProcessor.run�su���
�
�1�
���G�G�N�N�5�!����w�w�y�1�}����'�'���z����	�1B�0C�D��!�%�%�'�(�O�E�!�Z�Z��.�N�E�7�&*�&8�&8���&G�#�G�U�G���3�3�A�6�L�E�5��"�"�6�5�1�C��G�G�G�W�^�^�D�N�N�E�B�C���$�$�S�#�.��������g�t�3�3�4��{�{�l�*�w�|�|��|�|��!����$�$�W�c�2������C������s�E�*��
�M�M�!�W�%�	rc��|jd�j�|jd�}}|jjd|�}|�'|j	dd�dj�}||fS|dk(rd}||fS)Nrrr*rr&)�group�lower�	RE_SPACES�sub�split�
capitalize)r�matchrVrWs    rrJz'AdmonitionProcessor.get_class_and_title�s����{�{�1�~�+�+�-�u�{�{�1�~�u�����"�"�3��.���=��K�K��Q�'��*�5�5�7�E�
�e�|��	�b�[��E��e�|�r)rzblockparser.BlockParser)r6�
etree.Elementr7�str�returnz%tuple[etree.Element | None, str, str])r6rar7rbrc�bool)r6rarSz	list[str]rc�None)r`z
re.Match[str]rcztuple[str, str | None])rrrr3rP�re�compiler?r\r!r=rArXrJ�
__classcell__)r$s@rrr1sJ����I�(�O�	����S�	T�B���
�
�5�!�I� �8(�tD�$&�Lrrc��tdi|��S)Nr)r)�kwargss r�
makeExtensionrk�s���(��(�(r)r�
__future__rr&rrr�xml.etree.ElementTreerK�ElementTreerf�typingr�markdownr	rrrkrrr�<module>rqsI��$�#��,�%�%�	� ��$�^�)�^�B�.�B�J)r

Zerion Mini Shell 1.0