Genshi (templating language)
Genshi is a template engine for XML-based vocabularies written in Python. Genshi is used to easily insert generated output into XML-based languages, usually HTML, and reuse elements between documents. Genshi's syntax is based on Kid, but its architecture is different. Genshi aims to implement some of its functionality while processing templates faster, by dynamically processing templates using a stream based API, instead of compiling templates to Python code.
|Initial release||August 3, 2006|
0.7 / January 27, 2013
Genshi makes use of namespaces to embed instructions into HTML. A typical instruction is given as an attribute, with a Python expression inside the quotes. For example, the following will render a paragraph that shows 4:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/"> <body> <p py:content="2 + 2">This will be replaced with 4</p> </body> </html>
Differences between Kid and GenshiEdit
- Genshi directly interprets templates (unlike Kid, which generates Python code)
- Genshi uses XInclude for template reuse
- Genshi adds attributes Kid does not have, like
- Genshi templates are easier to debug, because it tracks template source file names and line numbers, and errors from Genshi's interpreter produce more comprehensible stack traces than from Kid's generated code. 
- "What is Genshi?". Retrieved 2008-01-20.
- "CherryPy – Genshi". Retrieved 2009-09-26.
- "Genshi - CherryPy Tools - Trac". Archived from the original on 2012-07-04. Retrieved 2009-09-26.
- "Genshi Templating". Archived from the original on 2012-07-04. Retrieved 2008-01-20.
- "Genshi Templates - Pylons Cookbook". Archived from the original on 2012-07-04. Retrieved 2008-01-20.
- "web2py: Enterprise Web Framework". Retrieved 2009-09-26.
- Ramm, Mark. "TurboGears 1.1 and Beyond". Archived from the original on 2012-07-04. Retrieved 2008-01-20.
- "Choosing a templating language". Archived from the original on 2010-06-16. Retrieved 2010-05-30.
- "Choosing a templating language". Archived from the original on 2008-01-17. Retrieved 2008-01-20.
- "Comparing Genshi to Kid". Retrieved 2008-01-20.