https://github.com/jackrosenthal/kajiki
Python XML-based template engine with Genshi-like syntax and Jinja-style blocks
https://github.com/jackrosenthal/kajiki
python python3 template-engine xml
Last synced: about 2 months ago
JSON representation
Python XML-based template engine with Genshi-like syntax and Jinja-style blocks
- Host: GitHub
- URL: https://github.com/jackrosenthal/kajiki
- Owner: jackrosenthal
- License: other
- Created: 2013-06-21T12:39:39.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2025-05-05T05:24:03.000Z (8 months ago)
- Last Synced: 2025-07-06T14:03:21.476Z (6 months ago)
- Topics: python, python3, template-engine, xml
- Language: Python
- Homepage:
- Size: 2.17 MB
- Stars: 50
- Watchers: 11
- Forks: 17
- Open Issues: 8
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE.rst
Awesome Lists containing this project
- awesome-pyramid - Kajiki - provides fast well-formed XML templates, with [Pyramid integration](https://github.com/nandoflorestan/kajiki/blob/master/kajiki/integration/pyramid.py) (Templates)
README
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
=======
.. code:: python
>>> import kajiki
>>> Template = kajiki.XMLTemplate('''
... $title
...
...
$title
... - $title
...
...
...
... ''')
>>> print(Template(dict(title='Kajiki is teh awesome!', repetitions=3)).render())
Kajiki is teh awesome!
Kajiki is teh awesome!
- Kajiki is teh awesome!
- Kajiki is teh awesome!
- Kajiki is teh awesome!
Links
=====
Documentation_
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: https://docs.kajiki.io/
.. _license: https://github.com/jackrosenthal/kajiki/blob/master/LICENSE.rst
.. _`issue tracker`: https://github.com/jackrosenthal/kajiki/issues
.. _GitHub: https://github.com/jackrosenthal/kajiki
.. _SourceForge: http://sourceforge.net/p/kajiki/
.. _Genshi: https://pypi.python.org/pypi/Genshi
.. _Jinja: https://pypi.python.org/pypi/Jinja2
.. _Mako: https://pypi.python.org/pypi/Mako
.. _Chameleon: https://pypi.python.org/pypi/Chameleon