Ñò
Žf¯Jc @ s9 d Z d d k l Z d g Z d e f d „ ƒ YZ d S( sØ
pygments.formatters.rtf
~~~~~~~~~~~~~~~~~~~~~~~
A formatter that generates RTF files.
:copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
iÿÿÿÿ( t Formattert RtfFormatterc B sP e Z d Z d Z d g Z d g Z e Z d „ Z d „ Z d „ Z
d „ Z RS( s
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® Word® documents.
*New in Pygments 0.6.*
Additional options accepted:
`style`
The style to use, can be a string or a Style subclass (default:
``'default'``).
`fontface`
The used font famliy, for example ``Bitstream Vera Sans``. Defaults to
some generic font which is supposed to have fixed width.
t RTFt rtfs *.rtfc K s- t i | | | i d ƒ p d | _ d S( s
Additional options accepted:
``fontface``
Name of the font used. Could for example be ``'Courier New'``
to further specify the default which is ``'modern'``. The RTF
specification claims that ``modern`` are "Fixed-pitch serif
and sans serif fonts". Hope every RTF implementation thinks
the same about modern...
t fontfacet N( R t __init__t getR ( t selft options( ( s; /usr/lib/python2.6/site-packages/pygments/formatters/rtf.pyR * s c C s( | i d d ƒ i d d ƒ i d d ƒ S( Ns \s \\t {s \{t }s \}( t replace( R t text( ( s; /usr/lib/python2.6/site-packages/pygments/formatters/rtf.pyt _escape8 s c C s | p d S| i | ƒ } | i d
j o
d } n | i p d } g } x› | D]“ } t | ƒ d j og | i | d ƒ p d } t | ƒ d j o d t | ƒ } n | } | i d
t | ƒ | f ƒ qR | i t | ƒ ƒ qR Wd i | ƒ i d d ƒ S( NR s utf-8s utf-16s utf-32s iso-8859-15i€ t ignoret ?s \'%xs \ud{\u%d%s}s
s \par
( s utf-8s utf-16s utf-32( R t encodingt ordt encodet appendt strt joinR ( R R
R t buft ct ansic( ( s; /usr/lib/python2.6/site-packages/pygments/formatters/rtf.pyt _escape_text= s"
!c C s• | i d | i o d | i | i ƒ p d ƒ h } d } x³ | i D]¨ \ } } x™ | d | d | d f D]| } | oo | | j ob | | | <| i d t | d d
!d ƒ t | d
d !d ƒ t | d d
!d ƒ f ƒ | d 7} qp qp WqH W| i d ƒ x€| D]x\ } } x, | i i | ƒ o | i o
| i } qW| i i | ƒ } g }
| d o |
i d | | d ƒ n | d o |
i d | | d ƒ n | d o |
i d ƒ n | d o |
i d ƒ n | d o |
i d ƒ n | d o |
i d | | d ƒ n d i |
ƒ } | o | i d | ƒ n | i | i
| ƒ ƒ | o | i d ƒ qqW| i d ƒ d S( NsF {\rtf1\ansi\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0%s;}}{\colortbl;t R i t colort bgcolort borders \red%d\green%d\blue%d;i i i i i s }\f0s \cb%ds \cf%dt bolds \bt italics \it underlines \uls \chbrdr\chcfpat%ds {%s R ( t writeR R t stylet intt styles_tokent parentt style_for_tokenR R R ( R t tokensourcet outfilet
color_mappingt offsett _R# R t ttypet valueR t start( ( s; /usr/lib/python2.6/site-packages/pygments/formatters/rtf.pyt format_unencodedW sZ
( t __name__t
__module__t __doc__t namet aliasest filenamest Falset
unicodeoutputR R R R0 ( ( ( s; /usr/lib/python2.6/site-packages/pygments/formatters/rtf.pyR s N( R3 t pygments.formatterR t __all__R ( ( ( s; /usr/lib/python2.6/site-packages/pygments/formatters/rtf.pyt