Genshi (templating language)
| Please help improve this article by expanding it. Further information might be found on the talk page. (January 2008) |
| Developer(s) | Edgewall Software |
|---|---|
| Initial release | |
| Stable release | 0.5.1 / {{Expansion depth limit exceeded|2008|07|09}} |
| Operating system | Cross-platform |
| Type | Template Engine |
| Website | genshi.edgewall.org |
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 is based on Kid and aims to implement some of its functionality while processing templates faster.[1]
Genshi's can be used with several Python web frameworks, such as CherryPy[2] [3], TurboGears[4], Pylons[5] and web2py[6]. Genshi will eventually replace Kid in the TurboGears web framework.[7]
Genshi Markup
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>
Because of the use of namespaces, Genshi can be used in WYSIWYG HTML editors.[8]
Differences between Kid and Genshi
- Genshi directly interprets templates (unlike Kid, which generates Python code)[9]
- Genshi uses XInclude for template reuse[9]
- Genshi adds attributes Kid does not have, like
py:choose[9]
References
- ↑ [{{Expansion depth limit exceeded||}} "What is Genshi?"]. {{Expansion depth limit exceeded||}}. Retrieved 2008-01-20.
- ↑ [{{Expansion depth limit exceeded||}} "CherryPy – Genshi"]. {{Expansion depth limit exceeded||}}. Retrieved 2009-09-26.
- ↑ [{{Expansion depth limit exceeded||}} "Genshi - CherryPy Tools - Trac"]. {{Expansion depth limit exceeded||}}. Retrieved 2009-09-26.
- ↑ [{{Expansion depth limit exceeded||}} "Genshi Templating"]. {{Expansion depth limit exceeded||}}. Retrieved 2008-01-20.
- ↑ [{{Expansion depth limit exceeded||}} "Genshi Templates - Pylons Cookbook"]. {{Expansion depth limit exceeded||}}. Retrieved 2008-01-20.
- ↑ [{{Expansion depth limit exceeded||}} "web2py: Enterprise Web Framework"]. {{Expansion depth limit exceeded||}}. Retrieved 2009-09-26.
- ↑ Ramm. [{{Expansion depth limit exceeded||}} "TurboGears 1.1 and Beyond"]. {{Expansion depth limit exceeded||}}. Retrieved 2008-01-20.
- ↑ [{{Expansion depth limit exceeded||}} "Choosing a templating language"]. {{Expansion depth limit exceeded||}}. Retrieved 2008-01-20.
- ↑ 9.0 9.1 9.2 [{{Expansion depth limit exceeded||}} "Comparing Genshi to Kid"]. {{Expansion depth limit exceeded||}}. Retrieved 2008-01-20.
External links
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...