fbpx
Wikipedia

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.[3]

Genshi
Developer(s)Edgewall Software
Initial releaseAugust 3, 2006; 17 years ago (2006-08-03)
Stable release
0.7.7[1]  / 22 April 2022; 2 years ago (22 April 2022)
Repository
  • github.com/edgewall/genshi
Operating systemCross-platform
TypeTemplate Engine
License3-clause BSD license[2]
Websitegenshi.edgewall.org

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 edit

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.[11][12]

Differences between Kid and Genshi edit

  • Genshi directly interprets templates (unlike Kid, which generates Python code)[13]
  • Genshi uses XInclude for template reuse[13]
  • Genshi adds attributes Kid does not have, like py:choose[13]
  • 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.[13]

References edit

  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. ^ . Archived from the original on 2012-02-27. Retrieved 2009-09-26.
  6. ^ . Archived from the original on 2012-07-16. Retrieved 2008-01-20.
  7. ^ . Archived from the original on 2012-04-16. Retrieved 2008-01-20.
  8. ^ "web2py: Enterprise Web Framework". Retrieved 2009-09-26.
  9. ^ Ramm, Mark. . Archived from the original on 2012-07-05. Retrieved 2008-01-20.
  10. ^ Molina, Alessandro. "Docs Review". Retrieved 2024-01-18.
  11. ^ . Archived from the original on 2010-06-16. Retrieved 2010-05-30.
  12. ^ . Archived from the original on 2008-01-17. Retrieved 2008-01-20.
  13. ^ a b c d "Comparing Genshi to Kid". Retrieved 2008-01-20.

External links edit

  • Official website

genshi, templating, language, genshi, template, engine, based, vocabularies, written, python, genshi, used, easily, insert, generated, output, into, based, languages, usually, html, reuse, elements, between, documents, genshi, syntax, based, architecture, diff. 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 GenshiDeveloper s Edgewall SoftwareInitial releaseAugust 3 2006 17 years ago 2006 08 03 Stable release0 7 7 1 22 April 2022 2 years ago 22 April 2022 Repositorygithub wbr com wbr edgewall wbr genshiOperating systemCross platformTypeTemplate EngineLicense3 clause BSD license 2 Websitegenshi wbr edgewall wbr org 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 Contents 1 Genshi markup 2 Differences between Kid and Genshi 3 References 4 External linksGenshi markup editGenshi 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 lt html xmlns http www w3 org 1999 xhtml xmlns py http genshi edgewall org gt lt body gt lt p py content 2 2 gt This will be replaced with 4 lt p gt lt body gt lt html gt Because of the use of namespaces Genshi can be used in WYSIWYG HTML editors 11 12 Differences between Kid and Genshi editGenshi directly interprets templates unlike Kid which generates Python code 13 Genshi uses XInclude for template reuse 13 Genshi adds attributes Kid does not have like py choose 13 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 13 References edit Release 0 7 7 22 April 2022 Retrieved 5 October 2022 License Genshi What is Genshi Retrieved 2008 01 20 CherryPy Genshi Retrieved 2009 09 26 Genshi CherryPy Tools Trac Archived from the original on 2012 02 27 Retrieved 2009 09 26 Genshi Templating Archived from the original on 2012 07 16 Retrieved 2008 01 20 Genshi Templates Pylons Cookbook Archived from the original on 2012 04 16 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 05 Retrieved 2008 01 20 Molina Alessandro Docs Review Retrieved 2024 01 18 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 a b c d Comparing Genshi to Kid Retrieved 2008 01 20 External links editOfficial website Retrieved from https en wikipedia org w index php title Genshi templating language amp oldid 1196928221, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.