
    9 f                     V    d Z ddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ded	e
d
efdZdS )z&Compress html.

1. flatten attributes
    N)html_tag_names)html_void_elements   )child_of_unformatted_block)Confightmlconfigreturnc                      fddt           j        dt          f fd}t          j        t          j        j        t           j        t           j        z  t           j        z            |             S )zCompress html.c                     j         du r/|                                 t          v r|                                 S j         du r|                                 dk    rdS | S )NFdoctypeDOCTYPE)ignore_caselowerr   )tagr	   s    O/var/www/equiseq/venv/lib/python3.11/site-packages/djlint/formatter/compress.py	_fix_casez compress_html.<locals>._fix_case   s[    &&399;;.+H+H99;;&&399;;)+C+C9
    matchr
   c                 z   t          |           r|                                 S |                     d          } |                     d                    }|                     d          rYdd                    d |                     d                                                                          D                       z   nd}|                                t          v r
j        rd}nDd|                     d	          vr|                     d	          nd|                     d	           }| | | | S )
aW  Flatten multiline attributes back to one line.

        Skip when attribute is ignored.
        Attribute name can be in group one or group 2.
        for now, skipping if they are anywhere

        tags starting ignored blocks can have their attributes formatted,
        for example <textarea class="..." id="..."> can be formatted.
           r       c              3   >   K   | ]}|                                 V  d S )N)strip).0xs     r   	<genexpr>z4compress_html.<locals>._clean_tag.<locals>.<genexpr>*   s*      SS!AGGIISSSSSSr    z />/   )r   groupjoinr   
splitlinesr   r   close_void_tags)r   open_braketr   
attributesclose_braketr   r	   r   s        r   
_clean_tagz!compress_html.<locals>._clean_tag   s4    &fdE:: 	!;;== kk!nniA'' {{1~~S388SSu{{1~~/C/C/E/E/P/P/R/RSSSSSSS 	
 99;;,,,1G, LL #&U[[^^";";AAUU[[QR^^AUAU  >s>J>>>>r   )flags)	reMatchstrsubcompilehtml_tag_regex	MULTILINEVERBOSE
IGNORECASE)r   r	   r)   r   s   `` @r   compress_htmlr4      s        ?"( ?s ? ? ? ? ? ? ? ?< 6

!,+bm;	
 	
 	
 	 D Kr   )__doc__regexr+   HtmlTagNamesr   HtmlVoidElementsr   helpersr   settingsr   r-   r4    r   r   <module>r<      s    
     ' ' ' ' ' ' / / / / / / 0 0 0 0 0 0      2 2V 2 2 2 2 2 2 2r   