
    ei                         d Z ddlmc mZ ddlmZmZmZ ddlm	Z	 ddl
Z
 e
j                  d      Z G d d	e      Z G d
 de	      Zd Zy)zDetails.    N   )Blocktype_booleantype_html_identifier   )BlocksExtensionz[_-]+c                   >    e Zd ZdZdZdZdefdefdZdZ	dZ
d Zd Zy)	Detailsaz  
    Details.

    Arguments (1 optional):
    - A summary.

    Options:
    - `open` (boolean): force the details block to be in an open state opposed to collapsed.
    - `type` (string): Attach a single special class for styling purposes. If more are needed,
      use the built-in `attributes` options to apply as many classes as desired.

    Content:
    Detail body.
    detailsNF )opentypec                     | j                   dk7  rkd| j                   i| j                  d<   | j                  r| j                  | j                  d   d<   | j                  r| j                  | j                  d   d<   y)zHandle on validate event.r   namer   titleclassT)NAMEoptions	DEF_TITLE	DEF_CLASS)selfparents     Y/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/pymdownx/blocks/details.pyon_validatezDetails.on_validate%   sf     99	!$*DII#6DLL ~~04V$W-~~04V$W-    c                 T   i }| j                   d   rd|d<   | j                   d   }dx}x}}t        |t              rL|d   }|j                  d|      }|j                  dt        j                  d|      j                               }n8t        |t              r(|}|}t        j                  d|      j                         }|r||d<   t        j                  |d|      }d	}| j                  |r|}n| j                  r| j                  }|t        j                  |d
      }	||	_        |S )zCreate the element.r   r   r   r   r   r    r   Nsummary)r   
isinstancedictgetRE_SEPsubr   stretree
SubElementargumenttext)
r   r   
attributesobjdtype	def_title
class_nameelr   ss
             r   	on_createzDetails.on_create0   s$    
<<!'Jv ll6")+++	Jc4 KE%0JC)D)J)J)LMIS!EJ

3
399;I",Jw fi< == #]]mmG   Y/AAF	r   )__name__
__module____qualname____doc__r   ARGUMENTr   r   OPTIONSr   r   r   r0    r   r   r
   r
   
   sA     DH%)*G
 II	&r   r
   c                   (     e Zd ZdZ fdZd Z xZS )DetailsExtensionzAdmonition Blocks Extension.c                 :    dg dgi| _         t        |   |i | y)zInitialize.typesz9Generate Admonition block extensions for the given types.N)configsuper__init__)r   argskwargs	__class__s      r   r>   zDetailsExtension.__init__\   s0     K
 	$)&)r   c                 (   |j                  t        | j                                | j                  dg       D ]  }t	        |t
              rL|d   }|j                  d|      }|j                  dt        j                  d|      j                               }n(|}|}t        j                  d|      j                         }t        j                  d|      j                         }|j                  t        |t        fddt        gi|||d	      i         y
)zExtend Markdown blocks.r;   r   r   r   r   r   r   F)r6   r   r   r   N)registerr
   
getConfigs	getConfigr   r    r!   r"   r#   r   r   r   )r   md	block_mgrr*   r   r-   r   subclasss           r   extendMarkdownBlocksz%DetailsExtension.extendMarkdownBlocksh   s     	7DOO$56 >>'2. 	C#t$6{ WWWd3
C)D)J)J)LM!


3
399;zz"d+113HJ$*UL,A#B $%*%/		 	r   )r1   r2   r3   r4   r>   rI   __classcell__)rA   s   @r   r9   r9   Y   s    &
*r   r9   c                      t        | i |S )zReturn extension.)r9   )r?   r@   s     r   makeExtensionrL      s     T,V,,r   )r4   xml.etree.ElementTreer%   ElementTreeblockr   r   r   blocksr   recompiler"   r
   r9   rL   r7   r   r   <module>rS      sK     % % < < $ 		H	Le L^+ +\-r   