Package lemon :: Package external :: Module py2html
[show private | hide private]
[frames | no frames]

Module lemon.external.py2html

Python Highlighter for HTML                          Version: 0.5

py2html.py [options] files...

options:
 -h             print help
 -              read from stdin, write to stdout
 -stdout        read from files, write to stdout
 -files         read from files, write to filename+'.html' (default)
 -format:
   html         output HTML page (default)
   rawhtml      output pure HTML (without headers, titles, etc.)
 -mode:
   color        output in color (default)
   mono         output b/w (for printing)
 -title:Title   use 'Title' as title of the generated page
 -bgcolor:color use color as background-color for page
 -header:file   use contents of file as header
 -footer:file   use contents of file as footer
 -URL           replace all occurances of 'URL: link' with
                                '<A HREF="link">link</A>'; this is always enabled
                                in CGI mode
 -v             verbose

Takes the input, assuming it is Python code and formats it into
colored HTML. When called without parameters the script tries to
work in CGI mode. It looks for a field 'script=URL' and tries to
use that URL as input file. If it can't find this field, the path
info (the part of the URL following the CGI script name) is
tried. In case no host is given, the host where the CGI script
lives and HTTP are used.

* Uses Just van Rossum's PyFontify version 0.3 to tag Python scripts.
  You can get it via his homepage on starship:
        URL: http://starship.skyport.net/crew/just

Classes
PrettyPrint generic Pretty Printer class...

Function Summary
  addsplits(splits, text, formats, taglist)
  fileio(file, mode, data, close)
  main(cmdline)
main(cmdline) -- process cmdline as if it were sys.argv...
  redirect_to(url)
  write_html_error(titel, text)

Variable Summary
str __cgifooter__ = '\n<PRE># code highlighted using <A HREF...
str __comments__ = '\n\n\tThe following snippet is a small s...
str __copyright__ = '\n-------------------------------------...
str __version__ = '0.5'
str INPUT_FORM = 'http://starship.skyport.net/~lemburg/Softw...

Function Details

main(cmdline)

main(cmdline) -- process cmdline as if it were sys.argv

Variable Details

__cgifooter__

Type:
str
Value:
'''
<PRE># code highlighted using <A HREF="http://starship.skyport.net/~le\
mburg/">py2html.py</A> version 0.5</PRE>
'''                                                                    

__comments__

Type:
str
Value:
'''

\tThe following snippet is a small shell script I use for viewing
\tPython scripts per less on Unix:
#!/bin/sh
# Browse pretty printed Python code using ANSI codes for highlighting
py2html -stdout -format:ansi -mode:mono $* | less -r

...                                                                    

__copyright__

Type:
str
Value:
'''
----------------------------------------------------------------------\
-------
(c) Copyright by Marc-Andre Lemburg, 1998 (mailto:mal@lemburg.com)

\tPermission to use, copy, modify, and distribute this software and it\
s
\tdocumentation for any purpose and without fee or royalty is hereby g\
...                                                                    

__version__

Type:
str
Value:
'0.5'                                                                  

INPUT_FORM

Type:
str
Value:
'http://starship.skyport.net/~lemburg/SoftwareDescriptions.html#py2htm\
l.py'                                                                  

Generated by Epydoc 2.0 on Mon Nov 10 15:07:39 2003 http://epydoc.sf.net