Colorized HTML from Python source
Michael A. Miller
mmiller3 at iupui.edu
Mon Sep 25 13:33:29 EDT 2000
>>>>> <insyte at petra.squad51.net> writes:
> Is there a standard utility for reading Python source and
> producing a spiffy colorized HTML version?
You can use the HTMLgen and HTMLutil.markup to do a simple
colorizing...
#!/usr/bin/env python
import sys
import HTMLgen, HTMLutil, HTMLcolors
if len(sys.argv)==3:
infile = sys.argv[1]
outfile = sys.argv[2]
else:
print 'Usage: %s infile outfile' % sys.argv[0]
sys.exit(0)
d = HTMLgen.SimpleDocument(bgcolor=HTMLcolors.WHITE,title=infile)
d.append(HTMLutil.markup(infile))
d.write(outfile)
More information about the Python-list
mailing list