Skip to main content

Fast, robust HTML templating engine

Project description

piglet-templates is a text and HTML templating engine in the genshi/kajiki templates family.

The Piglet template engine offers:

  • Template inhertitance through <py:extends>/<py:block> (similar to Jinja2)
  • Compiles templates to fast python byte code.
  • HTML templating: templates produce well formed HTML. Template variables are autoescaped to protect against XSS attacks.
  • Reusable template functions.
  • Good i18n support.
  • Clear tracebacks from exceptions raised in templates.

Piglet Template Engine Documentation | Repository

Example piglet template:

<py:extends href="layout.html">
    <py:block name="content">
        <h1>This is the content block.</h1>
            Hello $user.firstnames $user.lastname!
        <p py:for="verse in poem">
            <py:for each="line in verse">$line<br/></py:for>

There’s a text templating mode too:

Hello $user.firstnames $user.lastname!

{% for verse in poem %}
    {% for line in verse %}$line
    {% end %}
{% end %}


Piglet-templates is licensed under the Apache license version 2.0.

Piglet-templates is developed by Olly Cope and was created for

Project details

Download files

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

Files for piglet-templates, version 1.2.0
Filename, size File type Python version Upload date Hashes
Filename, size piglet_templates-1.2.0-py3-none-any.whl (67.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size piglet-templates-1.2.0.tar.gz (47.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page