colorize (version 0.3, 2005-07-04)
Up
colorize.py

MoinMoin - Python source parser and colorizer

Download source: colorize.py

 
Modules
       
cStringIO
cgi
keyword
string
sys
token
tokenize

 
Classes
       
Parser

 
class Parser
    Send colored python source.
 
  Methods defined here:
__call__(self, toktype, toktext, (srow, scol), (erow, ecol), line)
Token handler.
__init__(self, raw, out=<open file '<stdout>', mode 'w'>)
Store the source text.
format(self)
Parse and send the colored source.

Data and other attributes defined here:
stylesheet = '<style type="text/css">\npre.code {\n font-styl...bold;\n}\n.text {\n color: #000000;\n}\n\n</style>\n\n'

 
Functions
       
colorize_file(file=None, outstream=<open file '<stdout>', mode 'w'>, standalone=True)
Convert a python source file into colorized HTML.
 
Reads file and writes to outstream (default sys.stdout). file can be a
filename or a file-like object (only the read method is used). If file is
None, act as a filter and read from sys.stdin. If standalone is True
(default), send a complete HTML document with header and footer. Otherwise
only a stylesheet and a <pre> section are written.

 
Data
        __author__ = 'J\xfcrgen Hermann, Mike Brown, Christopher Arndt'
__date__ = '2005-07-04'
__license__ = 'GPL'
__version__ = '0.3'

 
Author
        Jürgen Hermann, Mike Brown, Christopher Arndt