
    $g                     r    d Z ddlmc mZ ddlmZ ddlmZ  G d de          Z G d	 d
e          Z	d Z
dS )zDefinition.    N   )Block   )BlocksExtensionc                   "    e Zd ZdZdZd Zd ZdS )
Definitionz
    Definition.

    Converts non `ul`, `ol` blocks (ideally `p` tags) into `dt`
    and will convert first level `li` elements of `ul` and `ol`
    elements to `dd` tags. When done, the `ul`, and `ol` elements
    will be removed.
    definec                 ,    t          j        |d          S )zCreate the element.dl)etree
SubElement)selfparents     Z/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/pymdownx/blocks/definition.py	on_createzDefinition.on_create   s     ---    c                    g }d}t          t          |                    D ]\  }}|j                                        dv r"|j                                        dvr}|j                                        dk    rd|_        bt	          j        d          }|                    |           |                    ||z   |           |                    |           t          |          D ]<}|dz  }d|_        |                    ||z   |           |                    |           =|                    |           |D ]}|                    |           dS )	z"Convert non list items to details.r   )dtdd)ulolpr   r   r   N)		enumeratelisttaglowerr   Elementappendinsertremove)	r   blockr    offsetichildr   liels	            r   on_endzDefinition.on_end   sc    !$u++.. 	% 	%HAuy  L00"",669??$$++ $EIIt,,BIIe$$$LLVR000LL''''u++ % %BaKF!BFLLVR000LL$$$$e$$$$ 	 	BLL	 	r   N)__name__
__module____qualname____doc__NAMEr   r'    r   r   r   r      sC          D. . .
    r   r   c                       e Zd ZdZd ZdS )DefinitionExtensionzDefinition Blocks Extension.c                 `    |                     t          |                                            dS )zExtend Markdown blocks.N)registerr   
getConfigs)r   md	block_mgrs      r   extendMarkdownBlocksz(DefinitionExtension.extendMarkdownBlocks8   s*     	:t'8'899999r   N)r(   r)   r*   r+   r5   r-   r   r   r/   r/   5   s)        &&: : : : :r   r/   c                      t          | i |S )zReturn extension.)r/   )argskwargss     r   makeExtensionr9   >   s     ////r   )r+   xml.etree.ElementTreer   ElementTreer!   r   blocksr   r   r/   r9   r-   r   r   <module>r=      s      % % % % % % % % %       $ $ $ $ $ $+ + + + + + + +\: : : : :/ : : :0 0 0 0 0r   