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

�

���e�
���dZddlmZddlZddlmZmZddlmZddl	m
Z
e
r	ddlmcm
Zejd�ZGd�d	e�ZGd
�de�Zd�Zy)
a<
An extension to Python Markdown which implements legacy attributes.

Prior to Python-Markdown version 3.0, the Markdown class had an `enable_attributes`
keyword which was on by default and provided for attributes to be defined for elements
using the format `{@key=value}`. This extension is provided as a replacement for
backward compatibility. New documents should be authored using `attr_lists`. However,
numerous documents exist which have been using the old attribute format for many
years. This extension can be used to continue to render those documents correctly.
�)�annotationsN)�
Treeprocessor�isString)�	Extension)�
TYPE_CHECKINGz\{@([^\}]*)=([^\}]*)}c��eZdZdd�Zdd�Zy)�LegacyAttrsc��|j�D]�}|jdd�}|�"|jd|j||��|jr6t|j�r!|j||j�|_|js��t|j�s��|j||j�|_��y)z2Find and set values of attributes ({@key=value}). �altN)�iter�get�set�handleAttributes�textr�tail)�self�doc�elrs    �B/usr/lib/python3/dist-packages/markdown/extensions/legacy_attrs.py�runzLegacyAttrs.run.s����(�(�*�	=�B��&�&���%�C������u�d�3�3�B��<�=��w�w�8�B�G�G�,��/�/��B�G�G�<����w�w�8�B�G�G�,��/�/��B�G�G�<���	=�c�<��d�fd�}tj||�S)z5 Set attributes and return text without definitions. c����j|jd�|jd�jdd��y)N���
� )r�group�replace)�matchrs �r�attributeCallbackz7LegacyAttrs.handleAttributes.<locals>.attributeCallback;s.����F�F�5�;�;�q�>�5�;�;�q�>�#9�#9�$��#D�Er)r z
re.Match[str])�ATTR_RE�sub)rr�txtr!s `  rrzLegacyAttrs.handleAttributes9s���	F��{�{�,�c�2�2rN)r�
etree.Element�return�None)rr%r$�strr&r()�__name__�
__module__�__qualname__rr�rrr	r	-s��	=�3rr	c��eZdZd�Zy)�LegacyAttrExtensionc�P�|jjt|�dd�y)z) Add `LegacyAttrs` to Markdown instance. �legacyattrs�N)�treeprocessors�registerr	)r�mds  r�extendMarkdownz"LegacyAttrExtension.extendMarkdownAs��
���"�"�;�r�?�M�2�FrN)r)r*r+r5r,rrr.r.@s��Grr.c��tdi|��S)Nr,)r.)�kwargss r�
makeExtensionr8Fs���(��(�(r)�__doc__�
__future__r�re�markdown.treeprocessorsrr�markdown.extensionsr�typingr�xml.etree.ElementTree�etree�ElementTree�compiler"r	r.r8r,rr�<module>rCsV��(	�#�	�;�)� ��)�)��"�*�*�-�
.��3�-�3�&G�)�G�)r

Zerion Mini Shell 1.0