Ņō
fŊJc @ s d Z d d k l Z d d k l Z l Z l Z d d k l Z d d k l
Z
d d g Z d e f d YZ d e f d YZ
d
S( sę
pygments.formatters.other
~~~~~~~~~~~~~~~~~~~~~~~~~
Other formatters: NullFormatter, RawTokenFormatter.
:copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
iĸĸĸĸ( t Formatter( t OptionErrort get_choice_optt b( t Token( t colorizet
NullFormattert RawTokenFormatterc B s2 e Z d Z d Z d d g Z d g Z d Z RS( s;
Output the text unchanged without any formatting.
s Text onlyt textt nulls *.txtc C sR | i } xB | D]: \ } } | o | i | i | q | i | q Wd S( N( t encodingt writet encode( t selft tokensourcet outfilet enct ttypet value( ( s= /usr/lib/python2.6/site-packages/pygments/formatters/other.pyt format s ( t __name__t
__module__t __doc__t namet aliasest filenamesR ( ( ( s= /usr/lib/python2.6/site-packages/pygments/formatters/other.pyR s
c B sA e Z d Z d Z d d g Z d g Z e Z d Z d Z RS( s}
Format tokens as a raw representation for storing token streams.
The format is ``tokentyperepr(tokenstring)\n``. The output can later
be converted to a token stream with the `RawTokenLexer`, described in the
`lexer list `_.
Only two options are accepted:
`compress`
If set to ``'gz'`` or ``'bz2'``, compress the output with the given
compression algorithm after encoding (default: ``''``).
`error_color`
If set to a color name, highlight error tokens using that color. If
set but with no value, defaults to ``'red'``.
*New in Pygments 0.11.*
s
Raw tokenst rawt tokenss *.rawc K sÞ t i | | | i o t d n d | _ t | d d d d d g d | _ | i d d | _ | i t j o
d | _ n | i d j oA y t
| i d WqÚ t j
o t d
| i qÚ Xn d S( Ns6 the raw formatter does not support the encoding optiont asciit compresst t nonet gzt bz2t error_colort reds Invalid color %r specified(
R t __init__R
R R R t gett NoneR" t TrueR t KeyErrort
ValueError( R
t options( ( s= /usr/lib/python2.6/site-packages/pygments/formatters/other.pyR$ > s
c s y i t d Wn t j
o t d n X| i d j o@ d d k } | i d d d f d } i } nl | i d j oC d d k } | i d f d } f d
} n f d } i } d } d } | i
o_ x | D]P \ } }
d
| |
f } | t i j o | t
| i
| q| | qWn, x( | D] \ } }
| d
| |
f qpW| d S( NR s3 The raw tokens formatter needs a binary output fileR iĸĸĸĸt wbi c s i | i d S( N( R R ( R ( R ( s= /usr/lib/python2.6/site-packages/pygments/formatters/other.pyR Y s R! c s i i | i d S( N( R R R ( R ( t
compressorR ( s= /usr/lib/python2.6/site-packages/pygments/formatters/other.pyR _ s c s! i i i d S( N( R t flush( ( R R, ( s= /usr/lib/python2.6/site-packages/pygments/formatters/other.pyR- a s c s i | i d S( N( R R ( R ( R ( s= /usr/lib/python2.6/site-packages/pygments/formatters/other.pyR e s u s %s %r
( R R t TypeErrorR t gzipt GzipFileR- R! t
BZ2CompressorR&