Skip to main content

Fast XML-based template engine with Genshi syntax and Jinja blocks

Project description

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>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kajiki-1.0.2.tar.gz (48.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kajiki-1.0.2-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file kajiki-1.0.2.tar.gz.

File metadata

  • Download URL: kajiki-1.0.2.tar.gz
  • Upload date:
  • Size: 48.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for kajiki-1.0.2.tar.gz
Algorithm Hash digest
SHA256 fe42d26abc4331982bde426d9f6f4848969868682a19c5882781d5a3e975cc69
MD5 2887b2824526fd3c10c0b43c9a00c7f4
BLAKE2b-256 72216c7e02f5676140aee8b63aed2b59095e41256bad2eebc3e89f8189b00697

See more details on using hashes here.

File details

Details for the file kajiki-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: kajiki-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for kajiki-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 264beced8fb0d41601fc47e4656bd4fd95b92bbc49b646a753c5a02b8bc2f11c
MD5 ee3487676a63889cfca12606b47467ed
BLAKE2b-256 8a06ffe08966c5dc27c499b86a106c223267fa32b3219438956908c6efba5904

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page