1.0.1 HTML Generation

There are two common approaches to generating HTML: write HTML from program code (Perl, C, ...) or embed commands with HTML pages (PHP, Cold Fusion, ...).

This system takes a third approach. A Python program builds a DOM-like, in-memory tree that represents an HTML document. Tree nodes represent tagged HTML elements; subtrees represent the contents ot those tags. HTML is generated by walking the tree.

The main advantage of this approach is that tree nodes can be added in any order. For example, the page title can be added to the tree after the body is complete. This is useful for presenting summary information: "Phone Book: Coster to Dunning." A second advantage is that the HTML is always correct and properly nested.

The system can generate static HTML pages or dynamic HTML pages responding to CGI requests.