https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/pygments/formatters/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/pygments/formatters/__pycache__/latex.cpython-310.pyc
o

���a�I�@s�dZddlmZddlmZddlmZmZddlm	Z	m
Z
ddlmZm
Z
dgZdd	�Zd
ZdZdd
�ZGdd�de�ZGdd�de�ZdS)z�
    pygments.formatters.latex
    ~~~~~~~~~~~~~~~~~~~~~~~~~

    Formatter for LaTeX fancyvrb output.

    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�)�StringIO)�	Formatter)�Lexer�
do_insertions)�Token�STANDARD_TYPES)�get_bool_opt�get_int_opt�LatexFormattercCs�|�dd��dd��dd��dd|��dd|��dd	|��d
d|��dd
|��dd|��dd|��dd|��dd|��dd|��dd|��dd|��dd|��dd|��d d!|�S)"N�\��{��}�z\%sZbs{}z\%sZob{}z\%sZcb{}�^z\%sZca{}�_z\%sZus{}�&z\%sZam{}�<z\%sZlt{}�>z\%sZgt{}�#z\%sZsh{}�%z\%sZpc{}�$z\%sZdl{}�-z\%sZhy{}�'z\%sZsq{}�"z\%sZdq{}�~z\%sZti{})�replace)�text�
commandprefix�r �;/usr/lib/python3/dist-packages/pygments/formatters/latex.py�
escape_texs&
�r"z�
\documentclass{%(docclass)s}
\usepackage{fancyvrb}
\usepackage{color}
\usepackage[%(encoding)s]{inputenc}
%(preamble)s

%(styledefs)s

\begin{document}

\section*{%(title)s}

%(code)s
\end{document}
a�
\makeatletter
\def\%(cp)s@reset{\let\%(cp)s@it=\relax \let\%(cp)s@bf=\relax%%
    \let\%(cp)s@ul=\relax \let\%(cp)s@tc=\relax%%
    \let\%(cp)s@bc=\relax \let\%(cp)s@ff=\relax}
