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>
        <p>
            Hello $user.firstnames $user.lastname!
        </p>
        <p py:for="verse in in poem">
            <py:for each="line in verse">$line<br/></py:for>
        </p>
    </py:block>
</py:extends>

There’s a text templating mode too:

Hello $user.firstnames $user.lastname!

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

License

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

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

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
piglet_templates-0.4.15-py2.py3-none-any.whl (62.6 kB) Copy SHA256 hash SHA256 Wheel py2.py3
piglet-templates-0.4.15.tar.gz (46.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page