$DOCTYPE$
$META$ $ICON$ $STYLE$ $SCRIPT$This is the home of genhtml, a Python script used to construct most of the web pages published at this site. With genhtml, site-wide updates are easy, because common page components are split off to automatic inserts and referenced by name.
This page describes genhtml's roles and mechanics, and provides download links. If you're looking for a quick example of genhtml in action, check out the template of the page you are viewing; one of the inserts it references; and its genhtml expansion. To dive right in, read the docstring of the script, and find genhtml's usage in this site's master publishing utility. And for the full story, read on here.
This Python 3.X program provides basic HTML macro functionality. It replaces keys in a folder's HTML-template files with the content of correspondingly named insert files. The net effect automatically updates static web pages when any common content they share is changed. Among its features, this program has:
This script addresses only static content: common text that can change over time, but need not be generated on each new page request. For such content, though, this program is a simple alternative to:
Besides its utility, this program uses and requires only Python 3.X, runs on any platform that Python 3.X supports (including most PCs and smartphones), and illustrates a typical role for Python code in content-creation pipelines.
See the main script's docstring and other items below for usage details.
Code and docs:
Example:
Usage:
Use the following to fetch genhtml, or view its unzipped content.
This program was last changed: December 2018.
Recent upgrades: genhtml now handles .*
Mac/Unix cruft files
in inserts and templates folders. This includes both .DS_Store
Finder files,
and any ._*
AppleDouble resource-fork files on non-Mac drives. Both are
skipped in inserts to avoid errors, but are simply copied like other non-HTML in templates
because more may crop up before site publication; filter later with your zip or upload
tools (e.g., -skipcruft
in ziptools).
For more code examples, see the programs page.
$FOOTERTAN$