Piglet: Fast Python Template Engine¶
Documentation contents¶
- This page
- Template reuse: inheritance and template functions
- Using Piglet from a python module
- i18n and translations
- Directives reference
- Whitespace handling
- Built in template functions
- Text templates
- Changelog
- 1.1.0 (released 2020-12-08)
- 1.0.0 (released 2020-04-23)
- 0.5.1 (released 2020-01-28)
- 0.5.0 (released 2019-11-06)
- 0.4.15 (released 2018-10-30)
- 0.4.14 (released 2018-09-04)
- 0.4.13 (released 2018-07-30)
- 0.4.12 (released 2018-06-29)
- 0.4.11 (released 2017-09-21)
- 0.4.10 (released 2017-09-21)
- 0.4.9 (released 2017-09-15)
- 0.4.8 (released 2017-07-22)
- 0.4.7 (released 2017-04-20)
- 0.4.6 (released 2017-04-19)
- 0.4.5 (released 2017-03-13)
- 0.4.4 (released 2017-01-08)
- 0.4.3 (released 2016-11-29)
- 0.4.2 (released 2016-11-08)
- 0.4.1 (released 2016-10-17)
- 0.4 (released 2016-10-16)
- 0.3 (released 2016-10-03)
- 0.2 (released 2016-10-02)
- 0.1 (released 2016-10-01)
Overview of Piglet templates¶
Piglet is a templating engine that compiles templates to fast python byte code. Piglet HTML templates look like this:
<py:extends href="base.html">
<py:block name="content">
Hello ${name}!
<ul>
<li py:for="item in bag">$item</li>
</ul>
</py:block>
</py:extends>
Learn more about Piglet’s template directives, or how to use piglet’s Python API.
Piglet also has a text mode:
{% extends "base.txt" %}
{% block "content" %}
Hello ${name}!
{% for item in bag %}
- $item
{% end %}
{% end %}
{% end %}
Piglet also contains flexible translation directives and is designed to work for internationalized applications.
Read more in the documentation contents.