HTML Generators

Chris Gonnerman chris.gonnerman at
Sun Feb 10 05:47:13 CET 2002

----- Original Message ----- 
From: "Mark Sass" <sassman at>

> Are there any HTML generator modules for Python?  I just want to create
> static html and not use scripts i.e. CGI to do it.  Any available?

The script is named  I use it for all my static web page
generation, and the latest version also supports being used from a CGI
script. is a templating tool; each source (content) document
is stored in a form similar to rfc822; for instance:

    Title: Home Page

    <h1>Example Page</h1>
    Here is an example content page.

This would be stored as index.src (for instance).  Then, the template looks
like this:

    Extensions: .src

    <title>Sample Site -- <!--%title%--></title>
    <body bgcolor=white>

The default name for a template file is  When you run in the same folder as and the .src files,
each .src file is merged with the file to create a like-
named html file.

The <!--%somenamehere%--> comments in the template are replaced with the
source file headers which match the name (case-insensitive).  The "body"
of the source file is put where the <!--%body%--> name appears.  If a
name can't be found in the source file headers, the template file headers
are consulted; there is also a default data context which contains the
name "date" mapping to today's date in MM/DD/YYYY format.  (I haven't 
needed any other formats so far...)  Header values can be substituted
inside header values recursively.

Sounds more complex than it is...

More information about the Python-list mailing list