Genshi (templating language)

Last updated
Genshi
Developer(s) Edgewall Software
Initial releaseAugust 3, 2006;17 years ago (2006-08-03)
Stable release
0.7.7 [1]   OOjs UI icon edit-ltr-progressive.svg / 22 April 2022;20 months ago (22 April 2022)
Repository
Operating system Cross-platform
Type Template Engine
License 3-clause BSD license [2]
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'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. [3]

Contents

Genshi can be used with several Python web frameworks, such as CherryPy, [4] [5] TurboGears, [6] Pylons [7] and web2py. [8] Genshi was the default templating language for TurboGears from versions 1.1 [9] to 2.3.8. [10]

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:

<htmlxmlns="http://www.w3.org/1999/xhtml"xmlns:py="http://genshi.edgewall.org/"><body><ppy: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. [11] [12]

Differences between Kid and Genshi

Related Research Articles

XSLT is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG. Support for JSON and plain-text transformation was added in later updates to the XSLT 1.0 specification.

Zope is a family of free and open-source web application servers written in Python, and their associated online community. Zope stands for "Z Object Publishing Environment", and was the first system using the now common object publishing methodology for the Web. Zope has been called a Python killer app, an application that helped put Python in the spotlight.

Extensible Application Markup Language is a declarative XML-based language developed by Microsoft for initializing structured values and objects. It is available under Microsoft's Open Specification Promise.

The Web Server Gateway Interface is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. The current version of WSGI, version 1.0.1, is specified in Python Enhancement Proposal (PEP) 3333.

Apache Wicket, commonly referred to as Wicket, is a component-based web application framework for the Java programming language conceptually similar to JavaServer Faces and Tapestry. It was originally written by Jonathan Locke in April 2004. Version 1.0 was released in June 2005. It graduated into an Apache top-level project in June 2007.

CherryPy is an object-oriented web application framework using the Python programming language. It is designed for rapid development of web applications by wrapping the HTTP protocol but stays at a low level and does not offer much more than what is defined in RFC 7231.

<span class="mw-page-title-main">Django (web framework)</span> Python web framework

Django is a free and open-source, Python-based web framework that runs on a web server. It follows the model–template–views (MTV) architectural pattern. It is maintained by the Django Software Foundation (DSF), an independent organization established in the US as a 501(c)(3) non-profit.

<span class="mw-page-title-main">TurboGears</span>

TurboGears is a Python web application framework consisting of several WSGI components such as WebOb, SQLAlchemy, Kajiki template language and Repoze.

Kid is a simple template engine for XML-based vocabularies written in Python. Kid claims to have many of the best features of XSLT, TAL, and PHP, but "with much of the limitations and complexity stamped out".

<span class="mw-page-title-main">Web template system</span> System in web publishing

A web template system in web publishing allows web designers and developers work with web templates to automatically generate custom web pages, such as the results from a search. This reuses static web page elements while defining dynamic elements based on web request parameters. Web templates support static content, providing basic structure and appearance. Developers can implement templates from content management systems, web application frameworks, and HTML editors.

Nevow is a Python web application framework originally developed by the company Divmod. Template substitution is achieved via a small Tag Attribute Language, which is usually embedded in on-disk XML templates, though there is also a pure-Python domain-specific language called Stan, for expressing this markup programmatically. Nevow integrates well with Twisted, a framework for event-driven programming.

The Template Attribute Language (TAL) is a templating language used to generate dynamic HTML and XML pages. Its main goal is to simplify the collaboration between programmers and designers. This is achieved by embedding TAL statements inside valid HTML tags which can then be worked on using common design tools.

Web2py is an open-source web application framework written in the Python programming language. Web2py allows web developers to program dynamic web content using Python. Web2py is designed to help reduce tedious web development tasks, such as developing web forms from scratch, although a web developer may build a form from scratch if required.

Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages which mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.

In computing, Facelets is an open-source Web template system under the Apache license and the default view handler technology for Jakarta Server Faces. The language requires valid input XML documents to work. Facelets supports all of the JSF UI components and focuses completely on building the JSF component tree, reflecting the view for a JSF application.

<span class="mw-page-title-main">Flask (web framework)</span> Python web framework

Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools.

Pylons Project is an open-source organization that develops a set of web application technologies written in Python. Initially the project was a single web framework called Pylons, but after the merger with the repoze.bfg framework under the new name Pyramid, the Pylons Project now consists of multiple related web application technologies.

<span class="mw-page-title-main">Business Intelligence Markup Language</span>

Business Intelligence Markup Language (BIML) is a domain-specific XML dialect for defining business intelligence (BI) assets. Biml authored BI assets can currently be used by the BIDS Helper add-on for Microsoft SQL Server Business Intelligence Development Studio (BIDS) and the Varigence Mist integrated development environment; both tools translate Biml metadata into SQL Server Integration Services (SSIS) and SQL Server Analysis Services (SSAS) assets for the Microsoft SQL Server platform. However, emitters can be created to compile Biml for any desired BI platform.

<span class="mw-page-title-main">Mako (template engine)</span> Python template library

Mako is a template library written in Python. Mako is an embedded Python language, which refines the familiar ideas of componentized layout and inheritance. The Mako template is used by Reddit. It is the default template language included with the Pylons and Pyramid web frameworks.

References

  1. "Release 0.7.7". 22 April 2022. Retrieved 5 October 2022.
  2. "License – Genshi".
  3. "What is Genshi?" . Retrieved 2008-01-20.
  4. "CherryPy – Genshi" . Retrieved 2009-09-26.
  5. "Genshi - CherryPy Tools - Trac". Archived from the original on 2012-02-27. Retrieved 2009-09-26.
  6. "Genshi Templating". Archived from the original on 2012-07-16. Retrieved 2008-01-20.
  7. "Genshi Templates - Pylons Cookbook". Archived from the original on 2012-04-16. Retrieved 2008-01-20.
  8. "web2py: Enterprise Web Framework" . Retrieved 2009-09-26.
  9. Ramm, Mark. "TurboGears 1.1 and Beyond". Archived from the original on 2012-07-05. Retrieved 2008-01-20.
  10. Molina, Alessandro. "Docs Review" . Retrieved 2024-01-18.
  11. "Choosing a templating language". Archived from the original on 2010-06-16. Retrieved 2010-05-30.
  12. "Choosing a templating language". Archived from the original on 2008-01-17. Retrieved 2008-01-20.
  13. 1 2 3 4 "Comparing Genshi to Kid" . Retrieved 2008-01-20.