a
    t=icó	  ã                   @   s^   d Z ddlZddlmZmZ ddlmZ e d¡ZG dd„ deƒZ	G dd	„ d	eƒZ
d
d„ ZdS )aN  
Python Markdown

A Python implementation of John Gruber's Markdown.

Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/

Started by Manfred Stienstra (http://www.dwerg.net/).
Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org).
Currently maintained by Waylan Limberg (https://github.com/waylan),
Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser).

Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later)
Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
Copyright 2004 Manfred Stienstra (the original version)

License: BSD (see LICENSE.md for details).

Legacy Attributes Extension
===========================

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,
numerious 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.
é    N)ÚTreeprocessorÚisString)Ú	Extensionz\{@([^\}]*)=([^\}]*)}c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚLegacyAttrsc                 C   sz   |  ¡ D ]l}| dd¡}|dur4| d|  ||¡¡ |jrTt|jƒrT|  ||j¡|_|jrt|jƒr|  ||j¡|_qdS )z2Find and set values of attributes ({@key=value}). ÚaltN)ÚiterÚgetÚsetÚhandleAttributesÚtextr   Útail)ÚselfÚdocÚelr   © r   úq/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/markdown/extensions/legacy_attrs.pyÚrun+   s    zLegacyAttrs.runc                    s   ‡ fdd„}t  ||¡S )z5 Set attributes and return text without definitions. c                    s$   ˆ   |  d¡|  d¡ dd¡¡ d S )Né   é   Ú
ú )r	   ÚgroupÚreplace)Úmatch©r   r   r   ÚattributeCallback8   s    z7LegacyAttrs.handleAttributes.<locals>.attributeCallback)ÚATTR_REÚsub)r   r   Útxtr   r   r   r   r
   6   s    zLegacyAttrs.handleAttributesN)Ú__name__Ú
__module__Ú__qualname__r   r
   r   r   r   r   r   *   s   r   c                   @   s   e Zd Zdd„ ZdS )ÚLegacyAttrExtensionc                 C   s   |j  t|ƒdd¡ d S )NZlegacyattrsé   )ZtreeprocessorsÚregisterr   )r   Úmdr   r   r   ÚextendMarkdown>   s    z"LegacyAttrExtension.extendMarkdownN)r   r    r!   r&   r   r   r   r   r"   =   s   r"   c                  K   s   t f i | ¤ŽS )N)r"   )Úkwargsr   r   r   ÚmakeExtensionB   s    r(   )Ú__doc__ÚreZmarkdown.treeprocessorsr   r   Zmarkdown.extensionsr   Úcompiler   r   r"   r(   r   r   r   r   Ú<module>   s   !
