The package provides an implementation of the Genshi language. However, unlike the reference implementation which comes with a complete ecosystem of supporting components, this implementation is rather bare-bones.
Note
Support for match templates (experimental) requires lxml.
Please see the Genshi XML template reference.
For internationalization support, see Internationalization.
This section contains an autogenerated API reference.
The GenshiTemplate* constructors create templates from XML files.
Base template class.
Note: template language implementations will usually make a subclass available for convenience.
A language parser must be provided as parser. The template body parameter must be a string.
Most language parsers support two modes of operation: XML and text mode. This can be configured using the format parameter (provide either ‘text’ or ‘xml’).
The default string type is unicode. Pass a value for encoding if you need to allow strings that are not unicode or plain ASCII. Note that the output will always be unicode.
To enable default attribute prefix rendering, use the omit_default_prefix parameter (required for certain legacy applications).
To provide a custom translation function, use the translate parameter.
The debug flag can be set to True to enable detailed error reporting. This is recommended for development, but should be disabled in production.
Constructs a template object using the template language defined by parser. Must be passed an absolute (or current-working-directory-relative) filename as filename. If auto_reload is true, each time the template is rendered, it will be recompiled if it has been changed since the last rendering.
The debug flag can be set to True to enable detailed error reporting. This is recommended for development, but should be disabled in production.
Base template class.
Note: template language implementations will usually make a subclass available for convenience.
A language parser must be provided as parser. The template body parameter must be a string.
Most language parsers support two modes of operation: XML and text mode. This can be configured using the format parameter (provide either ‘text’ or ‘xml’).
The default string type is unicode. Pass a value for encoding if you need to allow strings that are not unicode or plain ASCII. Note that the output will always be unicode.
To enable default attribute prefix rendering, use the omit_default_prefix parameter (required for certain legacy applications).
To provide a custom translation function, use the translate parameter.
The debug flag can be set to True to enable detailed error reporting. This is recommended for development, but should be disabled in production.
Base template class.
Note: template language implementations will usually make a subclass available for convenience.
A language parser must be provided as parser. The template body parameter must be a string.
Most language parsers support two modes of operation: XML and text mode. This can be configured using the format parameter (provide either ‘text’ or ‘xml’).
The default string type is unicode. Pass a value for encoding if you need to allow strings that are not unicode or plain ASCII. Note that the output will always be unicode.
To enable default attribute prefix rendering, use the omit_default_prefix parameter (required for certain legacy applications).
To provide a custom translation function, use the translate parameter.
The debug flag can be set to True to enable detailed error reporting. This is recommended for development, but should be disabled in production.
A template loader class is provided (for use with Pylons and other platforms).