Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes
MoinMoin.support.pygments.formatter.Formatter Class Reference

List of all members.

Public Member Functions

def __init__
def get_style_defs
def format

Public Attributes

 style
 full
 title
 encoding
 options

Static Public Attributes

 name = None
list aliases = []
list filenames = []
 unicodeoutput = True

Detailed Description

Converts a token stream to text.

Options accepted:

``style``
    The style to use, can be a string or a Style subclass
    (default: "default"). Not used by e.g. the
    TerminalFormatter.
``full``
    Tells the formatter to output a "full" document, i.e.
    a complete self-contained document. This doesn't have
    any effect for some formatters (default: false).
``title``
    If ``full`` is true, the title that should be used to
    caption the document (default: '').
``encoding``
    If given, must be an encoding name. This will be used to
    convert the Unicode token strings to byte strings in the
    output. If it is "" or None, Unicode strings will be written
    to the output file, which most file-like objects do not
    support (default: None).
``outencoding``
    Overrides ``encoding`` if given.

Definition at line 26 of file formatter.py.


Constructor & Destructor Documentation

Definition at line 66 of file formatter.py.

00066 
00067     def __init__(self, **options):
00068         self.style = _lookup_style(options.get('style', 'default'))
00069         self.full  = get_bool_opt(options, 'full', False)
00070         self.title = options.get('title', '')
00071         self.encoding = options.get('encoding', None) or None
00072         self.encoding = options.get('outencoding', None) or self.encoding
00073         self.options = options


Member Function Documentation

def MoinMoin.support.pygments.formatter.Formatter.format (   self,
  tokensource,
  outfile 
)
Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``
tuples and write it into ``outfile``.

Definition at line 84 of file formatter.py.

00084 
00085     def format(self, tokensource, outfile):
00086         """
00087         Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``
00088         tuples and write it into ``outfile``.
00089         """
00090         if self.encoding:
00091             # wrap the outfile in a StreamWriter
00092             outfile = codecs.lookup(self.encoding)[3](outfile)
00093         return self.format_unencoded(tokensource, outfile)

Here is the call graph for this function:

Return the style definitions for the current style as a string.

``arg`` is an additional argument whose meaning depends on the
formatter used. Note that ``arg`` can also be a list or tuple
for some formatters like the html formatter.

Definition at line 74 of file formatter.py.

00074 
00075     def get_style_defs(self, arg=''):
00076         """
00077         Return the style definitions for the current style as a string.
00078 
00079         ``arg`` is an additional argument whose meaning depends on the
00080         formatter used. Note that ``arg`` can also be a list or tuple
00081         for some formatters like the html formatter.
00082         """
00083         return ''

Here is the caller graph for this function:


Member Data Documentation

Definition at line 57 of file formatter.py.

Definition at line 70 of file formatter.py.

Definition at line 60 of file formatter.py.

Definition at line 68 of file formatter.py.

Definition at line 54 of file formatter.py.

Definition at line 72 of file formatter.py.

Definition at line 67 of file formatter.py.

Definition at line 69 of file formatter.py.

Definition at line 64 of file formatter.py.


The documentation for this class was generated from the following file: