Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
Armin Ronacher | 5829306 | 2008-02-11 15:36:22 +0100 | [diff] [blame] | 2 | """ |
Armin Ronacher | 203bfcb | 2008-04-24 21:54:44 +0200 | [diff] [blame] | 3 | Jinja2 |
| 4 | ~~~~~~ |
Armin Ronacher | 5829306 | 2008-02-11 15:36:22 +0100 | [diff] [blame] | 5 | |
Armin Ronacher | 203bfcb | 2008-04-24 21:54:44 +0200 | [diff] [blame] | 6 | Jinja2 is a template engine written in pure Python. It provides a |
| 7 | `Django`_ inspired non-XML syntax but supports inline expressions and |
| 8 | an optional `sandboxed`_ environment. |
Armin Ronacher | 5829306 | 2008-02-11 15:36:22 +0100 | [diff] [blame] | 9 | |
| 10 | Nutshell |
| 11 | -------- |
| 12 | |
| 13 | Here a small example of a Jinja template:: |
| 14 | |
| 15 | {% extends 'base.html' %} |
| 16 | {% block title %}Memberlist{% endblock %} |
| 17 | {% block content %} |
| 18 | <ul> |
| 19 | {% for user in users %} |
Armin Ronacher | 203bfcb | 2008-04-24 21:54:44 +0200 | [diff] [blame] | 20 | <li><a href="{{ user.url }}">{{ user.username }}</a></li> |
Armin Ronacher | 5829306 | 2008-02-11 15:36:22 +0100 | [diff] [blame] | 21 | {% endfor %} |
| 22 | </ul> |
| 23 | {% endblock %} |
| 24 | |
| 25 | Philosophy |
| 26 | ---------- |
| 27 | |
| 28 | Application logic is for the controller but don't try to make the life |
| 29 | for the template designer too hard by giving him too few functionality. |
| 30 | |
Armin Ronacher | f4e1fb4 | 2008-06-09 18:54:56 +0200 | [diff] [blame] | 31 | For more informations visit the new `Jinja2 webpage`_ and `documentation`_. |
Armin Ronacher | 5829306 | 2008-02-11 15:36:22 +0100 | [diff] [blame] | 32 | |
Armin Ronacher | 203bfcb | 2008-04-24 21:54:44 +0200 | [diff] [blame] | 33 | The `Jinja2 tip`_ is installable via `easy_install` with ``easy_install |
| 34 | Jinja2==dev``. |
Armin Ronacher | 5829306 | 2008-02-11 15:36:22 +0100 | [diff] [blame] | 35 | |
| 36 | .. _sandboxed: http://en.wikipedia.org/wiki/Sandbox_(computer_security) |
| 37 | .. _Django: http://www.djangoproject.com/ |
Armin Ronacher | f4e1fb4 | 2008-06-09 18:54:56 +0200 | [diff] [blame] | 38 | .. _Jinja2 webpage: http://jinja.pocoo.org/ |
Armin Ronacher | 1a12c8a | 2008-06-09 18:49:14 +0200 | [diff] [blame] | 39 | .. _documentation: http://jinja.pocoo.org/2/documentation/ |
| 40 | .. _Jinja2 tip: http://dev.pocoo.org/hg/jinja2-main/archive/tip.tar.gz#egg=Jinja2-dev |
Armin Ronacher | 5829306 | 2008-02-11 15:36:22 +0100 | [diff] [blame] | 41 | """ |
Armin Ronacher | 0830e25 | 2007-03-22 23:45:30 +0100 | [diff] [blame] | 42 | import os |
Armin Ronacher | d15a4dc | 2007-05-28 18:16:16 +0200 | [diff] [blame] | 43 | import sys |
Armin Ronacher | ee2c18e | 2007-04-20 22:39:04 +0200 | [diff] [blame] | 44 | |
Armin Ronacher | f9f5f26 | 2010-08-17 11:57:07 +0200 | [diff] [blame] | 45 | from setuptools import setup |
Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 46 | |
Armin Ronacher | 0faa861 | 2010-02-09 15:04:51 +0100 | [diff] [blame] | 47 | # tell distribute to use 2to3 with our own fixers. |
| 48 | extra = {} |
| 49 | if sys.version_info >= (3, 0): |
| 50 | extra.update( |
| 51 | use_2to3=True, |
| 52 | use_2to3_fixers=['custom_fixers'] |
| 53 | ) |
Armin Ronacher | 0319c66 | 2010-02-09 02:09:10 +0100 | [diff] [blame] | 54 | |
Armin Ronacher | 0830e25 | 2007-03-22 23:45:30 +0100 | [diff] [blame] | 55 | |
Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 56 | setup( |
Armin Ronacher | 203bfcb | 2008-04-24 21:54:44 +0200 | [diff] [blame] | 57 | name='Jinja2', |
Armin Ronacher | 4f77a30 | 2010-07-01 12:15:39 +0200 | [diff] [blame] | 58 | version='2.5.1', |
Armin Ronacher | 015b0c9 | 2007-11-11 00:10:17 +0100 | [diff] [blame] | 59 | url='http://jinja.pocoo.org/', |
| 60 | license='BSD', |
| 61 | author='Armin Ronacher', |
| 62 | author_email='armin.ronacher@active-4.com', |
| 63 | description='A small but fast and easy to use stand-alone template ' |
| 64 | 'engine written in pure python.', |
Armin Ronacher | bd33f11 | 2008-04-18 09:17:32 +0200 | [diff] [blame] | 65 | long_description=__doc__, |
Armin Ronacher | 86b5cb5 | 2009-09-13 00:23:27 -0700 | [diff] [blame] | 66 | # jinja is egg safe. But we hate eggs |
Armin Ronacher | 015b0c9 | 2007-11-11 00:10:17 +0100 | [diff] [blame] | 67 | zip_safe=False, |
| 68 | classifiers=[ |
Armin Ronacher | a9d5922 | 2008-07-18 00:41:37 +0200 | [diff] [blame] | 69 | 'Development Status :: 5 - Production/Stable', |
Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 70 | 'Environment :: Web Environment', |
| 71 | 'Intended Audience :: Developers', |
| 72 | 'License :: OSI Approved :: BSD License', |
| 73 | 'Operating System :: OS Independent', |
| 74 | 'Programming Language :: Python', |
Armin Ronacher | d9599c8 | 2010-02-10 02:19:17 +0100 | [diff] [blame] | 75 | 'Programming Language :: Python :: 3', |
Armin Ronacher | 8ebf1f9 | 2007-03-03 11:22:18 +0100 | [diff] [blame] | 76 | 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', |
| 77 | 'Topic :: Software Development :: Libraries :: Python Modules', |
| 78 | 'Topic :: Text Processing :: Markup :: HTML' |
| 79 | ], |
Armin Ronacher | f9f5f26 | 2010-08-17 11:57:07 +0200 | [diff] [blame] | 80 | packages=['jinja2', 'jinja2.testsuite', 'jinja2.testsuite.res', |
| 81 | 'jinja2._markupsafe'], |
Armin Ronacher | 2b60fe5 | 2008-04-21 08:23:59 +0200 | [diff] [blame] | 82 | extras_require={'i18n': ['Babel>=0.8']}, |
Armin Ronacher | 7af781c | 2010-02-09 16:05:08 +0100 | [diff] [blame] | 83 | test_suite='jinja2.testsuite.suite', |
Armin Ronacher | 790b8a8 | 2010-02-10 00:05:46 +0100 | [diff] [blame] | 84 | include_package_data=True, |
Armin Ronacher | f59bac2 | 2008-04-20 13:11:43 +0200 | [diff] [blame] | 85 | entry_points=""" |
| 86 | [babel.extractors] |
Armin Ronacher | 7962ce7 | 2008-05-20 17:52:52 +0200 | [diff] [blame] | 87 | jinja2 = jinja2.ext:babel_extract[i18n] |
Armin Ronacher | 0319c66 | 2010-02-09 02:09:10 +0100 | [diff] [blame] | 88 | """, |
Armin Ronacher | 0faa861 | 2010-02-09 15:04:51 +0100 | [diff] [blame] | 89 | **extra |
Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 90 | ) |