Kajiki: Fast Templates for Python¶
Kajiki provides fast well-formed XML templates¶
Because Kajiki’s input is XML, it can ensure that your HTML/XML output is well-formed. The Genshi-like syntax, based on XML attributes or tags, is simply beautiful and easily understood (or ignored) by web designers. But instead of the slow performance of Genshi, Kajiki compiles templates to Python code that renders with blazing-fast speed, so Kajiki can compete with the speed of Jinja, Mako, Chameleon and others. Also, one of Genshi’s misfeatures – py:match – is replaced with blocks which work like Jinja’s blocks.
By combining the best ideas out there – XML input, Genshi’s syntax and features, Jinja’s template inheritance and final compilation to Python –, Kajiki is ready to become the most widely used templating engine for web development in Python. And more features are coming soon; stay tuned!
Example¶
>>> import kajiki
>>> Template = kajiki.XMLTemplate('''<html>
... <head><title>$title</title></head>
... <body>
... <h1>$title</h1>
... <ul>
... <li py:for="x in range(repetitions)">$title</li>
... </ul>
... </body>
... </html>''')
>>> print(Template(dict(title='Kajiki is teh awesome!', repetitions=3)).render())
<html>
<head><title>Kajiki is teh awesome!</title></head>
<body>
<h1>Kajiki is teh awesome!</h1>
<ul>
<li>Kajiki is teh awesome!</li><li>Kajiki is teh awesome!</li><li>Kajiki is teh awesome!</li>
</ul>
</body>
</html>
Links¶
Kajiki is licensed under an MIT-style license.
The git repository and issue tracker are at GitHub. Previously the project used SourceForge for the hg repository, issue tracker and forums.
Documentation contents¶
- Kajiki Templating Basics
- Kajiki XML Templates
- Kajiki Text Templates
- Migrating from Genshi
- Internationalization
- Command Line Interface
- Kajiki Runtime
- CHANGES
- 0.9.2 (2022-11-24)
- 0.9.1 (2022-04-20)
- 0.9.0 (2021-11-29)
- 0.8.3 (2021-06-18)
- 0.8.2 (2019-11-26)
- 0.8.1 (2019-10-20)
- 0.8.0 (2019-06-03)
- 0.7.2 (2018-04-16)
- 0.7.1 (2017-09-11)
- 0.7.0 (2017-06-27)
- 0.6.3 (2017-05-25)
- 0.6.1 (2016-11-28)
- 0.6.0 (2016-11-27)
- 0.5.5 (2016-06-08)
- 0.5.4 (2016-06-04)
- 0.5.3 (2016-01-25)
- 0.5.2 (2015-10-13)
- 0.5.1 (2015-07-26)
- 0.5.0 (2015-07-25)
- 0.4.4 (2013-09-07)
- 0.4.3 (2013-08-12)
- 0.4.2 (2013-08-01)
- 0.4.0 (2013-07-29)
- 0.3.5 (2012-05-07)
- 0.3.4 (2011-06-01)
- 0.3.2 (2010-11-26)
- 0.3.1 (2010-11-24)
- 0.3 (2010-10-10)