%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/reportlab/lib/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/reportlab/lib/__pycache__/pygments2xpre.cpython-312.pyc

�

��d�	���dZdZddlZddlmZd�Zdd�Zd�Zedk(r8ddl	Z	e	jd	dZesed
�e	jd�ee�yy)a�Helps you output colourised code snippets in ReportLab documents.

Platypus has an 'XPreformatted' flowable for handling preformatted
text, with variations in fonts and colors.   If Pygments is installed,
calling 'pygments2xpre' will return content suitable for display in
an XPreformatted object.  If it's not installed, you won't get colours.

For a list of available lexers see http://pygments.org/docs/

)�
pygments2xpre�N)�StringIOc�L�|jdd�}|jdd�}|jdd�}|jdd�}|gd�zD]:\}}|jd|zd|z�}tjd	|zd|z|�}�<tjd
d|�}|S)z<Helper to transform Pygments HTML output to ReportLab markupz<div class="highlight">�z</div>z<pre>z</pre>))�p�#000000)�nr)�errrz<span class="%s">z<span color="%s">z<span class="%s\s+.*">z<span class=".*">z<span color="#0f0f0f">)�replace�re�sub)�s�styles�k�cs    �=/usr/lib/python3/dist-packages/reportlab/lib/pygments2xpre.py�_2xprers���	�	�	�+�B�/�A�	�	�	�(�2��A�	�	�	�'�"��A�	�	�	�(�2��A��I�I�K���!�
�I�I�)�A�-�.A�A�.E�F���F�F�,�a�/�0C�a�0G��J��K�	���#�$<�Q�?�A��H�c
���	ddlm}ddlm}ddlm}d�}t�}||�}|�}|||||�|jj�D�	�
��cgc]T\}	\}
}}|	rI|
rG|
jd�r6|	|
jd�djd�d	j�f��V}
}}
}	}|t|j�|
��S#t$r|cYSwxYwcc}}}
}	w)
z(Return markup suitable for XPreformattedr)�	highlight)�
HtmlFormatter)�get_lexer_by_namec��|S)N�)�xs r�<lambda>zpygments2xpre.<locals>.<lambda>$s��a�rzcolor:�;�:�)�pygmentsr�pygments.formattersr�ImportError�pygments.lexersrr�class2style�items�
startswith�split�stripr�getvalue)r�languagerrr�rconv�out�l�h�cls�style�ttype�levelrs              rrrs����&�5�2��E�
�*�C��(�#�A���A�
�a��!�C��23�-�-�2E�2E�2G�A�A�.�C�.�%����5�U�%5�%5�h�%?��E�K�K��$�Q�'�-�-�c�2�1�5�;�;�=�>�A�F�A�������v�.�/�/��������As�C�AC)
�C&�%C&c�X�ddlm}m}m}ddlm}|�d}|�d}|d�}gj}|D]G}	|||	|���t|	d�j�}
t|
�}||||����I|j|j�td	�y
)z,Helper function - makes minimal PDF documentr)�	Paragraph�SimpleDocTemplate�
XPreformatted)�getSampleStyleSheet�Title�Codezpygments2xpre.pdf)r0�rzsaved pygments2xpre.pdfN)
�reportlab.platypusr4r5r6�reportlab.lib.stylesr7�append�open�readr�build�__self__�print)�	filenamesr4r5r6r7�styT�styC�doc�S�filename�src�fmts            r�convertSourceFilesrK0s���O�N�8�	�	�w�	'�D�	�	�v�	&�D�
�/�
0�C�
�	�	�A��*��	�)�H�4�
(�)��8�S�!�&�&�(���C� ��	�-��4�
(�)�	*�
�I�I�a�j�j��	�
#�$r�__main__rz2usage:  pygments2xpre.py file1.py [file2.py] [...])�python)�__doc__�__all__r�iorrrrK�__name__�sys�argvrCrB�exitrrr�<module>rUsh��	���	��

�0�*%�"�Z���������I��
�B�C��������y�!�
r

Zerion Mini Shell 1.0