HTMLizing scripts

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


"Paul-Michael Agapow" <p.agapow at ic.ac.uk> wrote in message
news:1eremuh.1fo42071y8e8i6N%p.agapow at ic.ac.uk...
>
> 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 pyfontify.py 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 pyfontify.py (along with
colorize.py, which is my script that calls it to colorize my book) here:

http://diveintopython.org/download/diveintopython-examples-3.1-1.tgz

(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
http://diveintopython.org/ in any format; all downloadable archives include
the example scripts, including pyfontify.py.)

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 colorize.py, 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 pyfontify.py 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.

-M
You're smart; why haven't you learned Python yet?
http://diveintopython.org/





More information about the Python-list mailing list