请输入您要查询的百科知识:

 

词条 Genshi (templating language)
释义

  1. Genshi markup

  2. Differences between Kid and Genshi

  3. References

  4. External links

{{Infobox software
|name = Genshi
|logo =
|developer = Edgewall Software
|released = {{Start date and age|2006|08|03}}
|latest_release_version= 0.7
|latest_release_date = {{Start date and age|2013|01|27}}
|operating_system = Cross-platform
|genre = Template Engine
|license =
|website = {{URL|http://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.[1]

Genshi can be used with several Python web frameworks, such as CherryPy,[2][3] TurboGears,[4] Pylons[5] and web2py.[6] Genshi has replaced Kid in the TurboGears 2.x 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:

This will be replaced with 4

Because of the use of namespaces, Genshi can be used in WYSIWYG HTML editors.[8][9]

Differences between Kid and Genshi

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

References

1. ^{{cite web|url=http://genshi.edgewall.org/wiki/GenshiFaq#WhatisGenshi|title=What is Genshi?|accessdate=2008-01-20}}
2. ^{{cite web|url=http://genshi.edgewall.org/wiki/CherryPy|title=CherryPy – Genshi|accessdate=2009-09-26}}
3. ^{{cite web|url=http://tools.cherrypy.org/wiki/Genshi|title=Genshi - CherryPy Tools - Trac|accessdate=2009-09-26|deadurl=yes|archiveurl=https://www.webcitation.org/68trxCg7K?url=http://tools.cherrypy.org/wiki/Genshi|archivedate=2012-07-04|df=}}
4. ^{{cite web|url=http://docs.turbogears.org/1.0/GenshiTemplating|title=Genshi Templating|accessdate=2008-01-20}}
5. ^{{cite web|url=http://wiki.pylonshq.com/display/pylonscookbook/Genshi+templates|title=Genshi Templates - Pylons Cookbook|accessdate=2008-01-20}}
6. ^{{cite web|url=http://www.web2py.com/AlterEgo/default/show/162|title=web2py: Enterprise Web Framework|accessdate=2009-09-26}}
7. ^{{cite web|url=http://compoundthinking.com/blog/index.php/2007/06/27/turbogears-11-and-beyond/|title=TurboGears 1.1 and Beyond|last=Ramm|first=Mark|accessdate=2008-01-20}}
8. ^{{cite web |url=http://docs.cherrypy.org/dev/progguide/choosingtemplate.html#id3 |title=Choosing a templating language |accessdate=2010-05-30 |deadurl=yes |archiveurl=https://web.archive.org/web/20100616155159/http://docs.cherrypy.org/dev/progguide/choosingtemplate.html#id3 |archivedate=2010-06-16 |df= }}
9. ^{{cite web |url=http://www.cherrypy.org/wiki/ChoosingATemplatingLanguage#Genshi |title=Choosing a templating language |accessdate=2008-01-20 |deadurl=yes |archiveurl=https://web.archive.org/web/20080117034122/http://www.cherrypy.org/wiki/ChoosingATemplatingLanguage#Genshi |archivedate=2008-01-17 |df= }}
10. ^{{cite web|url=http://genshi.edgewall.org/wiki/GenshiVsKid|title=Comparing Genshi to Kid|accessdate=2008-01-20}}

External links

  • {{official website|http://genshi.edgewall.org/}}
{{DEFAULTSORT:Genshi (Templating Language)}}

6 : Free system software|Free software programmed in Python|Python software|Scripting languages|Python libraries|Template engines

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/28 5:34:10