Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 140 lines (117 sloc) 4.143 kb
de478f6 @mitsuhiko [svn] some small updates to make jinja performing better
authored
1 # -*- coding: utf-8 -*-
5829306 @mitsuhiko moved docstring into setup.py, this fixes #297
authored
2 """
3 jinja
4 ~~~~~
5
6 Jinja is a `sandboxed`_ template engine written in pure Python. It
7 provides a `Django`_ like non-XML syntax and compiles templates into
8 executable python code. It's basically a combination of Django templates
9 and python code.
10
11 Nutshell
12 --------
13
14 Here a small example of a Jinja template::
15
16 {% extends 'base.html' %}
17 {% block title %}Memberlist{% endblock %}
18 {% block content %}
19 <ul>
20 {% for user in users %}
21 <li><a href="{{ user.url|e }}">{{ user.username|e }}</a></li>
22 {% endfor %}
23 </ul>
24 {% endblock %}
25
26 Philosophy
27 ----------
28
29 Application logic is for the controller but don't try to make the life
30 for the template designer too hard by giving him too few functionality.
31
32 For more informations visit the new `jinja webpage`_ and `documentation`_.
33
34 Note
35 ----
36
37 This is the Jinja 1.0 release which is completely incompatible with the
38 old "pre 1.0" branch. The old branch will still receive security updates
39 and bugfixes but the 1.0 branch will be the only version that receives
40 support.
41
42 If you have an application that uses Jinja 0.9 and won't be updated in
43 the near future the best idea is to ship a Jinja 0.9 checkout together
44 with the application.
45
46 The `Jinja tip`_ is installable via `easy_install` with ``easy_install
47 Jinja==dev``.
48
49 .. _sandboxed: http://en.wikipedia.org/wiki/Sandbox_(computer_security)
50 .. _Django: http://www.djangoproject.com/
51 .. _jinja webpage: http://jinja.pocoo.org/
52 .. _documentation: http://jinja.pocoo.org/documentation/index.html
53 .. _Jinja tip: http://dev.pocoo.org/hg/jinja-main/archive/tip.tar.gz#egg=Jinja-dev
54 """
0830e25 @mitsuhiko [svn] moved www out of jinja trunk and updated setup.py file
authored
55 import os
d15a4dc @mitsuhiko [svn] updated Jinja setup.py for (hopefully for) win32 compatibility
authored
56 import sys
0830e25 @mitsuhiko [svn] moved www out of jinja trunk and updated setup.py file
authored
57 import ez_setup
58 ez_setup.use_setuptools()
ee2c18e @mitsuhiko [svn] added c implementation of the jinja context class.
authored
59
bd33f11 @mitsuhiko added C escape and tb_set_next functions
authored
60 from setuptools import setup, Extension, Feature
61 from distutils.command.build_ext import build_ext
62 from distutils.errors import CCompilerError, DistutilsPlatformError
de478f6 @mitsuhiko [svn] some small updates to make jinja performing better
authored
63
0830e25 @mitsuhiko [svn] moved www out of jinja trunk and updated setup.py file
authored
64
e21ced2 @mitsuhiko [svn] again jinja setup.py update. works now
authored
65 def list_files(path):
66 for fn in os.listdir(path):
67 if fn.startswith('.'):
68 continue
69 fn = os.path.join(path, fn)
70 if os.path.isfile(fn):
71 yield fn
72
73
bd33f11 @mitsuhiko added C escape and tb_set_next functions
authored
74 class optional_build_ext(build_ext):
75 """This class allows C extension building to fail."""
76
77 def run(self):
78 try:
79 build_ext.run(self)
80 except DistutilsPlatformError:
81 self._unavailable()
82
83 def build_extension(self, ext):
84 try:
85 build_ext.build_extension(self, ext)
86 except CCompilerError, x:
87 self._unavailable()
88
89 def _unavailable(self):
90 print '*' * 70
91 print """WARNING:
92 An optional C extension could not be compiled, speedups will not be
93 available."""
94 print '*' * 70
95
96
de478f6 @mitsuhiko [svn] some small updates to make jinja performing better
authored
97 setup(
4a3038d @mitsuhiko update setup.py so that setup.py develop works
authored
98 name='Jinja 2',
99 version='2.0dev',
015b0c9 @mitsuhiko some documentation changes
authored
100 url='http://jinja.pocoo.org/',
101 license='BSD',
102 author='Armin Ronacher',
103 author_email='armin.ronacher@active-4.com',
104 description='A small but fast and easy to use stand-alone template '
105 'engine written in pure python.',
bd33f11 @mitsuhiko added C escape and tb_set_next functions
authored
106 long_description=__doc__,
e21ced2 @mitsuhiko [svn] again jinja setup.py update. works now
authored
107 # jinja is egg safe. But because we distribute the documentation
108 # in form of html and txt files it's a better idea to extract the files
015b0c9 @mitsuhiko some documentation changes
authored
109 zip_safe=False,
110 classifiers=[
f59bac2 @mitsuhiko added first code for parser extensions and moved some code in speedups a...
authored
111 'Development Status :: 4 Beta',
de478f6 @mitsuhiko [svn] some small updates to make jinja performing better
authored
112 'Environment :: Web Environment',
113 'Intended Audience :: Developers',
114 'License :: OSI Approved :: BSD License',
115 'Operating System :: OS Independent',
116 'Programming Language :: Python',
8ebf1f9 @mitsuhiko [svn] doc update, setup.py update, added turbogears plugin
authored
117 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
118 'Topic :: Software Development :: Libraries :: Python Modules',
119 'Topic :: Text Processing :: Markup :: HTML'
120 ],
4a3038d @mitsuhiko update setup.py so that setup.py develop works
authored
121 packages=['jinja2'],
015b0c9 @mitsuhiko some documentation changes
authored
122 data_files=[
99e5baa @mitsuhiko some more small release changes
authored
123 ('docs/html', list(list_files('docs/html'))),
72bb257 @mitsuhiko [svn] added doc notes to the installation instructions
authored
124 ('docs/txt', list(list_files('docs/src')))
0830e25 @mitsuhiko [svn] moved www out of jinja trunk and updated setup.py file
authored
125 ],
bd33f11 @mitsuhiko added C escape and tb_set_next functions
authored
126 features={
127 'speedups': Feature("optional C speed-enhancements",
128 standard=True,
129 ext_modules=[
130 Extension('jinja2._speedups', ['jinja2/_speedups.c'])
131 ]
132 )
133 },
2b60fe5 @mitsuhiko fixed setup.py, a type and removed the possibility to use multiple state...
authored
134 extras_require={'i18n': ['Babel>=0.8']},
f59bac2 @mitsuhiko added first code for parser extensions and moved some code in speedups a...
authored
135 entry_points="""
136 [babel.extractors]
137 jinja2 = jinja.i18n:babel_extract[i18n]
138 """
de478f6 @mitsuhiko [svn] some small updates to make jinja performing better
authored
139 )
Something went wrong with that request. Please try again.