Kid (templating language)

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".

Kid initially acted as the View component of the TurboGears framework in the framework's version 1.x implementation; however, the TurboGears project team has since replaced it with Genshi, citing perceived performance advantages.[1]

Kid is used by the Fedora Project in the repoview utility [2] which creates a set of static HTML pages within a YUM repository.

Example

Python part:

from kid import Template
template = Template(file='mytemplate.kid',
    title='bar',
    mylist=['1', '2', '3', '4', '5', '6']
)
print template.serialize()

Template part:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://purl.org/kid/ns#">
  <head>
    <title py:content="title">title goes here</title>
  </head>
  <body>
    <ul>
      <li py:for="item in mylist" py:content="item">item goes here</li>
    </ul>
  </body>
</html>
gollark: Well, the enderium has to be exactly in the corners.
gollark: <@262782663868284929> How do you feed in the water and keep the enderium going?
gollark: Also it's right there.
gollark: If you're okay with a 6x6x6 then my lattice designs might work, though I don't know if a 6x6x6 one with 8 cells could handle LEU-235.
gollark: Leave it there forever, probably.

References

  1. Replacing Kid with Genshi, A Brief Introduction to Kid Templates — TurboGears v1.0 documentation
  2. Repoview at Fedora Hosted


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.