Table of Contents

Class: PrettyPrint Twisted-0.19.0/admin/py2html.py

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__
escape_html
file_filter
filter_ansi
filter_html
filter_rawhtml
fontify
set_mode_ansi_color
set_mode_ansi_mono
set_mode_html_color
set_mode_html_mono
set_mode_rawhtml_color
  __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 )


Table of Contents

This document was automatically generated on Sun Jul 14 19:52:28 2002 by HappyDoc version 2.0