chris.gonnerman at newcenturycomputers.net
Sun Feb 10 05:47:13 CET 2002
----- Original Message -----
From: "Mark Sass" <sassman at nucentrix.net>
> 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 makesite.py. I use it for all my static web page
generation, and the latest version also supports being used from a CGI
script. makesite.py is a templating tool; each source (content) document
is stored in a form similar to rfc822; for instance:
Title: Home Page
Here is an example content page.
This would be stored as index.src (for instance). Then, the template looks
<title>Sample Site -- <!--%title%--></title>
The default name for a template file is template.site. When you run
makesite.py in the same folder as template.site and the .src files,
each .src file is merged with the template.site 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