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 | |
Markus Unterwaditzer | 84f39ff | 2015-05-17 17:58:09 +0200 | [diff] [blame] | 26 | Application logic is for the controller, but don't make the template designer's |
| 27 | life difficult by restricting functionality too much. |
Armin Ronacher | f55b1a4 | 2010-10-17 15:58:08 +0200 | [diff] [blame] | 28 | |
Jeff Widman | cdad3e6 | 2015-05-16 22:51:49 -0700 | [diff] [blame] | 29 | For more information visit the new `Jinja2 webpage`_ and `documentation`_. |
Armin Ronacher | f55b1a4 | 2010-10-17 15:58:08 +0200 | [diff] [blame] | 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 |
Markus Unterwaditzer | 0349f9b | 2015-03-22 14:31:39 +0100 | [diff] [blame] | 39 | |
| 40 | Builds |
| 41 | ------ |
| 42 | |
| 43 | +---------------------+------------------------------------------------------------------------------+ |
José Carlos García | c5a860c | 2016-04-04 01:21:39 +0200 | [diff] [blame] | 44 | | ``master`` | .. image:: https://travis-ci.org/pallets/jinja.svg?branch=master | |
| 45 | | | :target: https://travis-ci.org/pallets/jinja | |
Markus Unterwaditzer | 0349f9b | 2015-03-22 14:31:39 +0100 | [diff] [blame] | 46 | +---------------------+------------------------------------------------------------------------------+ |
José Carlos García | c5a860c | 2016-04-04 01:21:39 +0200 | [diff] [blame] | 47 | | ``2.7-maintenance`` | .. image:: https://travis-ci.org/pallets/jinja.svg?branch=2.7-maintenance | |
| 48 | | | :target: https://travis-ci.org/pallets/jinja | |
Markus Unterwaditzer | 0349f9b | 2015-03-22 14:31:39 +0100 | [diff] [blame] | 49 | +---------------------+------------------------------------------------------------------------------+ |