HOME


Mini Shell 1.0
DIR: /lib/python3/dist-packages/pygments/formatters/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/pygments/formatters/__pycache__/rtf.cpython-312.pyc
�

|�e~��@�dZddlmZddlmZmZdgZGd�de�Zy)z�
    pygments.formatters.rtf
    ~~~~~~~~~~~~~~~~~~~~~~~

    A formatter that generates RTF files.

    :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�)�	Formatter)�get_int_opt�
surrogatepair�RtfFormatterc�8�eZdZdZdZdgZdgZd�Zd�Zd�Z	d�Z
y	)
ra�
    Format tokens as RTF markup. This formatter automatically outputs full RTF
    documents with color information and other useful stuff. Perfect for Copy and
    Paste into Microsoft(R) Word(R) documents.

    Please note that ``encoding`` and ``outencoding`` options are ignored.
    The RTF format is ASCII natively, but handles unicode characters correctly
    thanks to escape sequences.

    .. versionadded:: 0.6

    Additional options accepted:

    `style`
        The style to use, can be a string or a Style subclass (default:
        ``'default'``).

    `fontface`
        The used font family, for example ``Bitstream Vera Sans``. Defaults to
        some generic font which is supposed to have fixed width.

    `fontsize`
        Size of the font used. Size is specified in half points. The
        default is 24 half-points, giving a size 12 font.

        .. versionadded:: 2.0
    �RTF�rtfz*.rtfc��tj|fi|��|jd�xsd|_t	|dd�|_y)a�
        Additional options accepted:

        ``fontface``
            Name of the font used. Could for example be ``'Courier New'``
            to further specify the default which is ``'\fmodern'``. The RTF
            specification claims that ``\fmodern`` are "Fixed-pitch serif
            and sans serif fonts". Hope every RTF implementation thinks
            the same about modern...

        �fontface��fontsizerN)r�__init__�getrrr
)�self�optionss  �9/usr/lib/python3/dist-packages/pygments/formatters/rtf.pyrzRtfFormatter.__init__2s<��	���4�+�7�+����J�/�5�2��
�#�G�Z��;��
�c�f�|jdd�jdd�jdd�S)N�\z\\�{z\{�}z\})�replace)r�texts  r�_escapezRtfFormatter._escapeBs-���|�|�D�&�)��G�C��'��G�C��'�	(rc�`�|sy|j|�}g}|D]s}t|�}|dkr|jt|���.d|cxkrdkrnn|jd|z��Qd|ks�W|jdt	|�z��udj|�j
dd�S)Nr�iz{\u%d}z{\u%d}{\u%d}�
z\par
)r�ord�append�strr�joinr)rr�buf�c�cns     r�_escape_textzRtfFormatter._escape_textGs������|�|�D�!�����	A�A��Q��B��T�{��
�
�3�q�6�"��2�'��'��
�
�9�r�>�*��B���
�
�+�m�B�.?�?�@�	A��w�w�s�|�#�#�D�)�4�4rc��|jd|jxrd|j|j�zxsdz�i}d}|jD]h\}}|d|d|dfD]R}|s�||vs�|||<|jdt	|d	d
d�t	|d
dd�t	|dd
d�fz�|dz
}�T�j|jd�|j
r|jd|j
z�|D�]y\}}	|jj
|�s@|jr4|j}|jj
|�s
|jr�4|jj|�}g}
|dr|
jd||dz�|dr|
jd||dz�|dr|
jd�|dr|
jd�|dr|
jd�|dr|
jd||dz�dj|
�}|r|jd|z�|j|j|	��|s��i|jd���||jd�y)NzJ{\rtf1\ansi\uc0\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0%s;}}{\colortbl;� r��color�bgcolor�borderz\red%d\green%d\blue%d;r����z}\f0 z\fs%dz\cb%dz\cf%d�boldz\b�italicz\i�	underlinez\ulz\chbrdr\chcfpat%dz{%s r)�writerr�style�intr
�styles_token�parent�style_for_tokenrr!r%)r�tokensource�outfile�
color_mapping�offset�_r4r)�ttype�valuer"�starts            r�format_unencodedzRtfFormatter.format_unencoded_s}���
�
�%�(,�
�
�)J�(+�d�l�l�4�=�=�.I�(I�)+�(*�	,�	-��
����
�
�		 �H�A�u��w���y�)9�5��?�J�
 ���U�-�7�+1�M�%�(��M�M�"=��E�!�A�J��+��E�!�A�J��+��E�!�A�J��+�A�#��
�a�K�F�
 �		 �	�
�
�h���=�=��M�M�(�T�]�]�2�3�(�	#�L�E�5��j�j�-�-�e�4���������j�j�-�-�e�4�����J�J�.�.�u�5�E��C��Y���
�
�8�m�E�)�4D�&E�E�F��W�~��
�
�8�m�E�'�N�&C�C�D��V�}��
�
�5�!��X���
�
�5�!��[�!��
�
�6�"��X���
�
�0�(��x��9�:�;��G�G�C�L�E���
�
�f�u�n�-��M�M�$�+�+�E�2�3���
�
�c�"�/	#�2	�
�
�c�rN)�__name__�
__module__�__qualname__�__doc__�name�aliases�	filenamesrrr%rA�rrrrs0���6�D��g�G��	�I�<� (�
5�03rN)rE�pygments.formatterr�
pygments.utilrr�__all__rrIrr�<module>rMs*���)�4��
��@�9�@r