Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2�j���V�SrSSKJr SSKJr SSKJrJr S/rSr	0r3"SS\5rg)	z�4pygments.formatters.svg5~~~~~~~~~~~~~~~~~~~~~~~6 7Formatter for SVG output.8 9:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.10:license: BSD, see LICENSE for details.11�)�	Formatter)�Comment)�get_bool_opt�get_int_opt�SvgFormatterc��URSS5RSS5RSS5RSS5RS	S125$)z<Escape &, <, > as well as single and double quotes for HTML.�&z&amp;�<z&lt;�>z&gt;�"z&quot;�'z&#39;)�replace)�texts �]D:\code\apps\devtools\python\user_packages\Python313\site-packages\pygments/formatters/svg.py�escape_htmlrsE���<�<��W�%����V�$����V�$����X�&����W�%�	&�c�:�\rSrSrSrSrS/rS/rSrSr	Sr13S	rg14)r�ad15Format tokens as an SVG graphics file.  This formatter is still experimental.16Each line of code is a ``<text>`` element with explicit ``x`` and ``y``17coordinates containing ``<tspan>`` elements with the individual token styles.18 19By default, this formatter outputs a full SVG document including doctype20declaration and the ``<svg>`` root element.21 22.. versionadded:: 0.923 24Additional options accepted:25 26`nowrap`27    Don't wrap the SVG ``<text>`` elements in ``<svg><g>`` elements and28    don't add a XML declaration and a doctype.  If true, the `fontfamily`29    and `fontsize` options are ignored.  Defaults to ``False``.30 31`fontfamily`32    The value to give the wrapping ``<g>`` element's ``font-family``33    attribute, defaults to ``"monospace"``.34 35`fontsize`36    The value to give the wrapping ``<g>`` element's ``font-size``37    attribute, defaults to ``"14px"``.38 39`linenos`40    If ``True``, add line numbers (default: ``False``).41 42`linenostart`43    The line number for the first line (default: ``1``).44 45`linenostep`46    If set to a number n > 1, only every nth line number is printed.47 48`linenowidth`49    Maximum width devoted to line numbers (default: ``3*ystep``, sufficient50    for up to 4-digit line numbers. Increase width for longer code blocks).51 52`xoffset`53    Starting offset in X direction, defaults to ``0``.54 55`yoffset`56    Starting offset in Y direction, defaults to the font size if it is given57    in pixels, or ``20`` else.  (This is necessary since text coordinates58    refer to the text baseline, not the top edge.)59 60`ystep`61    Offset to add to the Y coordinate for each subsequent line.  This should62    roughly be the text size plus 5.  It defaults to that value if the text63    size is given in pixels, or ``25`` else.64 65`spacehack`66    Convert spaces in the source to ``&#160;``, which are non-breaking67    spaces.  SVG provides the ``xml:space`` attribute to control how68    whitespace inside tags is handled, in theory, the ``preserve`` value69    could be used to keep all whitespace as-is.  However, many current SVG70    viewers don't obey that rule, so this option is provided as a workaround71    and defaults to ``True``.72�SVG�svgz*.svgc���[R"U40UD6 [USS5UlUR	SS5UlUR	SS5Ul[USS5UlURR5nURS	5(aUSS73R5n[U5n[USU5Ul
[US
US-5Ul[USS5Ul[USS5Ul[USS5Ul[USS5Ul[USSUR-5Ul0Ulg![a SnN�f=f)N�nowrapF�74fontfamily�	monospace�fontsize�14px�xoffsetr�px�������yoffset�ystep��	spacehackT�linenos�linenostart��75linenostep�linenowidth�)r�__init__rr�getrrrr�strip�endswith�int�76ValueErrorr!r"r$r%r&r(r)�_stylecache)�self�options�fs�int_fss    rr+�SvgFormatter.__init__]s7�����4�+�7�+�"�7�H�e�<���!�+�+�l�K�@������J��7��
�"�7�I�q�9���
�]�]�
 �
 �
"��
�;�;�t����C�R�����B�	���W�F�#�7�I�v�>��� ��'�6�A�:�>��77�%�g�{�D�A���#�G�I�e�<���&�w�}�Q�?���%�g�l�1�=���&�w�}�a��78�79�l�K��������	��F�	�s�.E�E�Ec
���URnURnUR(d�UR(a UR	SURS35 OUR	S5 UR	S5 UR	S5 UR	SUR80SURS35 URnURnUR[5nUnUR(aRXV-S	:Xa*UR	S81X0R-SUSUS
US3	5 X�RUR--
nUS-
nUR	S82USUS35 UGHLup�URU	5nU=(a SU-S-=(d SnU=(a S=(d Sn
[U835n84UR(a U85R!5R#SS5n86U87R%S5nUSSH�nUR	X�-U
-5 X@R-
nUR	S5 UR(a2XV-S	:Xa*UR	S88X0R-SUSUSUS3	5 US-
nUR	S89USUS35 M� UR	X�S-U
-5 GMO UR	S5 UR(dUR	S5 gg)z�90Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``91tuples and write it into ``outfile``.92 93For our implementation we put all lines in their own 'line group'.94z<?xml version="1.0" encoding="z"?>95z<?xml version="1.0"?>96zk<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">97z)<svg xmlns="http://www.w3.org/2000/svg">98z<g font-family="z
" font-size="z">99rz	<text x="z" y="z" z text-anchor="end">z</text>r'z" xml:space="preserve">z<tspanr�z</tspan>� z&#160;�100N�����z</text>101z" text-anchor="end" z</g></svg>102)rr!r�encoding�writerrr&r(�103_get_stylerr%r)r"rr$�104expandtabsr�split)r2�tokensource�outfile�x�y�counter�counter_step�
counter_style�line_x�ttype�value�style�tspan�tspanend�parts�parts                r�format_unencoded�SvgFormatter.format_unencodedss���
�L�L���L�L���{�{��}�}��
�
� >�t�}�}�o�U�S�T��
�
�7�8��M�M�*�
+�
�M�M�F�G��M�M�,�T�_�_�,=�]�4�=�=�/�Y]�^�_��"�"����������0�
����<�<��%��*��
�
�	�!�,<�,<�*<�)=�U�1�#�R�
��Vi�jq�ir�ry�z�{��&�&����3�3�F��q�L�G��
�
�	�&���q�c�1H�I�J�'�L�E��O�O�E�*�E��4�h��.��4�:��E��+��1�r�H���&�E��~�~��(�(�*�2�2�3��A���K�K��%�E��c�r�105���
�
�e�l�X�5�6��Z�Z����
�
�k�*��<�<�G�$:�a�$?��M�M�I�a�0@�0@�.@�-A��q�c�I]�^k�]l�lm�nu�mv�v}�"~���1����
�
�	�&���q�c�9T�T�U�#�
�M�M�%��)�+�h�6�7�#(�$	�
�
�i� ��{�{��M�M�.�)�rc��XR;aURU$UnURRU5(d.URnURRU5(dM.URR	U5nSnUS(aSUS-S-nUS(aUS-
nUS(aUS-
nX@RU'U$)	Nr8�colorz fill="#r�boldz font-weight="bold"�italicz font-style="italic")r1rK�styles_token�parent�style_for_token)r2�	tokentype�106otokentyperJ�results     rr>�SvgFormatter._get_style�s����(�(�(��#�#�I�.�.��107��*�*�)�)�)�4�4�!�(�(�I��*�*�)�)�)�4�4��108�109�*�*�9�5������>��%��.�0�3�6�F���=��+�+�F���?��,�,�F�'-����$��
r)r1rrr%r&r(r)rr$rr!r"N)�__name__�110__module__�__qualname__�__firstlineno__�__doc__�name�aliases�	filenamesr+rPr>�__static_attributes__�rrrrs-��:�v�D��g�G��	�I��,5*�nrN)ra�pygments.formatterr�pygments.tokenr�
pygments.utilrr�__all__r�class2stylerrfrr�<module>rls7���)�"�3��111��&���\�9�\r
codekingpro/portable-devtools · Team Ai