generic Pretty Printer class
supports tagging Python scripts in the following ways: # format/mode | color mono
# --------------------------
# rawhtml | x x (HTML without headers, etc.)
# html | x x (a HTML page with HEAD&BODY:)
# ansi | x x (with Ansi-escape sequences)
interfaces:
- file_filter
- takes two files: input & output (may be stdin/stdout)
filter -- takes a string and returns the highlighted version
to create an instance use: c = PrettyPrint(tagfct,format,mode)
where format and mode must be strings according to the
above table if you plan to use PyFontify.fontify as
tagfct
the tagfct has to take one argument, text, and return a taglist
(format: [(id,left,right,sublist),...], where id is the
"name" given to the slice left:right in text and sublist is a
taglist for tags inside the slice or None)
Methods
|
|
|
|
__init__
|
__init__ (
self,
tagfct=None,
format='html',
mode='color',
)
|
|
escape_html
|
escape_html ( self, text )
|
|
file_filter
|
file_filter (
self,
infile,
outfile,
)
|
|
filter_ansi
|
filter_ansi ( self, text )
|
|
filter_html
|
filter_html ( self, text )
|
|
filter_rawhtml
|
filter_rawhtml ( self, text )
|
|
fontify
|
fontify ( self, pytext )
|
|
set_mode_ansi_color
|
set_mode_ansi_color ( self )
|
|
set_mode_ansi_mono
|
set_mode_ansi_mono ( self )
|
|
set_mode_html_color
|
set_mode_html_color ( self )
|
|
set_mode_html_mono
|
set_mode_html_mono ( self )
|
|
set_mode_rawhtml_color
|
set_mode_rawhtml_color ( self )
|
|