Armin Ronacher | f55b1a4 | 2010-10-17 15:58:08 +0200 | [diff] [blame] | 1 | Jinja2 |
| 2 | ~~~~~~ |
| 3 | |
| 4 | Jinja2 is a template engine written in pure Python. It provides a |
| 5 | `Django`_ inspired non-XML syntax but supports inline expressions and |
| 6 | an optional `sandboxed`_ environment. |
| 7 | |
| 8 | Nutshell |
| 9 | -------- |
| 10 | |
| 11 | Here a small example of a Jinja template:: |
| 12 | |
| 13 | {% extends 'base.html' %} |
| 14 | {% block title %}Memberlist{% endblock %} |
| 15 | {% block content %} |
| 16 | <ul> |
| 17 | {% for user in users %} |
| 18 | <li><a href="{{ user.url }}">{{ user.username }}</a></li> |
| 19 | {% endfor %} |
| 20 | </ul> |
| 21 | {% endblock %} |
| 22 | |
| 23 | Philosophy |
| 24 | ---------- |
| 25 | |
| 26 | Application logic is for the controller but don't try to make the life |
| 27 | for the template designer too hard by giving him too few functionality. |
| 28 | |
| 29 | For more informations visit the new `Jinja2 webpage`_ and `documentation`_. |
| 30 | |
| 31 | The `Jinja2 tip`_ is installable via `easy_install` with ``easy_install |
| 32 | Jinja2==dev``. |
| 33 | |
| 34 | .. _sandboxed: http://en.wikipedia.org/wiki/Sandbox_(computer_security) |
| 35 | .. _Django: http://www.djangoproject.com/ |
| 36 | .. _Jinja2 webpage: http://jinja.pocoo.org/ |
Adrian Petrescu | 1a87fc1 | 2014-06-09 16:55:03 -0400 | [diff] [blame^] | 37 | .. _documentation: http://jinja.pocoo.org/docs/ |
Caleb Williams | dd0f398 | 2014-04-16 23:44:56 -0500 | [diff] [blame] | 38 | .. _Jinja2 tip: http://jinja.pocoo.org/docs/intro/#as-a-python-egg-via-easy-install |