Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 101 lines (79 sloc) 2.795 kb
de478f6 @mitsuhiko [svn] some small updates to make jinja performing better
authored
1 # -*- coding: utf-8 -*-
2 try:
3 import ez_setup
4 ez_setup.use_setuptools()
5 except ImportError:
6 pass
7 from setuptools import setup
8
9
10 setup(
11 name = 'Jinja',
12 version = '0.9',
13 url = 'http://wsgiarea.pocoo.org/jinja/',
14 license = 'BSD',
15 author = 'Armin Ronacher',
16 author_email = 'armin.ronacher@active-4.com',
17 description = 'A small but fast and easy to use stand-alone template engine written in pure python.',
18 long_description = '''\
19 Jinja is a small but very fast and easy to use stand-alone template engine
20 written in pure Python.
21
22 Since version 0.6 it uses a new parser that increases parsing performance
23 a lot by caching the nodelists on disk if wanted.
24
25 It includes multiple template inheritance and other features like simple
26 value escaping.
27
28
29 Template Syntax
30 ===============
31
32 This is a small example template in which you can see how Jinja's syntax
33 looks like::
34
35 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
36 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
37 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
38 <head>
39 <title>My Webpage</title>
40 </head
41 <body>
42 <ul id="navigation">
43 {% for item in navigation %}
44 <li><a href="{{ item.href }}">{{ item.caption|e }}</a></li>
45 {% endfor %}
46 </ul>
47
48 <h1>My Webpage</h1>
49 {{ variable }}
50 </body>
51 </html>
52
53
54 Usage
55 =====
56
57 Here is a small example::
58
59 from jinja import Template, Context, FileSystemLoader
60
61 t = Template('mytemplate', FileSystemLoader('/path/to/the/templates'))
62 c = Context({
63 'navigation' [
64 {'href': '#', 'caption': 'Index'},
65 {'href': '#', 'caption': 'Spam'}
66 ],
67 'variable': '<strong>hello world</strong>'
68 })
69 print t.render(c)
70
71
72 Unicode Support
73 ===============
74
75 Jinja comes with built-in Unicode support. As a matter of fact, the return
76 value of ``Template.render()`` will be a Python unicode object.
77
78 You can still output ``str`` objects as well when you encode the result::
79
80 s = t.render(c).encode('utf-8')
81
82 For more examples check out the `documentation`_ on the `jinja webpage`_.
83
84 .. _documentation: http://wsgiarea.pocoo.org/jinja/docs/
85 .. _jinja webpage: http://wsgiarea.pocoo.org/jinja/
86 ''',
87 keywords = 'wsgi web templateengine templates',
88 packages = ['jinja'],
89 platforms = 'any',
90 classifiers = [
91 'Development Status :: 5 - Production/Stable',
92 'Environment :: Web Environment',
93 'Intended Audience :: Developers',
94 'License :: OSI Approved :: BSD License',
95 'Operating System :: OS Independent',
96 'Programming Language :: Python',
97 'Topic :: Internet :: WWW/HTTP',
98 'Topic :: Internet :: WWW/HTTP :: Dynamic Content'
99 ]
100 )
Something went wrong with that request. Please try again.