Any tool to convert Python source code to HTML?

Andrew Bennetts andrew-pythonlist at puzzling.org
Sun Feb 23 19:17:03 EST 2003


On Sun, Feb 23, 2003 at 12:16:57PM -0800, Aki Niimura wrote:
> Hello everyone,
> 
> I thought finding such was very easy but I couldn't find any pointer 
> in the Internet. I would like to put my Python code to my Intranet.
> 
> Instead of putting a plain text, I would like to put a HTMLized code
> (with keyword coloring, simple links to def, class, ...)

Twisted has a very neat (and small!) module written by Moshe Zadka, called
twisted.python.htmlizer.  It basically wraps your source inside lots of
spans tag, e.g. <span class="py-src-identifier">foo</span>.  This means you
can do pretty much all the customisation you need in CSS, without touching
the htmlizer source.  It works very well for the HOWTO docs on
twistedmatrix.com -- have a read through them for a demonstration of what it
can do.

-Andrew.






More information about the Python-list mailing list