
    $g
                        d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
 e
r	ddlmc mZ  ej        d          Z G d d	e          Z G d
 de          Zd ZdS )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                      e Zd ZddZdd	Zd
S )LegacyAttrsdocetree.ElementreturnNonec                   |                                 D ]}|                    dd          }|*|                    d|                     ||                     |j        r4t          |j                  r |                     ||j                  |_        |j        r4t          |j                  r |                     ||j                  |_        dS )z2Find and set values of attributes ({@key=value}). altN)itergetsethandleAttributestextr   tail)selfr
   elr   s       `/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/markdown/extensions/legacy_attrs.pyrunzLegacyAttrs.run.   s    ((** 	= 	=B&&%%Cud33B<<===w =8BG,, =//BG<<w =8BG,, =//BG<<	= 	=    r   txtstrc                F    dfd}t                               ||          S )z5 Set attributes and return text without definitions. matchre.Match[str]c                                         |                     d          |                     d                              dd                     d S )N      
 )r   groupreplace)r   r   s    r   attributeCallbackz7LegacyAttrs.handleAttributes.<locals>.attributeCallback;   sA    FF5;;q>>5;;q>>#9#9$#D#DEEEEEr   )r   r   )ATTR_REsub)r   r   r   r'   s    `  r   r   zLegacyAttrs.handleAttributes9   s<    	F 	F 	F 	F 	F 	F{{,c222r   N)r
   r   r   r   )r   r   r   r   r   r   )__name__
__module____qualname__r   r    r   r   r	   r	   -   s<        	= 	= 	= 	=3 3 3 3 3 3r   r	   c                      e Zd Zd ZdS )LegacyAttrExtensionc                X    |j                             t          |          dd           dS )z) Add `LegacyAttrs` to Markdown instance. legacyattrs   N)treeprocessorsregisterr	   )r   mds     r   extendMarkdownz"LegacyAttrExtension.extendMarkdownA   s)    
"";r??M2FFFFFr   N)r*   r+   r,   r6   r-   r   r   r/   r/   @   s(        G G G G Gr   r/   c                     t          di | S )Nr-   )r/   )kwargss    r   makeExtensionr9   F   s    (((((r   )__doc__
__future__r   remarkdown.treeprocessorsr   r   markdown.extensionsr   typingr   xml.etree.ElementTreeetreeElementTreecompiler(   r	   r/   r9   r-   r   r   <module>rD      s  (	 	 # " " " " " 				 ; ; ; ; ; ; ; ; ) ) ) ) ) )             *))))))))) "*-
.
.3 3 3 3 3- 3 3 3&G G G G G) G G G) ) ) ) )r   