\def\%(cp)s@tok#1{\csname %(cp)s@tok@#1\endcsname}
\def\%(cp)s@toks#1+{\ifx\relax#1\empty\else%%
    \%(cp)s@tok{#1}\expandafter\%(cp)s@toks\fi}
\def\%(cp)s@do#1{\%(cp)s@bc{\%(cp)s@tc{\%(cp)s@ul{%%
    \%(cp)s@it{\%(cp)s@bf{\%(cp)s@ff{#1}}}}}}}
\def\%(cp)s#1#2{\%(cp)s@reset\%(cp)s@toks#1+\relax+\%(cp)s@do{#2}}

%(styles)s

\def\%(cp)sZbs{\char`\\}
\def\%(cp)sZus{\char`\_}
\def\%(cp)sZob{\char`\{}
\def\%(cp)sZcb{\char`\}}
\def\%(cp)sZca{\char`\^}
\def\%(cp)sZam{\char`\&}
\def\%(cp)sZlt{\char`\<}
\def\%(cp)sZgt{\char`\>}
\def\%(cp)sZsh{\char`\#}
\def\%(cp)sZpc{\char`\%%}
\def\%(cp)sZdl{\char`\$}
\def\%(cp)sZhy{\char`\-}
\def\%(cp)sZsq{\char`\'}
\def\%(cp)sZdq{\char`\"}
\def\%(cp)sZti{\char`\~}
%% for compatibility with earlier versions
\def\%(cp)sZat{@}
\def\%(cp)sZlb{[}
\def\%(cp)sZrb{]}
\makeatother
cCsJt�|�}|r	|Sd}|dur!|d|}|j}t�|�}|dus||S)N����)r�get�parent)�ttype�fname�anamer r r!�_get_ttype_name�s

�r*c@sDeZdZdZdZddgZdgZdd�Zdd	�Zddd�Z	d
d�Z
dS)r
a�
    Format tokens as LaTeX code. This needs the `fancyvrb` and `color`
    standard packages.

    Without the `full` option, code is formatted as one ``Verbatim``
    environment, like this:

    .. sourcecode:: latex

        \begin{Verbatim}[commandchars=\\\{\}]
        \PY{k}{def }\PY{n+nf}{foo}(\PY{n}{bar}):
            \PY{k}{pass}
        \end{Verbatim}

    The special command used here (``\PY``) and all the other macros it needs
    are output by the `get_style_defs` method.

    With the `full` option, a complete LaTeX document is output, including
    the command definitions in the preamble.

    The `get_style_defs()` method of a `LatexFormatter` returns a string
    containing ``\def`` commands defining the macros needed inside the
    ``Verbatim`` environments.

    Additional options accepted:

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

    `full`
        Tells the formatter to output a "full" document, i.e. a complete
        self-contained document (default: ``False``).

    `title`
        If `full` is true, the title that should be used to caption the
        document (default: ``''``).

    `docclass`
        If the `full` option is enabled, this is the document class to use
        (default: ``'article'``).

    `preamble`
        If the `full` option is enabled, this can be further preamble commands,
        e.g. ``\usepackage`` (default: ``''``).

    `linenos`
        If set to ``True``, output line numbers (default: ``False``).

    `linenostart`
        The line number for the first line (default: ``1``).

    `linenostep`
        If set to a number n > 1, only every nth line number is printed.

    `verboptions`
        Additional options given to the Verbatim environment (see the *fancyvrb*
        docs for possible values) (default: ``''``).

    `commandprefix`
        The LaTeX commands used to produce colored output are constructed
        using this prefix and some letters (default: ``'PY'``).

        .. versionadded:: 0.7
        .. versionchanged:: 0.10
           The default is now ``'PY'`` instead of ``'C'``.

    `texcomments`
        If set to ``True``, enables LaTeX comment lines.  That is, LaTex markup
        in comment tokens is not escaped so that LaTeX can render it (default:
        ``False``).

        .. versionadded:: 1.2

    `mathescape`
        If set to ``True``, enables LaTeX math mode escape in comments. That
        is, ``'$...$'`` inside a comment will trigger math mode (default:
        ``False``).

        .. versionadded:: 1.2

    `escapeinside`
        If set to a string of length 2, enables escaping to LaTeX. Text
        delimited by these 2 characters is read as LaTeX code and
        typeset accordingly. It has no effect in string literals. It has
        no effect in comments if `texcomments` or `mathescape` is
        set. (default: ``''``).

        .. versionadded:: 2.0

    `envname`
        Allows you to pick an alternative environment name replacing Verbatim.
        The alternate environment still has to support Verbatim's option syntax.
        (default: ``'Verbatim'``).

        .. versionadded:: 2.0
    �LaTeX�latex�texz*.texcKs�tj|fi|��|�dd�|_|�dd�|_t|dd�|_tt|dd��|_	tt|d	d��|_
|�d
d�|_t|dd�|_|�dd
�|_
t|dd�|_t|dd�|_|�dd�|_t|j�dkrn|jd|_|jd|_nd|_|�dd�|_|��dS)N�docclass�article�preambler#�linenosF�linenostart��
linenostep�verboptions�nobackgroundr�PY�texcomments�
mathescape�escapeinside�r�envname�Verbatim)r�__init__r%r.r0rr1�absr	r2r4r5r6rr8r9r:�len�left�rightr<�_create_stylesheet)�self�optionsr r r!r>�s$zLatexFormatter.__init__c	Cs.tdi}|_i}|_|j}dd�}|jD]~\}}t|�}d}|dr(|d7}|dr0|d7}|dr8|d	7}|d
r@|d7}|drH|d
7}|drP|d
7}|dr^|d||d�7}|drs|d||d�||d�f7}n|dr�|d||d�7}|dkr�q|�d|�}|||<|||<qdS)Nr#cs �rd��fdd�dD��SdS)N�,cs.g|]}dt�|�|dd�d�qS)z%.2fr3�g�o@)�int)�.0�i��colr r!�
<listcomp>s&�zGLatexFormatter._create_stylesheet.<locals>.rgbcolor.<locals>.<listcomp>)rr;�z1,1,1)�joinrKr rKr!�rgbcolors
�z3LatexFormatter._create_stylesheet.<locals>.rgbcolor�boldz\let\$$@bf=\textbf�italicz\let\$$@it=\textit�	underlinez\let\$$@ul=\underline�romanz\let\$$@ff=\textrm�sansz\let\$$@ff=\textsf�mono�colorz'\def\$$@tc##1{\textcolor[rgb]{%s}{##1}}�borderz\\def\$$@bc##1{{\setlength{\fboxsep}{\string -\fboxrule}\fcolorbox[rgb]{%s}{%s}{\strut ##1}}}�bgcolorzH\def\$$@bc##1{{\setlength{\fboxsep}{0pt}\colorbox[rgb]{%s}{\strut ##1}}}z$$)r�
ttype2name�cmd2defr�styler*r)	rD�t2n�c2d�cprPr'�ndef�name�cmndefr r r!rCsN

�

��
�
�z!LatexFormatter._create_stylesheetr#cCsH|j}g}|j��D]\}}|�d|||f�q
t|jd�|�d�S)z�
        Return the command sequences needed to define the commands
        used to format text in the verbatim environment. ``arg`` is ignored.
        z\@namedef{%s@tok@%s}{%s}�
)r_�styles)rr[�items�append�STYLE_TEMPLATErO)rD�argr_rdra�
definitionr r r!�get_style_defs<s�zLatexFormatter.get_style_defscCsj|j}|j}|jr|}t�}|�d|jd�|jr7|j|j}}|�d|r+d|p,d|r3d|p4d�|j	s@|j
s@|jrE|�d�|jrP|�d|j�|�d	�|D�] \}}	|t
jv�r|j
r�|	d
d�}tdt|	��D]}
|d
|	|
kr~n||	|
7}qr|	t|�d�}	t||�}||	}	nu|j	r�|	�d�}d
}t|�D]\}
}
|s�t|
|�||
<|}q�d�|�}	nP|jr�|	}d}	|r�|�|j�\}}}|r�|�|j�\}}}|r�|	t||�|7}	n|	t||||�7}	n|	t||�7}	|s�nt|	|�}	n|t
jv�rt|	|�}	g}|t
u�r6z	|�||�Wnt�y-|�t|��Ynw|j}|t
u�sd�t|��}|�rs|	�d�}|dd�D]}|�rZ|�d|||f�|�d��qK|d�rr|�d|||df�qW|�|	�qW|�d|jd�|j�r�|j�p�d}dddd��|� dd�|�}|�t!t"|j#|j$|j%||�&�|�'�d��dSdS)Nz\begin{z}[commandchars=\\\{\}z
,numbers=leftz,firstnumber=%dr#z,stepnumber=%dz6,codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}rFz]
rr3rF�+rcr$z\%s{%s}{%s}z\end{z}
�utf8�latin1)�utf_8�latin_1�
iso_8859_1rr)r.r0�title�encoding�	styledefs�code)(rZr�fullr�writer<r1r2r4r9r8r:r5r�Comment�ranger@r"�split�	enumeraterO�	partitionrArB�Escaperf�KeyErrorr*r&�reversedrrr%r�DOC_TEMPLATE�dictr.r0rqrj�getvalue)rD�tokensource�outfiler]r_�realoutfile�start�stepr'�valuerJ�parts�in_math�partr�a�sep1�b�sep2rd�styleval�spl�linerrr r r!�format_unencodedHs���




��

�
�

����
��zLatexFormatter.format_unencodedN)r#)�__name__�
__module__�__qualname__�__doc__ra�aliases�	filenamesr>rCrjr�r r r r!r
�sa
-c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�LatexEmbeddedLexera�
    This lexer takes one lexer as argument, the lexer for the language
    being formatted, and the left and right delimiters for escaped text.

    First everything is scanned using the language lexer to obtain
    strings and comments. All other consecutive tokens are merged and
    the resulting text is scanned for escaped segments, which are given
    the Token.Escape type. Finally text that is not escaped is scanned
    again with the language lexer.
    cKs(||_||_||_tj|fi|��dS�N)rArB�langrr>)rDrArBr�rEr r r!r>�szLatexEmbeddedLexer.__init__cCs�d}g}g}|�|�D]#\}}}|dur&|r!|�t|�|f�g}||7}q|�|||f�q|r:|�t|�|f�t||j�|��S)Nr#)�_find_safe_escape_tokensrfr@rr��get_tokens_unprocessed)rDr�buffered�
insertions�
insertion_bufrJ�t�vr r r!r��s

�z)LatexEmbeddedLexer.get_tokens_unprocessedccsf�|�|j�|�dd��D]#\}}}|dur*|�|�D]
\}}}||||fVqq
|d|fVq
dS)z8 find escape tokens that are not in strings or comments cSs|tjvp	|tjvSr�)rrw�String)r�r r r!�<lambda>�sz=LatexEmbeddedLexer._find_safe_escape_tokens.<locals>.<lambda>N)�
_filter_tor�r��_find_escape_tokens)rDrrJr�r��i2�t2�v2r r r!r��s�
���z+LatexEmbeddedLexer._find_safe_escape_tokensccsl�d}d}|D]"\}}}||�r!|r|d|fVd}|||fVq|s%|}||7}q|r4|d|fVdSdS)zC Keep only the tokens that match `pred`, merge the others together r#rNr )rD�it�pred�buf�idxrJr�r�r r r!r��s�
�zLatexEmbeddedLexer._filter_toccs��d}|rV|�|j�\}}}|r|d|fV|t|�7}|rR|�|j�\}}}|rC|t|�tj|fV|t|�t|�t|�7}n|tj|fV|t|�7}|}|sdSdS)z; Find escape tokens within text, give token=None otherwise rN)r{rAr@rBrr|�Error)rDr�indexr�r�r�r�r r r!r��s ��z&LatexEmbeddedLexer._find_escape_tokensN)	r�r�r�r�r>r�r�r�r�r r r r!r��s
r�N)r��ior�pygments.formatterr�pygments.lexerrr�pygments.tokenrr�
pygments.utilrr	�__all__r"rrgr*r
r�r r r r!�<module>s
7%

https://t.me/RX1948 - 2025