New: as of June 2017, 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 pop up before publication—filter later with your
zip or upload tools (e.g., ziptools).
See the new script's docstring for details. For a quick example of genhtml at work, see also the template file for the page you are viewing, and its genhtml expansion. There are also new example site-publisher master scripts here and here that use genhtml as a nested tool, and are used to publish the website you are viewing.
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, and illustrates a typical role for Python code.
See the main script's docstring and other items below for usage details.
Code and docs:
Use the following to fetch genhtml, or view its unzipped content.
This program was last changed: September 2018.
For more code examples, see the programs page.