
    9 f                     N    d Z ddlmZ ddlZddlmZmZ ddlm	Z	 de
de	d	e
fd
ZdS )ztExpand html.

1. put html tags on individual lines, if needed.
2. put template tags on individual lines, if needed.
    )partialN   )inside_ignored_blockinside_template_block)Confightmlconfigreturnc                     dt           dt          j        dt           f fd}j        }t	          |d          }t	          |d          }j        }t          j        t          j        | d| dt          j        t          j	        z  	          |            t          j        t          j        d
| dt          j        t          j	        z  	          |            dt           dt          j        dt           f fd}t          j        t          j        |dz   j
        z   dz   t          j        t          j        z  t          j	        z  	          t	          |d                      t          j        t          j        dj
        z   dz   t          j        t          j        z  t          j	        z  	          t	          |d                       S )z5Split single line html into many lines based on tags.
out_formatmatchr
   c                 2   t          |          r|                    d          S t          |          r|                    d          S | dk    r-|                                dk    r|                    d          S | |                    d          z  S )zAdd whitespace.

        Do not add whitespace if the tag is in a non indent block.

        Do not add whitespace if the tag is a in a template block
           
%sr   )r   groupr   startr   r   r	   r   s     M/var/www/equiseq/venv/lib/python3.11/site-packages/djlint/formatter/expand.pyadd_html_linez"expand_html.<locals>.add_html_line   s      e44 	";;q>>! u55 	";;q>>!EKKMMQ$6$6;;q>>!EKKNN**    r   z%s
z	\K(</?(?:z,)\b(\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}])*>))flagsz(</?(?:z?)\b(\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}])*>)(?!\s*?\n)(?=[^\n])c                 $   t          |          r|                    d          S t          j        dt	          j                  z   dz   t          j        |                    d                    z   dz   d |                                         t          j        t          j	        z            sK| dk    r-|
                                dk    r|                    d          S | |                    d          z  S |                    d          S )Nr   z\<(?:zE)\b(?:\"[^\">]*\"|'[^'>]*'|{{[^}]*}}|{%[^%]*%}|{\#[^\#]*\#}|[^>{}])*?$r   r   )r   r   refindallstrindent_html_tagsescapeend	MULTILINEVERBOSEr   r   s     r   should_i_move_template_tagz/expand_html.<locals>.should_i_move_template_tag@   s    e44 	";;q>>!zs62333 WW iA''	(
  599;;L2:%	
 	
 	/ V##(:(:{{1~~%A..{{1~~r   z\K((?:{%|{{\#)[ ]*?(?:z)[^}]+?[%}]})z((?:{%|{{\#)[ ]*?(?:z)[^}]+?[%}]})(?=[^
]))r   r   Matchbreak_html_tagsr   break_beforesubcompile
IGNORECASEr!   break_template_tagsr    )r   r	   r   	html_tagsadd_left	add_right
break_charr"   s   ``      r   expand_htmlr.      s   +# +bh +3 + + + + + + +$ &I}f--Hv..I$J 6

aaYaaa-"*,	
 	
 	
 	 D 6

fyfff-"*,	
 	
 	
 	 Ds 28        . 6

'(()  -",.;	
 	
 	
 	*F33
 
D 6

#()&' -",.;		
 	
 	
 	*F33	 	D Kr   )__doc__	functoolsr   regexr   helpersr   r   settingsr   r   r.    r   r   <module>r5      s               A A A A A A A A      `c `6 `c ` ` ` ` ` `r   