HTMLizing scripts

Mark Pilgrim f8dy at
Thu May 3 12:31:57 EDT 2001

"Paul-Michael Agapow" <p.agapow at> wrote in message
news:1eremuh.1fo42071y8e8i6N%p.agapow at
> What are people using to make webpages of their scripts nowadays? I've
> looking at py2html and it produces handsome results, but it uses regex
> and seems (under very quick examination) to have problems on my Mac
> under Python 2 ...

I updated to solve this problem when colorizing the scripts in
my online book.  The updated version uses the re module instead of regex,
uses the keyword module instead of a hard-coded list of reserved words, and
distinguishes between functions and classes; the API is the same as the
older version.  You can download the updated (along with, which is my script that calls it to colorize my book) here:

(That link is subject to change as I release new versions; if it's broken by
the time you read this, try downloading the book from the home page in any format; all downloadable archives include
the example scripts, including

I'm not familiar with py2html, but if it's using pyfontify for its
colorizing, you could probably just plug in the updated version from the
above link, since the API is backwardly compatible.  It's probably better
than my, which was specific to my circumstances (it takes an
already-created HTML file as input and looks for specific tags to mark the
beginning and end of the Python script) and rates as no more than a quick
and dirty hack.

BTW, I sent an e-mail to the original author in the hopes that
he could post the updated version, but I never heard back from him, so I
assumed nobody cared/still used it/wanted to do this sort of thing.

You're smart; why haven't you learned Python yet?

More information about the Python-list mailing list