The Page Template (PT) renderer is a renderer for plasTeX document objects that supports various page template engines such as Zope Page Templates (ZPT), Jinja2 templates, Cheetah templates, Kid templates, Genshi templates, Python string templates, as well as plain old Python string formatting. It is also possible to add support for other template engines. Note that all template engines except ZPT, Python formats, and Python string templates must be installed in your Python installation. They are not included. In particular the Jinja2 template engine must be installed in order to use the HTML5 renderer.
The ZPT engine is used for all of the plasTeX delivered templates in the XHTML renderer; however, the other templates work in a very similar way. The actual ZPT implementation used is SimpleTAL (http://www.owlfish.com/software/simpleTAL/). This implementation implements almost all of the ZPT API and is very stable. However, some changes were made to this package to make it more convenient to use within plasTeX. These changes are discussed in detail in the ZPT Tutorial (see section 5.3.3).
Since the above template engines can be used to generate any form of XML or HTML, the PT renderer is a general solution for rendering XML or HTML from a plasTeX document object. When switching from one DTD to another, you simply need to use a different set of templates.
As in all Renderer-based renderers, each key in the PT renderer returns a function. These functions are actually generated when the template files are parsed by the PT renderer. As is the case with all rendering methods, the only argument is the node to be rendered, and the output is a unicode object containing the rendered output. In addition to the rendering methods, the textDefault method escapes all characters that are special in XML and HTML (i.e. <, >, and &).
The following sections describe how templates are loaded into the renderer, how to extend the set of templates with your own, as well as a theming mechanism that allows you to apply different looks to output types that are visual (e.g. HTML).