
    _f                     X    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ d Zd	S )
a/  
 source: https://gist.github.com/1311010
 Get django-sekizai, django-compessor (and django-cms) playing nicely together
 re: https://github.com/ojii/django-sekizai/issues/4
 using: https://github.com/django-compressor/django-compressor.git
 and: https://github.com/ojii/django-sekizai.git@0.6 or later
    )CompressorNode)UncompressableFileError)
Compressor)settings)	get_class)TextNodec                     t          t          j                  |          t          d          t          d          }}g g g }}}|dk    r                                D ]}                    |          }		 d|	v r|                    |	d                    |                    |           M# t          $ r2 d|	v r|                    |           n|                    |           Y w xY wn|dk    r	                                D ]}                    |          }		 
                    |          dk    r9|	d                                         dk    r|                    |	d                    |                    |           # t          $ r |                    |           Y w xY wd	                    fd
|D                       }t          t          |          |d          }
d	                    fd|D                       }t          t          |          |d          }d	                    fd|D                       }t          t          |          |d          }d                    |
                    |           |                    |           |                    |           g          S )z
    Data is the string from the template (the list of js files in this case)
    Name is either 'js' or 'css' (the sekizai namespace)
    Basically passes the string through the {% compress 'js' %} template tag
    jscsssrcdeferlinkrel
stylesheethref c              3   B   K   | ]}                     |          V  d S Nelem_str.0eparsers     L/var/www/html/env/lib/python3.11/site-packages/compressor/contrib/sekizai.py	<genexpr>zcompress.<locals>.<genexpr>7   /      AA!6??1%%AAAAAA    file)nodelistkindmodec              3   B   K   | ]}                     |          V  d S r   r   r   s     r   r   zcompress.<locals>.<genexpr>9   s/      EE!6??1%%EEEEEEr   c              3   B   K   | ]}                     |          V  d S r   r   r   s     r   r   zcompress.<locals>.<genexpr>;   r   r   
)context)r   r   COMPRESS_PARSERr   js_elemselem_attribsget_basenameappendr   	css_elems	elem_namelowerjoinr   r   get_original_contentrender)r&   datanamejs_compressorcss_compressorcompressable_elementsexpanded_elementsdeferred_elementselemattribsexpanded_nodecompressable_nodedeferred_noder   s                @r   compressr>      s    1Yx/0066F$.t$4$4j6G6G>MBDb".?,t||OO%% 	3 	3D))$//G	3G##!..wu~>>> &,,T2222 + 3 3 3g%%%,,T2222%,,T222	3	3 
$$&& 	3 	3D))$//G	3$$T**f44,,..,>>"//@@@ &,,T2222 + / / /!((...../ 77AAAA/@AAAAAD"HTNNFSSSM77EEEE/DEEEEED&TPVWWW77AAAA/@AAAAAD"HTNNFSSSM99..w.??$$W$55..w.??	
  s%   :B//9C+*C+!AF		F+*F+N)__doc__ compressor.templatetags.compressr   compressor.exceptionsr   compressor.baser   compressor.confr   compressor.utilsr   django.template.baser   r>    r   r   <module>rG      s     < ; ; ; ; ; 9 9 9 9 9 9 & & & & & & $ $ $ $ $ $ & & & & & & ) ) ) ) ) )3 3 3 3 3r   