Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
rtf.cpython-313.pyc164 linesDownload Raw Back to __pycache__
1�

2�j�.��`�SrSSKJr SSKJr SSKJr SSKJrJ	r	J3r4Jr S/r"SS\5r
g)	z�5pygments.formatters.rtf6~~~~~~~~~~~~~~~~~~~~~~~7 8A formatter that generates RTF files.9 10:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.11:license: BSD, see LICENSE for details.12�)�OrderedDict)�	Formatter)�_ansimap)�get_bool_opt�get_int_opt�get_list_opt�
surrogatepair�RtfFormatterc��\rSrSrSrSrS/rS/rSrSr	Sr13\S	5rS14r
Sr\S5r\S
5r\S5rSrSrg)r15�a�16Format tokens as RTF markup. This formatter automatically outputs full RTF17documents with color information and other useful stuff. Perfect for Copy and18Paste into Microsoft(R) Word(R) documents.19 20Please note that ``encoding`` and ``outencoding`` options are ignored.21The RTF format is ASCII natively, but handles unicode characters correctly22thanks to escape sequences.23 24.. versionadded:: 0.625 26Additional options accepted:27 28`style`29    The style to use, can be a string or a Style subclass (default:30    ``'default'``).31 32`fontface`33    The used font family, for example ``Bitstream Vera Sans``. Defaults to34    some generic font which is supposed to have fixed width.35 36`fontsize`37    Size of the font used. Size is specified in half points. The38    default is 24 half-points, giving a size 12 font.39 40    .. versionadded:: 2.041 42`linenos`43    Turn on line numbering (default: ``False``).44 45    .. versionadded:: 2.1846 47`lineno_fontsize`48    Font size for line numbers. Size is specified in half points49    (default: `fontsize`). 50 51    .. versionadded:: 2.1852 53`lineno_padding`54    Number of spaces between the (inline) line numbers and the55    source code (default: ``2``).56 57    .. versionadded:: 2.1858 59`linenostart`60    The line number for the first line (default: ``1``).61 62    .. versionadded:: 2.1863 64`linenostep`65    If set to a number n > 1, only every nth line number is printed.66 67    .. versionadded:: 2.1868 69`lineno_color`70    Color for line numbers specified as a hex triplet, e.g. ``'5e5e5e'``. 71    Defaults to the style's line number color if it is a hex triplet, 72    otherwise ansi bright black.73 74    .. versionadded:: 2.1875 76`hl_lines`77    Specify a list of lines to be highlighted, as line numbers separated by78    spaces, e.g. ``'3 7 8'``. The line numbers are relative to the input 79    (i.e. the first line is line 1) unless `hl_linenostart` is set.80 81    .. versionadded:: 2.1882 83`hl_color`84    Color for highlighting the lines specified in `hl_lines`, specified as 85    a hex triplet (default: style's `highlight_color`).86 87    .. versionadded:: 2.1888 89`hl_linenostart`90    If set to ``True`` line numbers in `hl_lines` are specified91    relative to `linenostart` (default ``False``).92 93    .. versionadded:: 2.1894�RTF�rtfz*.rtfc��[R"U40UD6 URS5=(d SUl[	USS5Ul[
USS5Ul[	USUR955Ul[	USS	5Ul	[[	US96S55Ul[[	USS55Ul[
US
S5Ul
URSS5UlUR(dURR Ul/Ul[%US/5HLn['U5nUR(aX R-97S-nUR"R)U5 MN URSS5UlUR,(dDURR.S:Xa[0SUlOURR.UlUR35Ulg![*a M�f=f)aR98Additional options accepted:99 100``fontface``101    Name of the font used. Could for example be ``'Courier New'``102    to further specify the default which is ``'\fmodern'``. The RTF103    specification claims that ``\fmodern`` are "Fixed-pitch serif104    and sans serif fonts". Hope every RTF implementation thinks105    the same about modern...106 107�fontface��fontsizer�linenosF�lineno_fontsize�lineno_padding��linenostart��108linenostep�hl_linenostart�hl_color�hl_lines�lineno_color�inherit�ansibrightblackN)r�__init__�getrrrrrrr�absrrrr�style�highlight_colorrr�int�append�109ValueErrorr�line_number_colorr�_create_color_mapping�
color_mapping)�self�options�linenos   �]D:\code\apps\devtools\python\user_packages\Python313\site-packages\pygments/formatters/rtf.pyr �RtfFormatter.__init__is���	���4�+�7�+����J�/�5�2��
�#�G�Z��;��
�#�G�Y��>���*�7�4E�+/�=�=� :���)�'�3C�Q�G����{�7�M�1�E�F����k�'�<��C�D���*�7�4D�e�L������J��3��
��}�}� �J�J�6�6�D�M���
�"�7�J��;�F�
��V����&�&�#�&6�&6�6��:�F��
�
�$�$�V�,�<�$�K�K���;���� � ��110�111�,�,�	�9�%-�->�$?��!�%)�J�J�$@�$@��!�!�7�7�9�����
��
�s�,AG:�:112H�Hc�f�URSS5RSS5RSS5$)N�\z\\�{z\{�}z\})�replace)r+�texts  r.�_escape�RtfFormatter._escape�s-���|�|�D�&�)��G�C��'��G�C��'�	(�c�|�U(dgURU5n/nUH{n[U5nUS:aUR[U55 M0SUs=::aS:aO OURSU-5 MVSU::dM^URS[	U5-5 M} SRU5R
SS5$)Nr�iz{\u%d}z{\u%d}{\u%d}�113z\par)r6�ordr&�strr	�joinr4)r+r5�buf�c�cns     r.�_escape_text�RtfFormatter._escape_text�s������|�|�D�!�����A��Q��B��T�{��114�115�3�q�6�"��2�'��'��116�117�9�r�>�*��B���118�119�+�m�B�.?�?�@���w�w�s�|�#�#�D�'�2�2r8c�|�USS:XaUSSnS[USSS5[USSS5[USSS54-$)	Nr�#rz\red%d\green%d\blue%d;r���)r%)�	hex_colors r.�hex_to_rtf_color�RtfFormatter.hex_to_rtf_color�s[���Q�<�3��!�!�"�
�I�*��I�a��N�B�/��I�a��N�B�/��I�a��N�B�/�.��	r8c#��# �UHXup#US:XaX#4v� MSU;a;URS5nUSSHnX%S-4v� M
 US(a120X$S4v� MQMSX#4v� MZ g7f)z�121Split tokens containing newline characters into multiple token122each representing a line of the input file. Needed for numbering123lines of e.g. multiline comments.124r;N�����)�split)r+�tokensource�ttype�value�lines�lines      r.�_split_tokens_on_newlines�&RtfFormatter._split_tokens_on_newlines�sw���(�L�E���}��n�$�������D�)��!�#�2�J�D� �t�)�,�,�'���9� ��)�,�,���n�$�(�s�A A"c�4�[5nSnUR(aX!UR'US-
nUR(aX!UR'US-
nUR125H3up4USUSUS4HnU(dMXQ;dMX!U'US-
nM M5 U$)zN126Create a mapping of style hex colors to index/offset in127the RTF color table.128r�color�bgcolor�border)rrrrrr#)r+r*�offset�_r#rWs      r.r)�"RtfFormatter._create_color_mapping�s���129$�
�
����<�<�/5�$�+�+�,��a�K�F��=�=�+1�$�-�-�(��a�K�F��130�131�H�A��w���y�)9�5��?�J���5�U�7�+1�%�(��a�K�F�K�#��r8c�$�URUR:waASRURURURSUR132-5$SRURURSUR133-5$)Nz{{\fs{} \cf{} %s{}}}� z{{\cf{} %s{}}})rr�formatr*rr�r+s r.�_lineno_template�RtfFormatter._lineno_template�s������4�=�=�0�+�2�2�4�3G�3G��,�,�T�->�->�?��� 3� 3�3�5�
5�!�'�'��(:�(:�4�;L�;L�(M��D�/�/�/�1�	1r8c�<�SURURS3$)Nz{\highlightr^)r*rr`s r.�_hl_open_str�RtfFormatter._hl_open_str�s!���t�1�1�$�-�-�@�A��C�Cr8c��/nURSUR=(a SURUR5-=(d S-5 URS5 URR	5H%up#URURU55 M' URS5 URS5 UR(aURSUR-5 URS5 U$)	Nz?{\rtf1\ansi\uc0\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0%s;}}r^rz{\colortbl;r3z\f0\sa0z\fs%dz\dntblnsbdb)r&rr6r*�itemsrJr)r+rRrWr[s    r.�_rtf_header�RtfFormatter._rtf_header�s�����
���G��
�
�6�#��,�,�t�}�}�5�+6�<�9;�=�	>�	���^�$��*�*�0�0�2�H�E��L�L��.�.�u�5�6�3�
���S��	���[�!��=�=��L�L��D�M�M�1�2�134	���^�$��r8c�l�URHnURUS-5 M URU5nUR(acSn/nUH4upgUR	Xg45 URS5(dM/US-
nM6 [
[X@R-S-13555nUnSn	Sn136UGH�upgU137(a*X�R;aURUR5 U138(a�UR(a}X�R-139S-UR-S:Xa,X�R-S-140n[U5RW5nOSRW5nURURU-5 URRU5(dPUR (a?UR nURRU5(dUR (aM?URR#U5n
/nU
S(a$UR	SUR$U
S-5 U
S(a$UR	S	UR$U
S-5 U
S141(aUR	S5 U
S(aUR	S
5 U
S(aUR	S5 U
S(a$UR	SUR$U
S-5 SR'U5nU(aURSUS35 URUR)U55 U(aURS5 Sn142URS5(dGM�X�R;aURS5 URS5 Sn143U	S-
n	GM� URS5 g)Nr;rrTrrXz\cb%drWz\cf%d�boldz\b�italicz\i�	underlinez\ulrYz\chbrdr\chcfpat%dr2r^r3Fz}144)rh�writerTrr&�endswith�lenr=rrrdr�rjustrar#�styles_token�parent�style_for_tokenr*r>rB)r+rO�outfilerS�145line_count�tokensrPrQ�
linenos_widthr-�start_new_line�current_lineno�146lineno_strr#r?�starts                r.�format_unencoded�RtfFormatter.format_unencodeds����$�$�D��M�M�$��+�&�%��4�4�[�A���<�<��J��F� +����
�
�u�n�-��>�>�$�'�'��!�O�J�!,� ��J�/?�/?�$?��$A� B�C�M� �K�����'�L�E��&�M�M�"9��
�
�d�/�/�0��$�,�,��+�+�+�A�-�t���>�!�C�%+�.>�.>�%>��%B�N�!$�^�!4�!:�!:�=�!I�J�!#���-�!8�J��
�
�d�3�3�j�@�A��j�j�-�-�e�4�4���������j�j�-�-�e�4�4������J�J�.�.�u�5�E��C��Y���147�148�8�d�&8�&8��y�9I�&J�J�K��W�~��149�150�8�d�&8�&8��w��&H�H�I��V�}��151�152�5�!��X���153�154�5�!��[�!��155�156�6�"��X���157�158�0��-�-�e�H�o�>�?�@��G�G�C�L�E���
�
��5�'��m�,��M�M�$�+�+�E�2�3���
�
�c�"�"�N��~�~�d�#�#��]�]�*��M�M�#�&��
�
�d�#�!%���!���](�`	�
�
�e�r8)r*rrrrrrrrrrrN)�__name__�159__module__�__qualname__�__firstlineno__�__doc__�name�aliases�	filenamesr r6rB�staticmethodrJrTr)�propertyrardrhr}�__static_attributes__�r8r.r160r161s���O�`�D��g�G��	�I�0:�d(�1623�0����%�$�0�1��1��D��D�����4Gr8N)r��collectionsr�pygments.formatterr�pygments.styler�
pygments.utilrrrr	�__all__r163r�r8r.�<module>r�s3���$�(�#�P�P��164��I�9�Ir8
codekingpro/portable-devtools · Team Ai