
    ei                     d    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
y)zDefinition.    N   )Block   )BlocksExtensionc                        e Zd ZdZdZd Zd Zy)
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     \/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/pymdownx/blocks/definition.py	on_createzDefinition.on_create   s     --    c                 t   g }d}t        t        |            D ]  \  }}|j                  j                         dv r$|j                  j                         dvrr|j                  j                         dk(  rd|_        et	        j
                  d      }|j                  |       |j                  ||z   |       |j                  |       t        |      D ]4  }|dz  }d|_        |j                  ||z   |       |j                  |       6 |j                  |        |D ]  }|j                  |        y)	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   s    !$u+. 	%HAuyy L0",699??$+ $EIt,BIIe$LLVR0LL'u+ %BaKF!BFLLVR0LL$	%
 e$%	%(  	BLL	r   N)__name__
__module____qualname____doc__NAMEr   r'    r   r   r   r      s     D.
r   r   c                       e Zd ZdZd Zy)DefinitionExtensionzDefinition Blocks Extension.c                 L    |j                  t        | j                                y)zExtend Markdown blocks.N)registerr   
getConfigs)r   md	block_mgrs      r   extendMarkdownBlocksz(DefinitionExtension.extendMarkdownBlocks8   s     	:t'8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=      s2     % %  $+ +\:/ :0r   