HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/pygments/formatters/__pycache__/groff.cpython-37.pyc
B

��f��@sBdZddlZddlmZddlmZmZdgZGdd�de�ZdS)z�
    pygments.formatters.groff
    ~~~~~~~~~~~~~~~~~~~~~~~~~

    Formatter for groff output.

    :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�	Formatter)�get_bool_opt�get_int_opt�GroffFormatterc@sZeZdZdZdZdddgZgZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)ra
    Format tokens with groff escapes to change their color and font style.

    .. versionadded:: 2.11

    Additional options accepted:

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

    `monospaced`
        If set to true, monospace font will be used (default: ``true``).

    `linenos`
        If set to true, print the line numbers (default: ``false``).

    `wrap`
        Wrap lines to the specified number of characters. Disabled if set to 0
        (default: ``0``).
    ZgroffZtroffZroffcKsVtj|f|�t|dd�|_t|dd�|_d|_t|dd�|_d|_i|_	|�
�dS)N�
monospacedT�linenosFr�wrap)r�__init__rrr�_linenorr�_linelen�styles�_make_styles)�self�options�r�J/opt/alt/python37/lib/python3.7/site-packages/pygments/formatters/groff.pyr	-szGroffFormatter.__init__cCs�|jr
dnd}|jrdnd}|jr&dnd}x�|jD]�\}}d}}|drb|d	|d7}d
|}|drz||7}||}|dr�||7}||}|d
r�|d|d
7}d|}||f|j|<q2WdS)Nz\f[CR]z\f[R]z\f[CB]z\f[B]z\f[CI]z\f[I]��colorz\m[%s]z\m[]�bold�italicZbgcolorz\M[%s]z\M[])r�styler)rZregularrr�ttype�ndef�start�endrrrr
:s$zGroffFormatter._make_stylescCsdt�}x,|jD]"\}}|ddk	r|�|d�qWx*t|�D]}|�d|d|d�q>WdS)Nrz
.defcolor z rgb #�
)�setr�add�sorted�write)r�outfile�colors�_rrrrr�_define_colorsQszGroffFormatter._define_colorscCs4|jd7_|�d|jdkr"dp$d|jf�dS)N�z%s% 4d rr)r
r)rr rrr�
_write_lineno[szGroffFormatter._write_linenocCs�t|�d��}|jrdnd}d}||jkr�xLtdt�||j��D]2}|||j||j|j�}||d|7}qBW||j}|dkr�|||dd�7}||_n6|j||jkr�d||}||_n|}|j|7_|S)Nrz     rrr$)�len�rstriprr�range�math�floorr)r�line�length�space�newline�i�chunk�	remainderrrr�
_wrap_line`s"

zGroffFormatter._wrap_linecCs�|�dd��dd��dd��dd��d	d
�}|}x^|D]V}t|�t|���kr6|�d���dd��d
d���}|�|d|dd�d�}q6W|S)N�\z\[u005C]�.z	\[char46]�'z\[u0027]�`z\[u0060]�~z\[u007E]Zunicode_escaper$�x�u00z\[u�])�replacer&�encode�decode�upper)r�text�copy�char�unirrr�
_escape_charsws

 zGroffFormatter._escape_charsc		Cs|�|�|�d�|jr$|�|�x�|D]�\}}x||jkrF|j}q4W|j|\}}x�|�d�D]�}|jdkrz|�|�}|r�|r�|�	|�
d��}|dkr�|�d�|||f��n|�|�	|�
d���|�d�rb|jr�|�|�d|_
qb|�d�d|_
qbWq*W|�d�dS)Nz.nf
\f[CR]
Trrrz
.fi)r#rrr%r�parent�
splitlinesrr2rCr'�join�endswithr)	rZtokensourcer r�valuerrr+r?rrr�format_unencoded�s.








zGroffFormatter.format_unencodedN)�__name__�
__module__�__qualname__�__doc__�name�aliases�	filenamesr	r
r#r%r2rCrIrrrrrs


)	rMr)Zpygments.formatterrZ
pygments.utilrr�__all__rrrrr�<module>	s