Fast XML-based template engine with Genshi syntax and Jinja blocks
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!
>>> 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>
- py:with statement now keeps order of variables, so that variables can depend from each other.
- Babel is no longer a dependency unless you want to use the message extractor.
- TranslatableTextNodes are now only generated for non-empty strings
- py:with statement now accepts multiple variables separated by semicolon
- Babel message extractor fixed on Python2
- Fix crash on PyPy
- CDATA sections created by the user are now properly preserved
- cdata_scripts=False option in XMLTemplate allows disabling automatic CDATA for script and style tags.
- Autoblocks experimental feature automatically creates blocks from specified tag names.
- Also accept “$.” without erroring out. In fact, accept anything.
- Add integration plugin for TurboGears 1
- Accept “$(” without erroring out. Easier to write jQuery stuff.
- There was a showstopper regression in FileLoader. Fixes #1
- Support Python versions 2.6, 2.7, 3.2, 3.3 in a single codebase using the nine library.
- Support HTML entities as well as XML entities in input templates.
- py:include fixed, can see global variables.
- Genshi compatibility: support built-in functions: defined(), value_of() and Markup().
- py:def: Do not crash if a function has no content.
- py:strip='' is the same as py:strip='True'.
- Correctness: escape HTML attribute values.
- Correctness: Always close script tags, even in XML mode.
- Add integration module for the Pyramid web framework.
- Give the FileLoader a path, not just a base directory.
- Documentation improvements, including the need to write CDATA sections.
- Move from Sourceforge to Github.
- Use Travis for continuous integration.
- The whole codebase is formatted according to PEP8.
- Several bugfixes
- Output HTML attributes in alphabetical order (for testability)
- Make Kajiki work on Python 2.4
- Fix Python 2.5 syntax error
- Add support for py:with
- Remove unused babel import that was breaking pip/easy_install
- Python 2.5 fixes
- Correctly strip None attributes and expressions
- Turn off autoescaping in text templates
- Adds i18n support
- Fixes several bugs: [#7], [#9], [#10]
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size Kajiki-0.5.3.tar.gz (166.3 kB)||File type Source||Python version None||Upload date||Hashes View hashes|