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 : |
o ���a~ � @ s: d Z ddlmZ ddlmZmZ dgZG dd� de�ZdS )z� pygments.formatters.rtf ~~~~~~~~~~~~~~~~~~~~~~~ A formatter that generates RTF files. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � )� Formatter)�get_int_opt� surrogatepair�RtfFormatterc @ s@ e Zd ZdZdZdgZdgZdd� Zdd� Zd d � Z dd� Z d S )r a� 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 K s4 t j| fi |�� |�d�pd| _t|dd�| _dS )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� �fontsizer N)r �__init__�getr r r )�self�options� r �9/usr/lib/python3/dist-packages/pygments/formatters/rtf.pyr 2 s zRtfFormatter.__init__c C s |� dd�� dd�� dd�S )N�\z\\�{z\{�}z\})�replace)r �textr r r �_escapeB s �zRtfFormatter._escapec C s� |sdS | � |�}g }|D ]3}t|�}|dk r|�t|�� q d| kr)dk r3n n|�d| � q d|kr@|�dt|� � q d�|��dd�S )Nr � i z{\u%d}z{\u%d}{\u%d}� z\par )r �ord�append�strr �joinr )r r �buf�c�cnr r r �_escape_textG s �zRtfFormatter._escape_textc C s� |� d| jrd| �| j� pd � i }d}| jD ]?\}}|d |d |d fD ]/}|rW||vrW|||<