Class PrettyPrint
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 (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)
Method Summary |
|
__init__(self,
tagfct,
format,
mode)
|
|
escape_html(self,
text)
|
|
file_filter(self,
infile,
outfile)
|
|
filter_ansi(self,
text)
|
|
filter_html(self,
text)
|
|
filter_rawhtml(self,
text)
|
|
filtertabs(self,
s)
|
|
fontify(self,
pytext)
|
|
set_mode_ansi_mono(self)
|
|
set_mode_html_color(self)
|
|
set_mode_html_mono(self)
|
|
set_mode_rawhtml_color(self)
|
|
set_mode_rawhtml_mono(self)
|
formats
-
- Type:
-
dict
- Value:
|
replace_URLs
-
- Type:
-
int
- Value:
|