Skip to content
Myr

Merge branch '2.9.x' into docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parents 5b2b7ca, 908726c · Browse files · 33 files+563 added−1578 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

33 files+563 added−1578 removed

  • other:+563 added−1578 removed

33 files+563 added−1578 removed

deleted:docs/_build/.ignore
deleted:docs/_static/.ignore
added:docs/_static/jinja-logo-sidebar.pngbinary

A binary file, added.

added:docs/_static/jinja-logo.pngbinary

A binary file, added.

deleted:docs/_static/jinja-small.pngbinary

A binary file, deleted.

deleted:docs/_templates/sidebarintro.html-20 removed
deleted:docs/_templates/sidebarlogo.html-3 removed
deleted:docs/_themes/jinja/static/jinja.css_t-396 removed
1/*2 * jinja.css_t3 * ~~~~~~~~~~~4 *5 * :copyright: Copyright 2011 by Armin Ronacher.6 * :license: Flask Design License, see LICENSE for details.7 */89@import url(http://fonts.googleapis.com/css?family=Crimson+Text);1011{% set page_width = '940px' %}12{% set sidebar_width = '220px' %}13{% set font_family = 'Georgia, serif' %}14{% set header_font_family = 'Crimson Text, ' ~ font_family %}15 16@import url("basic.css");17 18/* -- page layout ----------------------------------------------------------- */19 20body {21 font-family: {{ font_family }};22 font-size: 17px;23 background-color: white;24 color: #000;25 margin: 0;26 padding: 0;27}2829div.document {30 width: {{ page_width }};31 margin: 30px auto 0 auto;32}3334div.documentwrapper {35 float: left;36 width: 100%;37}3839div.bodywrapper {40 margin: 0 0 0 {{ sidebar_width }};41}4243div.sphinxsidebar {44 width: {{ sidebar_width }};45}4647hr {48 border: 1px solid #B1B4B6;49}50 51div.body {52 background-color: #ffffff;53 color: #3E4349;54 padding: 0 30px 0 30px;55}5657img.floatingflask {58 padding: 0 0 10px 10px;59 float: right;60}61 62div.footer {63 width: {{ page_width }};64 margin: 20px auto 30px auto;65 font-size: 14px;66 color: #888;67 text-align: right;68}6970div.footer a {71 color: #888;72}7374div.related {75 display: none;76}77 78div.sphinxsidebar a {79 color: #444;80 text-decoration: none;81 border-bottom: 1px dotted #999;82}8384div.sphinxsidebar a:hover {85 border-bottom: 1px solid #999;86}87 88div.sphinxsidebar {89 font-size: 15px;90 line-height: 1.5;91}9293div.sphinxsidebarwrapper {94 padding: 18px 10px;95}9697div.sphinxsidebarwrapper p.logo {98 padding: 0 0 20px 0;99 margin: 0;100 text-align: center;101}102 103div.sphinxsidebar h3,104div.sphinxsidebar h4 {105 font-family: {{ font_family }};106 color: #444;107 font-size: 24px;108 font-weight: normal;109 margin: 0 0 5px 0;110 padding: 0;111}112113div.sphinxsidebar h4 {114 font-size: 20px;115}116 117div.sphinxsidebar h3 a {118 color: #444;119}120121div.sphinxsidebar p.logo a,122div.sphinxsidebar h3 a,123div.sphinxsidebar p.logo a:hover,124div.sphinxsidebar h3 a:hover {125 border: none;126}127 128div.sphinxsidebar p {129 color: #555;130 margin: 10px 0;131}132133div.sphinxsidebar ul {134 margin: 10px 0;135 padding: 0;136 color: #000;137}138 139div.sphinxsidebar input {140 border: 1px solid #ccc;141 font-family: {{ font_family }};142 font-size: 14px;143}144145div.sphinxsidebar form.search input[name="q"] {146 width: 130px;147}148 149/* -- body styles ----------------------------------------------------------- */150 151a {152 color: #aa0000;153 text-decoration: underline;154}155 156a:hover {157 color: #dd0000;158 text-decoration: underline;159}160 161div.body h1,162div.body h2,163div.body h3,164div.body h4,165div.body h5,166div.body h6 {167 font-family: {{ header_font_family }};168 font-weight: normal;169 margin: 30px 0px 10px 0px;170 padding: 0;171 color: black;172}173 174div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }175div.body h2 { font-size: 180%; }176div.body h3 { font-size: 150%; }177div.body h4 { font-size: 130%; }178div.body h5 { font-size: 100%; }179div.body h6 { font-size: 100%; }180 181a.headerlink {182 color: #ddd;183 padding: 0 4px;184 text-decoration: none;185}186 187a.headerlink:hover {188 color: #444;189 background: #eaeaea;190}191 192div.body p, div.body dd, div.body li {193 line-height: 1.4em;194}195196div.admonition {197 background: #fafafa;198 margin: 20px -30px;199 padding: 10px 30px;200 border-top: 1px solid #ccc;201 border-bottom: 1px solid #ccc;202}203204div.admonition tt.xref, div.admonition a tt {205 border-bottom: 1px solid #fafafa;206}207208dd div.admonition {209 margin-left: -60px;210 padding-left: 60px;211}212213div.admonition p.admonition-title {214 font-family: {{ font_family }};215 font-weight: normal;216 font-size: 24px;217 margin: 0 0 10px 0;218 padding: 0;219 line-height: 1;220}221222div.admonition p.last {223 margin-bottom: 0;224}225226div.highlight {227 background-color: white;228}229230dt:target, .highlight {231 background: #FAF3E8;232}233234div.note {235 background-color: #eee;236 border: 1px solid #ccc;237}238 239div.seealso {240 background-color: #ffc;241 border: 1px solid #ff6;242}243 244div.topic {245 background-color: #eee;246}247 248p.admonition-title {249 display: inline;250}251 252p.admonition-title:after {253 content: ":";254}255256pre, tt {257 font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;258 font-size: 0.85em;259}260261img.screenshot {262}263264tt.descname, tt.descclassname {265 font-size: 0.95em;266}267268tt.descname {269 padding-right: 0.08em;270}271272img.screenshot {273 -moz-box-shadow: 2px 2px 4px #eee;274 -webkit-box-shadow: 2px 2px 4px #eee;275 box-shadow: 2px 2px 4px #eee;276}277278table.docutils {279 border: 1px solid #888;280 -moz-box-shadow: 2px 2px 4px #eee;281 -webkit-box-shadow: 2px 2px 4px #eee;282 box-shadow: 2px 2px 4px #eee;283}284285table.docutils td, table.docutils th {286 border: 1px solid #888;287 padding: 0.25em 0.7em;288}289290table.field-list, table.footnote {291 border: none;292 -moz-box-shadow: none;293 -webkit-box-shadow: none;294 box-shadow: none;295}296297table.footnote {298 margin: 15px 0;299 width: 100%;300 border: 1px solid #eee;301 background: #fdfdfd;302 font-size: 0.9em;303}304305table.footnote + table.footnote {306 margin-top: -15px;307 border-top: none;308}309310table.field-list th {311 padding: 0 0.8em 0 0;312}313314table.field-list td {315 padding: 0;316}317318table.footnote td.label {319 width: 0px;320 padding: 0.3em 0 0.3em 0.5em;321}322323table.footnote td {324 padding: 0.3em 0.5em;325}326327dl {328 margin: 0;329 padding: 0;330}331332dl dd {333 margin-left: 30px;334}335336blockquote {337 margin: 0 0 0 30px;338 padding: 0;339}340341ul, ol {342 margin: 10px 0 10px 30px;343 padding: 0;344}345 346pre {347 background: #eee;348 padding: 7px 30px;349 margin: 15px -30px;350 line-height: 1.3em;351}352353dl pre, blockquote pre, li pre {354 margin-left: -60px;355 padding-left: 60px;356}357358dl dl pre {359 margin-left: -90px;360 padding-left: 90px;361}362 363tt {364 background-color: #E8EFF0;365 color: #222;366 /* padding: 1px 2px; */367}368369tt.xref, a tt {370 background-color: #E8EFF0;371 border-bottom: 1px solid white;372}373374a.reference {375 text-decoration: none;376 border-bottom: 1px dotted #bb0000;377}378379a.reference:hover {380 border-bottom: 1px solid #dd0000;381}382383a.footnote-reference {384 text-decoration: none;385 font-size: 0.7em;386 vertical-align: top;387 border-bottom: 1px dotted #bb0000;388}389390a.footnote-reference:hover {391 border-bottom: 1px solid #dd0000;392}393394a:hover tt {395 background: #EEE;396}
deleted:docs/_themes/jinja/layout.html-8 removed
deleted:docs/_themes/jinja/relations.html-19 removed
deleted:docs/_themes/jinja/theme.conf-3 removed
1[theme]2inherit = basic3stylesheet = jinja.css
deleted:docs/_themes/LICENSE-37 removed
1Copyright (c) 2010 by Armin Ronacher.23Some rights reserved.45Redistribution and use in source and binary forms of the theme, with or6without modification, are permitted provided that the following conditions7are met:89* Redistributions of source code must retain the above copyright10 notice, this list of conditions and the following disclaimer.1112* Redistributions in binary form must reproduce the above13 copyright notice, this list of conditions and the following14 disclaimer in the documentation and/or other materials provided15 with the distribution.1617* The names of the contributors may not be used to endorse or18 promote products derived from this software without specific19 prior written permission.2021We kindly ask you to only use these themes in an unmodified manner just22for Flask and Flask-related products, not for unrelated projects. If you23like the visual style and want to use it for your own projects, please24consider making some larger changes to the themes (such as changing25font faces, sizes, colors or margins).2627THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"28AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE29IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE30ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE31LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR32CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF33SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS34INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN35CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)36ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE37POSSIBILITY OF SUCH DAMAGE.
deleted:docs/_themes/README-31 removed
1Flask Sphinx Styles2===================34This repository contains sphinx styles for Flask and Flask related5projects. To use this style in your Sphinx documentation, follow6this guide:781. put this folder as _themes into your docs folder. Alternatively9 you can also use git submodules to check out the contents there.102. add this to your conf.py:1112 sys.path.append(os.path.abspath('_themes'))13 html_theme_path = ['_themes']14 html_theme = 'flask'1516The following themes exist:1718- 'flask' - the standard flask documentation theme for large19 projects20- 'flask_small' - small one-page theme. Intended to be used by21 very small addon libraries for flask.2223The following options exist for the flask_small theme:2425 [options]26 index_logo = '' filename of a picture in _static27 to be used as replacement for the28 h1 in the index.rst file.29 index_logo_height = 120px height of the index logo30 github_fork = '' repository name on github for the31 "fork me" badge
modified:docs/api.rst+4 added-4 removed
17 unmodified lines
18:class:`Template` class, an environment is created automatically for you,19albeit a shared one.2021Most applications will create one :class:`Environment` object on application22initialization and use that to load templates. In some cases however, it's 22initialization and use that to load templates. In some cases however, it's23useful to have multiple environments side by side, if different configurations24are in use.2526The simplest way to configure Jinja2 to load templates for your application
86 unmodified lines
113>>> m.b114u'f\xf6\xf6'115116117.. _Unicode documentation: https://docs.python.org/dev/howto/unicode.html117.. _Unicode documentation: https://docs.python.org/3/howto/unicode.html118119High Level API120--------------121
90 unmodified lines
212213 For a more complex example you can provide a hint. For example214 the :func:`first` filter creates an undefined object that way::215216 return environment.undefined('no first item, sequence was empty') 216 return environment.undefined('no first item, sequence was empty')217218 If it the `name` or `obj` is known (for example because an attribute219 was accessed) it should be passed to the undefined object, even if220 a custom `hint` is provided. This gives undefined objects the
616 unmodified lines
837 for i in range(2, int(math.ceil(math.sqrt(n))) + 1):838 if n % i == 0:839 return False840 return True841 841842843You can register it on the template environment by updating the844:attr:`~Environment.tests` dict on the environment::845846 environment.tests['prime'] = is_prime
86 unmodified lines
modified:docs/cache_extension.py+1 added-1 removed
2 unmodified lines
345class FragmentCacheExtension(Extension):6 # a set of names that trigger the extension.7 tags = set(['cache'])7 tags = {'cache'}89 def __init__(self, environment):10 super(FragmentCacheExtension, self).__init__(environment)11
45 unmodified lines
modified:docs/changelog.rst+2 added-1 removed
1.. module:: jinja21Changelog2=========34.. include:: ../CHANGES.rst
modified:docs/conf.py+42 added-150 removed
1# -*- coding: utf-8 -*-2#3# Jinja2 documentation build configuration file, created by4# sphinx-quickstart on Sun Apr 27 21:42:41 2008.5#6# This file is execfile()d with the current directory set to its containing dir.7#8# The contents of this file are pickled, so don't put values in the namespace9# that aren't pickleable (module imports are okay, they're removed automatically).10#11# All configuration values have a default value; values that are commented out12# serve to show the default value.1from pallets_sphinx_themes import get_version2from pallets_sphinx_themes import ProjectLink314import sys, os4# Project --------------------------------------------------------------516# If your extensions are in another directory, add it here. If the directory17# is relative to the documentation root, use os.path.abspath to make it18# absolute, like shown here.19sys.path.append(os.path.dirname(os.path.abspath(__file__)))6project = "Jinja"7copyright = "2007 Pallets"8author = "Pallets"9release, version = get_version("Jinja2")1021# General configuration22# ---------------------11# General --------------------------------------------------------------1224# Add any Sphinx extension module names here, as strings. They can be extensions25# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.26extensions = ['sphinx.ext.autodoc', 'jinjaext']2728# Add any paths that contain templates here, relative to this directory.29templates_path = ['_templates']3031# The suffix of source filenames.32source_suffix = '.rst'3334# The master toctree document.35master_doc = 'index'3637# General substitutions.38project = 'Jinja2'39copyright = '2008, Armin Ronacher'4041# The default replacements for |version| and |release|, also used in various42# other places throughout the built documents.43#44# The short X.Y version.45import pkg_resources46try:47 release = pkg_resources.get_distribution('Jinja2').version48except ImportError:49 print('To build the documentation, The distribution information of Jinja2')50 print('Has to be available. Either install the package into your')51 print('development environment or run "setup.py develop" to setup the')52 print('metadata. A virtualenv is recommended!')53 sys.exit(1)54if 'dev' in release:55 release = release.split('dev')[0] + 'dev'56version = '.'.join(release.split('.')[:2])5758# There are two options for replacing |today|: either, you set today to some59# non-false value, then it is used:60#today = ''61# Else, today_fmt is used as the format for a strftime call.62today_fmt = '%B %d, %Y'6364# List of documents that shouldn't be included in the build.65#unused_docs = []6667# If true, '()' will be appended to :func: etc. cross-reference text.68#add_function_parentheses = True6970# If true, the current module name will be prepended to all description71# unit titles (such as .. function::).72#add_module_names = True7374# If true, sectionauthor and moduleauthor directives will be shown in the75# output. They are ignored by default.76#show_authors = False7778# The name of the Pygments (syntax highlighting) style to use.79pygments_style = 'jinjaext.JinjaStyle'808182# Options for HTML output83# -----------------------8485html_theme = 'jinja'86html_theme_path = ['_themes']8788# The name for this set of Sphinx documents. If None, it defaults to89# "<project> v<release> documentation".90#html_title = None9192# Add any paths that contain custom static files (such as style sheets) here,93# relative to this directory. They are copied after the builtin static files,94# so a file named "default.css" will overwrite the builtin "default.css".95html_static_path = ['_static']9697# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,98# using the given strftime format.99html_last_updated_fmt = '%b %d, %Y'100101# If true, SmartyPants will be used to convert quotes and dashes to102# typographically correct entities.103#html_use_smartypants = True104105# no modindex106html_use_modindex = False107108# If true, the reST sources are included in the HTML build as _sources/<name>.109#html_copy_source = True110111# If true, an OpenSearch description file will be output, and all pages will112# contain a <link> tag referring to it.113#html_use_opensearch = False114115# Output file base name for HTML help builder.116htmlhelp_basename = 'Jinja2doc'117118119# Options for LaTeX output120# ------------------------121122# The paper size ('letter' or 'a4').123latex_paper_size = 'a4'124125# The font size ('10pt', '11pt' or '12pt').126#latex_font_size = '10pt'127128# Grouping the document tree into LaTeX files. List of tuples129# (source start file, target name, title, author, document class [howto/manual]).130latex_documents = [131 ('latexindex', 'Jinja2.tex', 'Jinja2 Documentation', 'Armin Ronacher',132 'manual'),13master_doc = "index"14extensions = [15 "sphinx.ext.autodoc",16 "sphinx.ext.intersphinx",17 "pallets_sphinx_themes",18 "sphinxcontrib.log_cabinet",19 "sphinx_issues",20]21intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)}22issues_github_path = "pallets/jinja"23135# Additional stuff for LaTeX136latex_elements = {137 'fontpkg': r'\usepackage{mathpazo}',138 'papersize': 'a4paper',139 'pointsize': '12pt',140 'preamble': r'''141\usepackage{jinjastyle}24# HTML -----------------------------------------------------------------25143% i hate you latex144\DeclareUnicodeCharacter{14D}{o}145'''26html_theme = "jinja"27html_theme_options = {"index_sidebar_logo": False}28html_context = {29 "project_links": [30 ProjectLink("Donate to Pallets", "https://palletsprojects.com/donate"),31 ProjectLink("Jinja Website", "https://palletsprojects.com/p/jinja/"),32 ProjectLink("PyPI releases", "https://pypi.org/project/Jinja2/"),33 ProjectLink("Source Code", "https://github.com/pallets/jinja/"),34 ProjectLink("Issue Tracker", "https://github.com/pallets/jinja/issues/"),35 ]36}147148latex_use_parts = True149150latex_additional_files = ['jinjastyle.sty', 'logo.pdf']151152# If false, no module index is generated.153latex_use_modindex = False15437html_sidebars = {156 'index': ['sidebarlogo.html', 'sidebarintro.html', 'sourcelink.html',157 'searchbox.html'],158 '**': ['sidebarlogo.html', 'localtoc.html', 'relations.html',159 'sourcelink.html', 'searchbox.html']38 "index": ["project.html", "localtoc.html", "searchbox.html"],39 "**": ["localtoc.html", "relations.html", "searchbox.html"],40}41singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}42html_static_path = ["_static"]43html_favicon = "_static/jinja-logo-sidebar.png"44html_logo = "_static/jinja-logo-sidebar.png"45html_title = "Jinja Documentation ({})".format(version)46html_show_sourcelink = False4748# LaTeX ----------------------------------------------------------------4950latex_documents = [51 (master_doc, "Jinja-{}.tex".format(version), html_title, author, "manual")52]
deleted:docs/contents.rst.inc-24 removed
1Jinja2 Documentation2--------------------34.. toctree::5 :maxdepth: 267 intro8 api9 sandbox10 nativetypes11 templates12 extensions13 integration14 switching15 tricks1617Additional Information18----------------------1920.. toctree::21 :maxdepth: 22223 faq24 changelog
modified:docs/extensions.rst+5 added-5 removed
104 unmodified lines
105106The usage of the `i18n` extension for template designers is covered as part107:ref:`of the template documentation <i18n-in-templates>`.108109.. _gettext: https://docs.python.org/dev/library/gettext109.. _gettext: https://docs.python.org/3/library/gettext.html110.. _Babel: http://babel.pocoo.org/111112.. _newstyle-gettext:113
117 unmodified lines
231Example Extension232~~~~~~~~~~~~~~~~~233234The following example implements a `cache` tag for Jinja2 by using the235`Werkzeug`_ caching contrib module:235`cachelib`_ library:236237.. literalinclude:: cache_extension.py238 :language: python239240And here is how you use it in an environment::241242 from jinja2 import Environment243 from werkzeug.contrib.cache import SimpleCache243 from cachelib import SimpleCache244245 env = Environment(extensions=[FragmentCacheExtension])246 env.fragment_cache = SimpleCache()247
7 unmodified lines
255 ...256 </div>257 {% endcache %}258259.. _Werkzeug: http://werkzeug.pocoo.org/259.. _cachelib: https://github.com/pallets/cachelib260261Extension API262~~~~~~~~~~~~~263
80 unmodified lines
344For more information have a look at the repr of :meth:`jinja2.Environment.parse`.345346.. module:: jinja2.nodes347348.. jinjanodes::348.. jinja:nodes:: jinja2.nodes.Node349350.. autoexception:: Impossible
modified:docs/faq.rst+2 added-1 removed
24 unmodified lines
25speaking the performance of a template engine doesn't matter much as the26usual bottleneck in a web application is either the database or the application27code.2829.. _Mako: http://www.makotemplates.org/29.. _Mako: https://www.makotemplates.org/3031How Compatible is Jinja2 with Django?32-------------------------------------33
153 unmodified lines
187templates passing information to the parent template. To avoid this188issue rename the macro or variable in the parent template to have an189uncommon prefix.190191.. _Jinja 1: https://pypi.org/project/Jinja/
modified:docs/index.rst+24 added-7 removed
1Welcome to Jinja22=================1.. rst-class:: hide-header23Jinja4=====56.. image:: _static/jinja-logo.png7 :align: center8 :target: https://palletsprojects.com/p/jinja/94Jinja2 is a modern and designer-friendly templating language for Python,10Jinja is a modern and designer-friendly templating language for Python,11modelled after Django's templates. It is fast, widely used and secure12with the optional sandboxed template execution environment:1314.. sourcecode:: html+jinja
4 unmodified lines
19 <li><a href="{{ user.url }}">{{ user.username }}</a></li>20 {% endfor %}21 </ul>2217**Features:**23Features:2425- sandboxed execution26- powerful automatic HTML escaping system for XSS prevention27- template inheritance
2 unmodified lines
30- easy to debug. Line numbers of exceptions directly point to31 the correct line in the template.32- configurable syntax3328.. include:: contents.rst.inc34.. toctree::35 :maxdepth: 236 :caption: Contents:3730If you can't find the information you're looking for, have a look at the31index or try to find it using the search function:38 intro39 api40 sandbox41 nativetypes42 templates43 extensions44 integration45 switching46 tricks47 faq48 changelog4950* :ref:`genindex`51* :ref:`search`
modified:docs/integration.rst+3 added-3 removed
74 unmodified lines
75snippet and add it into your `config/environment.py`::7677 config['pylons.strict_c'] = True7879.. _Pylons: http://www.pylonshq.com/79.. _Pylons: https://pylonshq.com/8081TextMate82--------83
6 unmodified lines
90---9192A syntax plugin for `Vim`_ exists in the Vim-scripts directory as well as the93`ext` folder at the root of the Jinja2 project. `The script94<http://www.vim.org/scripts/script.php?script_id=1856>`_ supports Jinja1 and94<https://www.vim.org/scripts/script.php?script_id=1856>`_ supports Jinja1 and95Jinja2. Once installed two file types are available `jinja` and `htmljinja`.96The first one for text based templates, the latter for HTML templates.9798Copy the files into your `syntax` folder.99100.. _Babel: http://babel.pocoo.org/101.. _Vim: http://www.vim.org/101.. _Vim: https://www.vim.org/
modified:docs/intro.rst+7 added-7 removed
58 unmodified lines
59As an alternative to steps 4 you can also do ``python setup.py develop``60which will install the package via `distribute` in development mode. This also61has the advantage that the C extensions are compiled.6263.. _download page: https://pypi.python.org/pypi/Jinja264.. _distribute: https://pypi.python.org/pypi/distribute 65.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools66.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall67.. _pip: https://pypi.python.org/pypi/pip68.. _git: https://git-scm.org/63.. _download page: https://pypi.org/project/Jinja2/64.. _distribute: https://pypi.org/project/distribute/65.. _setuptools: https://pypi.org/project/setuptools/66.. _easy_install: https://setuptools.readthedocs.io/en/latest/easy_install.html67.. _pip: https://pypi.org/project/pip/68.. _git: https://git-scm.com/697071MarkupSafe Dependency72~~~~~~~~~~~~~~~~~~~~~
1 unmodified line
74As of version 2.7 Jinja2 depends on the `MarkupSafe`_ module. If you75install Jinja2 via `pip` or `easy_install` it will be installed76automatically for you.7778.. _MarkupSafe: https://pypi.python.org/pypi/MarkupSafe78.. _MarkupSafe: https://markupsafe.palletsprojects.com/7980Basic API Usage81---------------82
38 unmodified lines
deleted:docs/jinjaext.py-206 removed
1# -*- coding: utf-8 -*-2"""3 Jinja Documentation Extensions4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~56 Support for automatically documenting filters and tests.78 :copyright: Copyright 2008 by Armin Ronacher.9 :license: BSD.10"""11import os12import re13import inspect1415import logging1617import jinja218from itertools import islice19from types import BuiltinFunctionType20from docutils import nodes21from docutils.statemachine import ViewList22from sphinx.ext.autodoc import prepare_docstring23from sphinx.application import TemplateBridge24from pygments.style import Style25from pygments.token import Keyword, Name, Comment, String, Error, \26 Number, Operator, Generic27from jinja2 import Environment, FileSystemLoader28from jinja2._compat import abc293031def parse_rst(state, content_offset, doc):32 node = nodes.section()33 # hack around title style bookkeeping34 surrounding_title_styles = state.memo.title_styles35 surrounding_section_level = state.memo.section_level36 state.memo.title_styles = []37 state.memo.section_level = 038 state.nested_parse(doc, content_offset, node, match_titles=1)39 state.memo.title_styles = surrounding_title_styles40 state.memo.section_level = surrounding_section_level41 return node.children424344class JinjaStyle(Style):45 title = 'Jinja Style'46 default_style = ""47 styles = {48 Comment: 'italic #aaaaaa',49 Comment.Preproc: 'noitalic #B11414',50 Comment.Special: 'italic #505050',5152 Keyword: 'bold #B80000',53 Keyword.Type: '#808080',5455 Operator.Word: 'bold #B80000',5657 Name.Builtin: '#333333',58 Name.Function: '#333333',59 Name.Class: 'bold #333333',60 Name.Namespace: 'bold #333333',61 Name.Entity: 'bold #363636',62 Name.Attribute: '#686868',63 Name.Tag: 'bold #686868',64 Name.Decorator: '#686868',6566 String: '#AA891C',67 Number: '#444444',6869 Generic.Heading: 'bold #000080',70 Generic.Subheading: 'bold #800080',71 Generic.Deleted: '#aa0000',72 Generic.Inserted: '#00aa00',73 Generic.Error: '#aa0000',74 Generic.Emph: 'italic',75 Generic.Strong: 'bold',76 Generic.Prompt: '#555555',77 Generic.Output: '#888888',78 Generic.Traceback: '#aa0000',7980 Error: '#F00 bg:#FAA'81 }828384_sig_re = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*(\(.*?\))')858687def format_function(name, aliases, func):88 lines = inspect.getdoc(func).splitlines()89 signature = '()'90 if isinstance(func, BuiltinFunctionType):91 match = _sig_re.match(lines[0])92 if match is not None:93 del lines[:1 + bool(lines and not lines[0])]94 signature = match.group(1)95 else:96 try:97 argspec = inspect.getargspec(func)98 if getattr(func, 'environmentfilter', False) or \99 getattr(func, 'contextfilter', False) or \100 getattr(func, 'evalcontextfilter', False):101 del argspec[0][0]102 signature = inspect.formatargspec(*argspec)103 except:104 pass105 result = ['.. function:: %s%s' % (name, signature), '']106 result.extend(' ' + line for line in lines)107 if aliases:108 result.extend(('', ' :aliases: %s' % ', '.join(109 '``%s``' % x for x in sorted(aliases))))110 return result111112113def dump_functions(mapping):114 def directive(115 dirname, arguments, options, content, lineno, content_offset,116 block_text, state, state_machine117 ):118 reverse_mapping = {}119120 for name, func in mapping.items():121 reverse_mapping.setdefault(func, []).append(name)122123 filters = []124 compare_ops = set(('lt', 'le', 'eq', 'ne', 'ge', 'gt'))125126 for func, names in reverse_mapping.items():127 aliases = sorted(names, key=len)128 aliases = sorted(aliases, key=lambda x: x in compare_ops)129 name = aliases.pop()130 filters.append((name, aliases, func))131132 filters.sort()133 result = ViewList()134135 for name, aliases, func in filters:136 for item in format_function(name, aliases, func):137 result.append(item, '<jinjaext>')138139 node = nodes.paragraph()140 state.nested_parse(result, content_offset, node)141 return node.children142143 return directive144145146from jinja2.defaults import DEFAULT_FILTERS, DEFAULT_TESTS147jinja_filters = dump_functions(DEFAULT_FILTERS)148jinja_tests = dump_functions(DEFAULT_TESTS)149150151def jinja_nodes(dirname, arguments, options, content, lineno,152 content_offset, block_text, state, state_machine):153 from jinja2.nodes import Node154 doc = ViewList()155 def walk(node, indent):156 p = ' ' * indent157 sig = ', '.join(node.fields)158 doc.append(p + '.. autoclass:: %s(%s)' % (node.__name__, sig), '')159 if node.abstract:160 members = []161 for key, name in node.__dict__.items():162 if not key.startswith('_') and \163 not hasattr(node.__base__, key) and isinstance(name, abc.Callable):164 members.append(key)165 if members:166 members.sort()167 doc.append('%s :members: %s' % (p, ', '.join(members)), '')168 if node.__base__ != object:169 doc.append('', '')170 doc.append('%s :Node type: :class:`%s`' %171 (p, node.__base__.__name__), '')172 doc.append('', '')173 children = node.__subclasses__()174 children.sort(key=lambda x: x.__name__.lower())175 for child in children:176 walk(child, indent)177 walk(Node, 0)178 return parse_rst(state, content_offset, doc)179180181def inject_toc(app, doctree, docname):182 titleiter = iter(doctree.traverse(nodes.title))183 try:184 # skip first title, we are not interested in that one185 next(titleiter)186 title = next(titleiter)187 # and check if there is at least another title188 next(titleiter)189 except StopIteration:190 return191 tocnode = nodes.section('')192 tocnode['classes'].append('toc')193 toctitle = nodes.section('')194 toctitle['classes'].append('toctitle')195 toctitle.append(nodes.title(text='Table Of Contents'))196 tocnode.append(toctitle)197 tocnode += doctree.document.settings.env.get_toc_for(docname)[0][1]198 title.parent.insert(title.parent.children.index(title), tocnode)199200201def setup(app):202 app.add_directive('jinjafilters', jinja_filters, 0, (0, 0, 0))203 app.add_directive('jinjatests', jinja_tests, 0, (0, 0, 0))204 app.add_directive('jinjanodes', jinja_nodes, 0, (0, 0, 0))205 # uncomment for inline toc. links are broken unfortunately206 ##app.connect('doctree-resolved', inject_toc)
deleted:docs/jinjastyle.sty-119 removed
1\definecolor{TitleColor}{rgb}{0,0,0}2\definecolor{InnerLinkColor}{rgb}{0,0,0}3\definecolor{OuterLinkColor}{rgb}{0.8,0,0}45\renewcommand{\maketitle}{%6 \begin{titlepage}%7 \let\footnotesize\small8 \let\footnoterule\relax9 \ifsphinxpdfoutput10 \begingroup11 % This \def is required to deal with multi-line authors; it12 % changes \\ to ', ' (comma-space), making it pass muster for13 % generating document info in the PDF file.14 \def\\{, }15 \pdfinfo{16 /Author (\@author)17 /Title (\@title)18 }19 \endgroup20 \fi21 \begin{flushright}%22 %\sphinxlogo%23 {\center24 \vspace*{3cm}25 \includegraphics{logo.pdf}26 \vspace{3cm}27 \par28 {\rm\Huge \@title \par}%29 {\em\LARGE \py@release\releaseinfo \par}30 {\large31 \@date \par32 \py@authoraddress \par33 }}%34 \end{flushright}%\par35 \@thanks36 \end{titlepage}%37 \cleardoublepage%38 \setcounter{footnote}{0}%39 \let\thanks\relax\let\maketitle\relax40 %\gdef\@thanks{}\gdef\@author{}\gdef\@title{}41}4243\fancypagestyle{normal}{44 \fancyhf{}45 \fancyfoot[LE,RO]{{\thepage}}46 \fancyfoot[LO]{{\nouppercase{\rightmark}}}47 \fancyfoot[RE]{{\nouppercase{\leftmark}}}48 \fancyhead[LE,RO]{{ \@title, \py@release}}49 \renewcommand{\headrulewidth}{0.4pt}50 \renewcommand{\footrulewidth}{0.4pt}51}5253\fancypagestyle{plain}{54 \fancyhf{}55 \fancyfoot[LE,RO]{{\thepage}}56 \renewcommand{\headrulewidth}{0pt}57 \renewcommand{\footrulewidth}{0.4pt}58}5960\titleformat{\section}{\Large}%61 {\py@TitleColor\thesection}{0.5em}{\py@TitleColor}{\py@NormalColor}62\titleformat{\subsection}{\large}%63 {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}64\titleformat{\subsubsection}{}%65 {\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}66\titleformat{\paragraph}{\large}%67 {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor}6869\ChNameVar{\raggedleft\normalsize}70\ChNumVar{\raggedleft \bfseries\Large}71\ChTitleVar{\raggedleft \rm\Huge}7273\renewcommand\thepart{\@Roman\c@part}74\renewcommand\part{%75 \pagestyle{plain}76 \if@noskipsec \leavevmode \fi77 \cleardoublepage78 \vspace*{6cm}%79 \@afterindentfalse80 \secdef\@part\@spart}8182\def\@part[#1]#2{%83 \ifnum \c@secnumdepth >\m@ne84 \refstepcounter{part}%85 \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%86 \else87 \addcontentsline{toc}{part}{#1}%88 \fi89 {\parindent \z@ %\center90 \interlinepenalty \@M91 \normalfont92 \ifnum \c@secnumdepth >\m@ne93 \rm\Large \partname~\thepart94 \par\nobreak95 \fi96 \MakeUppercase{\rm\Huge #2}%97 \markboth{}{}\par}%98 \nobreak99 \vskip 8ex100 \@afterheading}101\def\@spart#1{%102 {\parindent \z@ %\center103 \interlinepenalty \@M104 \normalfont105 \huge \bfseries #1\par}%106 \nobreak107 \vskip 3ex108 \@afterheading}109110% use inconsolata font111\usepackage{inconsolata}112113% fix single quotes, for inconsolata. (does not work)114%%\usepackage{textcomp}115%%\begingroup116%% \catcode`'=\active117%% \g@addto@macro\@noligs{\let'\textsinglequote}118%% \endgroup119%%\endinput
deleted:docs/latexindex.rst-6 removed
1:orphan:23Jinja2 Documentation4====================56.. include:: contents.rst.inc
deleted:docs/logo.pdfbinary

A binary file, deleted.

added:docs/make.bat+35 added
1@ECHO OFF23pushd %~dp045REM Command file for Sphinx documentation67if "%SPHINXBUILD%" == "" (8 set SPHINXBUILD=sphinx-build9)10set SOURCEDIR=.11set BUILDDIR=_build1213if "%1" == "" goto help1415%SPHINXBUILD% >NUL 2>NUL16if errorlevel 9009 (17 echo.18 echo.The 'sphinx-build' command was not found. Make sure you have Sphinx19 echo.installed, then set the SPHINXBUILD environment variable to point20 echo.to the full path of the 'sphinx-build' executable. Alternatively you21 echo.may add the Sphinx directory to PATH.22 echo.23 echo.If you don't have Sphinx installed, grab it from24 echo.http://sphinx-doc.org/25 exit /b 126)2728%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%29goto end3031:help32%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%3334:end35popd
modified:docs/Makefile+9 added-108 removed
1# Makefile for Sphinx documentation1# Minimal makefile for Sphinx documentation2#34# You can set these variables from the command line.5SPHINXOPTS =6SPHINXBUILD = sphinx-build7PAPER =7SOURCEDIR = .8BUILDDIR = _build910# Internal variables.11PAPEROPT_a4 = -D latex_paper_size=a412PAPEROPT_letter = -D latex_paper_size=letter13ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .1415.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp epub latex changes linkcheck doctest1610# Put it first so that "make" without argument is like "make help".11help:18 @echo "Please use \`make <target>' where <target> is one of"19 @echo " html to make standalone HTML files"20 @echo " dirhtml to make HTML files named index.html in directories"21 @echo " singlehtml to make a single large HTML file"22 @echo " pickle to make pickle files"23 @echo " json to make JSON files"24 @echo " htmlhelp to make HTML files and a HTML help project"25 @echo " qthelp to make HTML files and a qthelp project"26 @echo " devhelp to make HTML files and a Devhelp project"27 @echo " epub to make an epub"28 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"29 @echo " latexpdf to make LaTeX files and run them through pdflatex"30 @echo " changes to make an overview of all changed/added/deprecated items"31 @echo " linkcheck to check all external links for integrity"32 @echo " doctest to run all doctests embedded in the documentation (if enabled)"12 @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)1334clean:35 -rm -rf $(BUILDDIR)/*14.PHONY: help Makefile1537html:38 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html39 @echo40 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."4142dirhtml:43 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml44 @echo45 @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."4647singlehtml:48 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml49 @echo50 @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."5152pickle:53 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle54 @echo55 @echo "Build finished; now you can process the pickle files."5657json:58 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json59 @echo60 @echo "Build finished; now you can process the JSON files."6162htmlhelp:63 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp64 @echo65 @echo "Build finished; now you can run HTML Help Workshop with the" \66 ".hhp project file in $(BUILDDIR)/htmlhelp."6768qthelp:69 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp70 @echo71 @echo "Build finished; now you can run "qcollectiongenerator" with the" \72 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"73 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Flask.qhcp"74 @echo "To view the help file:"75 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Flask.qhc"7677devhelp:78 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) _build/devhelp79 @echo80 @echo "Build finished."81 @echo "To view the help file:"82 @echo "# mkdir -p $$HOME/.local/share/devhelp/Flask"83 @echo "# ln -s _build/devhelp $$HOME/.local/share/devhelp/Flask"84 @echo "# devhelp"8586epub:87 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub88 @echo89 @echo "Build finished. The epub file is in $(BUILDDIR)/epub."9091latex:92 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex93 @echo94 @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."95 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \96 "run these through (pdf)latex."9798latexpdf: latex99 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex100 @echo "Running LaTeX files through pdflatex..."101 make -C _build/latex all-pdf102 @echo "pdflatex finished; the PDF files are in _build/latex."103104changes:105 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes106 @echo107 @echo "The overview file is in $(BUILDDIR)/changes."108109linkcheck:110 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck111 @echo112 @echo "Link check complete; look for any errors in the above output " \113 "or in $(BUILDDIR)/linkcheck/output.txt."114115doctest:116 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest117 @echo "Testing of doctests in the sources finished, look at the " \118 "results in $(BUILDDIR)/doctest/output.txt."16# Catch-all target: route all unknown targets to Sphinx using the new17# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).18%: Makefile19 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
added:docs/requirements.txt+4 added
1Sphinx~=2.1.22Pallets-Sphinx-Themes~=1.2.03sphinxcontrib-log-cabinet~=1.0.14sphinx-issues~=1.2.0
modified:docs/templates.rst+4 added-3 removed
1312 unmodified lines
1313evaluates into an undefined object:13141315.. sourcecode:: jinja13161317 {{ '[%s]' % page.title if page.title }}1317 {{ "[{}]".format(page.title) if page.title }}131813191320.. _python-methods:1321
21 unmodified lines
13431344List of Builtin Filters1345-----------------------13461347.. jinjafilters::1347.. jinja:filters:: jinja2.defaults.DEFAULT_FILTERS134813491350.. _builtin-tests:13511352List of Builtin Tests1353---------------------13541355.. jinjatests::1355.. jinja:tests:: jinja2.defaults.DEFAULT_TESTS135613571358.. _builtin-globals:13591360List of Global Functions1361------------------------
332 unmodified lines
modified:jinja2/bccache.py+2 added-3 removed
294 unmodified lines
295 the minimal interface required.296297 Libraries compatible with this class:298299 - `werkzeug <http://werkzeug.pocoo.org/>`_.contrib.cache300 - `python-memcached <https://www.tummy.com/Community/software/python-memcached/>`_301 - `cmemcache <http://gijsbert.org/cmemcache/>`_299 - `cachelib <https://github.com/pallets/cachelib>`_300 - `python-memcached <https://pypi.org/project/python-memcached/>`_301302 (Unfortunately the django cache interface is not compatible because it303 does not support storing binary data, only unicode. You can however pass304 the underlying cache client to the bytecode cache which is available
57 unmodified lines
modified:CHANGES.rst+419 added-413 removed
1Jinja Changelog2===============1.. currentmodule:: jinja2243Version 2.10.24--------------56Unreleased78- Fix Python 3.7 deprecation warnings.9- Using ``range`` in the sandboxed environment uses ``xrange`` on12 Python 2 to avoid memory use. #93310 Python 2 to avoid memory use. :issue:`933`111213Version 2.10.114--------------
7 unmodified lines
2223Version 2.1024------------2528released on November 8th 201726Released 2017-11-082730- Added a new extension node called ``OverlayScope`` which can be used to31 create an unoptimized scope that will look up all variables from a32 derived context.33- Added an ``in`` test that works like the in operator. This can be used34 in combination with ``reject`` and ``select``.35- Added ``previtem`` and ``nextitem`` to loop contexts, providing access to the36 previous/next item in the loop. If such an item does not exist, the value is37 undefined.38- Added ``changed(*values)`` to loop contexts, providing an easy way of39 checking whether a value has changed since the last iteration (or rather40 since the last call of the method)41- Added a ``namespace`` function that creates a special object which allows42 attribute assignment using the ``set`` tag. This can be used to carry data43 across scopes, e.g. from a loop body to code that comes after the loop.44- Added a ``trimmed`` modifier to ``{% trans %}`` to strip linebreaks and45 surrounding whitespace. Also added a new policy to enable this for all46 ``trans`` blocks.47- The ``random`` filter is no longer incorrectly constant folded and will48 produce a new random choice each time the template is rendered. (`#478`_)49- Added a ``unique`` filter. (`#469`_)50- Added ``min`` and ``max`` filters. (`#475`_)51- Added tests for all comparison operators: ``eq``, ``ne``, ``lt``, ``le``,52 ``gt``, ``ge``. (`#665`_)53- ``import`` statement cannot end with a trailing comma. (`#617`_, `#618`_)54- ``indent`` filter will not indent blank lines by default. (`#685`_)55- Add ``reverse`` argument for ``dictsort`` filter. (`#692`_)56- Add a ``NativeEnvironment`` that renders templates to native Python types57 instead of strings. (`#708`_)58- Added filter support to the block ``set`` tag. (`#489`_)59- ``tojson`` filter marks output as safe to match documented behavior.60 (`#718`_)61- Resolved a bug where getting debug locals for tracebacks could62 modify template context.63- Fixed a bug where having many ``{% elif ... %}`` blocks resulted in a64 "too many levels of indentation" error. These blocks now compile to65 native ``elif ..:`` instead of ``else: if ..:`` (`#759`_)28- Added a new extension node called ``OverlayScope`` which can be used29 to create an unoptimized scope that will look up all variables from30 a derived context.31- Added an ``in`` test that works like the in operator. This can be32 used in combination with ``reject`` and ``select``.33- Added ``previtem`` and ``nextitem`` to loop contexts, providing34 access to the previous/next item in the loop. If such an item does35 not exist, the value is undefined.36- Added ``changed(*values)`` to loop contexts, providing an easy way37 of checking whether a value has changed since the last iteration (or38 rather since the last call of the method)39- Added a ``namespace`` function that creates a special object which40 allows attribute assignment using the ``set`` tag. This can be used41 to carry data across scopes, e.g. from a loop body to code that42 comes after the loop.43- Added a ``trimmed`` modifier to ``{% trans %}`` to strip linebreaks44 and surrounding whitespace. Also added a new policy to enable this45 for all ``trans`` blocks.46- The ``random`` filter is no longer incorrectly constant folded and47 will produce a new random choice each time the template is rendered.48 :pr:`478`49- Added a ``unique`` filter. :pr:`469`50- Added ``min`` and ``max`` filters. :pr:`475`51- Added tests for all comparison operators: ``eq``, ``ne``, ``lt``,52 ``le``, ``gt``, ``ge``. :pr:`665`53- ``import`` statement cannot end with a trailing comma. :pr:`617`,54 :pr:`618`55- ``indent`` filter will not indent blank lines by default. :pr:`685`56- Add ``reverse`` argument for ``dictsort`` filter. :pr:`692`57- Add a ``NativeEnvironment`` that renders templates to native Python58 types instead of strings. :pr:`708`59- Added filter support to the block ``set`` tag. :pr:`489`60- ``tojson`` filter marks output as safe to match documented behavior.61 :pr:`718`62- Resolved a bug where getting debug locals for tracebacks could63 modify template context.64- Fixed a bug where having many ``{% elif ... %}`` blocks resulted in65 a "too many levels of indentation" error. These blocks now compile66 to native ``elif ..:`` instead of ``else: if ..:`` :issue:`759`6767.. _#469: https://github.com/pallets/jinja/pull/46968.. _#475: https://github.com/pallets/jinja/pull/47569.. _#478: https://github.com/pallets/jinja/pull/47870.. _#489: https://github.com/pallets/jinja/pull/48971.. _#617: https://github.com/pallets/jinja/pull/61772.. _#618: https://github.com/pallets/jinja/pull/61873.. _#665: https://github.com/pallets/jinja/pull/66574.. _#685: https://github.com/pallets/jinja/pull/68575.. _#692: https://github.com/pallets/jinja/pull/69276.. _#708: https://github.com/pallets/jinja/pull/70877.. _#718: https://github.com/pallets/jinja/pull/71878.. _#759: https://github.com/pallets/jinja/pull/759688069Version 2.9.670-------------7184(bugfix release, released on April 3rd 2017)72Released 2017-04-037386- Fixed custom context behavior in fast resolve mode (#675)74- Fixed custom context behavior in fast resolve mode :issue:`675`757677Version 2.9.578-------------7992(bugfix release, released on January 28th 2017)80Released 2017-01-288194- Restored the original repr of the internal ``_GroupTuple`` because this95 caused issues with ansible and it was an unintended change. (#654)96- Added back support for custom contexts that override the old ``resolve``97 method since it was hard for people to spot that this could cause a98 regression.99- Correctly use the buffer for the else block of for loops. This caused100 invalid syntax errors to be caused on 2.x and completely wrong behavior101 on Python 3 (#669)102- Resolve an issue where the ``{% extends %}`` tag could not be used with103 async environments. (#668)104- Reduce memory footprint slightly by reducing our unicode database dump105 we use for identifier matching on Python 3 (#666)106- Fixed autoescaping not working for macros in async compilation mode. (#671)82- Restored the original repr of the internal ``_GroupTuple`` because83 this caused issues with ansible and it was an unintended change.84 :issue:`654`85- Added back support for custom contexts that override the old86 ``resolve`` method since it was hard for people to spot that this87 could cause a regression.88- Correctly use the buffer for the else block of for loops. This89 caused invalid syntax errors to be caused on 2.x and completely90 wrong behavior on Python 3 :issue:`669`91- Resolve an issue where the ``{% extends %}`` tag could not be used92 with async environments. :issue:`668`93- Reduce memory footprint slightly by reducing our unicode database94 dump we use for identifier matching on Python 3 :issue:`666`95- Fixed autoescaping not working for macros in async compilation mode.96 :issue:`671`979899Version 2.9.4100-------------101112(bugfix release, released on January 10th 2017)102Released 2017-01-10103114- Solved some warnings for string literals. (#646)115- Increment the bytecode cache version which was not done due to an116 oversight before.117- Corrected bad code generation and scoping for filtered loops. (#649)118- Resolved an issue where top-level output silencing after known extend119 blocks could generate invalid code when blocks where contained in if120 statements. (#651)121- Made the ``truncate.leeway`` default configurable to improve compatibility122 with older templates.104- Solved some warnings for string literals. :issue:`646`105- Increment the bytecode cache version which was not done due to an106 oversight before.107- Corrected bad code generation and scoping for filtered loops.108 :issue:`649`109- Resolved an issue where top-level output silencing after known110 extend blocks could generate invalid code when blocks where111 contained in if statements. :issue:`651`112- Made the ``truncate.leeway`` default configurable to improve113 compatibility with older templates.114115116Version 2.9.3117-------------118128(bugfix release, released on January 8th 2017)119Released 2017-01-08120130- Restored the use of blocks in macros to the extend that was possible131 before. On Python 3 it would render a generator repr instead of132 the block contents. (#645)133- Set a consistent behavior for assigning of variables in inner scopes134 when the variable is also read from an outer scope. This now sets the135 intended behavior in all situations however it does not restore the136 old behavior where limited assignments to outer scopes was possible.137 For more information and a discussion see #641138- Resolved an issue where ``block scoped`` would not take advantage of the139 new scoping rules. In some more exotic cases a variable overriden in a140 local scope would not make it into a block.141- Change the code generation of the ``with`` statement to be in line with the142 new scoping rules. This resolves some unlikely bugs in edge cases. This143 also introduces a new internal ``With`` node that can be used by extensions.121- Restored the use of blocks in macros to the extend that was possible122 before. On Python 3 it would render a generator repr instead of the123 block contents. :issue:`645`124- Set a consistent behavior for assigning of variables in inner scopes125 when the variable is also read from an outer scope. This now sets126 the intended behavior in all situations however it does not restore127 the old behavior where limited assignments to outer scopes was128 possible. For more information and a discussion see :issue:`641`129- Resolved an issue where ``block scoped`` would not take advantage of130 the new scoping rules. In some more exotic cases a variable131 overriden in a local scope would not make it into a block.132- Change the code generation of the ``with`` statement to be in line133 with the new scoping rules. This resolves some unlikely bugs in edge134 cases. This also introduces a new internal ``With`` node that can be135 used by extensions.136137138Version 2.9.2139-------------140149(bugfix release, released on January 8th 2017)141Released 2017-01-08142151- Fixed a regression that caused for loops to not be able to use the same152 variable for the target as well as source iterator. (#640)153- Add support for a previously unknown behavior of macros. It used to be154 possible in some circumstances to explicitly provide a caller argument155 to macros. While badly buggy and unintended it turns out that this is a156 common case that gets copy pasted around. To not completely break backwards157 compatibility with the most common cases it's now possible to provide an158 explicit keyword argument for caller if it's given an explicit default.159 (#642)143- Fixed a regression that caused for loops to not be able to use the144 same variable for the target as well as source iterator.145 :issue:`640`146- Add support for a previously unknown behavior of macros. It used to147 be possible in some circumstances to explicitly provide a caller148 argument to macros. While badly buggy and unintended it turns out149 that this is a common case that gets copy pasted around. To not150 completely break backwards compatibility with the most common cases151 it's now possible to provide an explicit keyword argument for caller152 if it's given an explicit default. :issue:`642`153154155Version 2.9.1156-------------157165(bugfix release, released on January 7th 2017)158Released 2017-01-07159167- Resolved a regression with call block scoping for macros. Nested caller168 blocks that used the same identifiers as outer macros could refer to the169 wrong variable incorrectly.160- Resolved a regression with call block scoping for macros. Nested161 caller blocks that used the same identifiers as outer macros could162 refer to the wrong variable incorrectly.163164165Version 2.9166-----------174(codename Derivation, released on January 7th 2017)167176- Change cache key definition in environment. This fixes a performance177 regression introduced in 2.8.178- Added support for ``generator_stop`` on supported Python versions179 (Python 3.5 and later)180- Corrected a long standing issue with operator precedence of math operations181 not being what was expected.182- Added support for Python 3.6 async iterators through a new async mode.183- Added policies for filter defaults and similar things.184- urlize now sets "rel noopener" by default.185- Support attribute fallback for old-style classes in 2.x.186- Support toplevel set statements in extend situations.187- Restored behavior of Cycler for Python 3 users.188- Subtraction now follows the same behavior as other operators on undefined189 values.190- ``map`` and friends will now give better error messages if you forgot to191 quote the parameter.192- Depend on MarkupSafe 0.23 or higher.193- Improved the ``truncate`` filter to support better truncation in case194 the string is barely truncated at all.195- Change the logic for macro autoescaping to be based on the runtime196 autoescaping information at call time instead of macro define time.197- Ported a modified version of the ``tojson`` filter from Flask to Jinja2198 and hooked it up with the new policy framework.199- Block sets are now marked ``safe`` by default.200- On Python 2 the asciification of ASCII strings can now be disabled with201 the ``compiler.ascii_str`` policy.202- Tests now no longer accept an arbitrary expression as first argument but203 a restricted one. This means that you can now properly use multiple204 tests in one expression without extra parentheses. In particular you can205 now write ``foo is divisibleby 2 or foo is divisibleby 3``206 as you would expect.207- Greatly changed the scoping system to be more consistent with what template208 designers and developers expect. There is now no more magic difference209 between the different include and import constructs. Context is now always210 propagated the same way. The only remaining differences is the defaults211 for ``with context`` and ``without context``.212- The ``with`` and ``autoescape`` tags are now built-in.213- Added the new ``select_autoescape`` function which helps configuring better214 autoescaping easier.215- Fixed a runtime error in the sandbox when attributes of async generators216 were accessed.168Released 2017-01-07, codename Derivation169170- Change cache key definition in environment. This fixes a performance171 regression introduced in 2.8.172- Added support for ``generator_stop`` on supported Python versions173 (Python 3.5 and later)174- Corrected a long standing issue with operator precedence of math175 operations not being what was expected.176- Added support for Python 3.6 async iterators through a new async177 mode.178- Added policies for filter defaults and similar things.179- Urlize now sets "rel noopener" by default.180- Support attribute fallback for old-style classes in 2.x.181- Support toplevel set statements in extend situations.182- Restored behavior of Cycler for Python 3 users.183- Subtraction now follows the same behavior as other operators on184 undefined values.185- ``map`` and friends will now give better error messages if you186 forgot to quote the parameter.187- Depend on MarkupSafe 0.23 or higher.188- Improved the ``truncate`` filter to support better truncation in189 case the string is barely truncated at all.190- Change the logic for macro autoescaping to be based on the runtime191 autoescaping information at call time instead of macro define time.192- Ported a modified version of the ``tojson`` filter from Flask to193 Jinja2 and hooked it up with the new policy framework.194- Block sets are now marked ``safe`` by default.195- On Python 2 the asciification of ASCII strings can now be disabled196 with the ``compiler.ascii_str`` policy.197- Tests now no longer accept an arbitrary expression as first argument198 but a restricted one. This means that you can now properly use199 multiple tests in one expression without extra parentheses. In200 particular you can now write ``foo is divisibleby 2 or foo is201 divisibleby 3`` as you would expect.202- Greatly changed the scoping system to be more consistent with what203 template designers and developers expect. There is now no more magic204 difference between the different include and import constructs.205 Context is now always propagated the same way. The only remaining206 differences is the defaults for ``with context`` and ``without207 context``.208- The ``with`` and ``autoescape`` tags are now built-in.209- Added the new ``select_autoescape`` function which helps configuring210 better autoescaping easier.211- Fixed a runtime error in the sandbox when attributes of async212 generators were accessed.213214215Version 2.8.1216-------------217222(bugfix release, released on December 29th 2016)218Released 2016-12-29219224- Fixed the ``for_qs`` flag for ``urlencode``.225- Fixed regression when applying ``int`` to non-string values.226- SECURITY: if the sandbox mode is used format expressions are now sandboxed227 with the same rules as in Jinja. This solves various information leakage228 problems that can occur with format strings.220- Fixed the ``for_qs`` flag for ``urlencode``.221- Fixed regression when applying ``int`` to non-string values.222- SECURITY: if the sandbox mode is used format expressions are now223 sandboxed with the same rules as in Jinja. This solves various224 information leakage problems that can occur with format strings.225226227Version 2.8228-----------229234(codename Replacement, released on July 26th 2015)230Released 2015-07-26, codename Replacement231236- Added ``target`` parameter to urlize function.237- Added support for ``followsymlinks`` to the file system loader.238- The truncate filter now counts the length.239- Added equalto filter that helps with select filters.240- Changed cache keys to use absolute file names if available241 instead of load names.242- Fixed loop length calculation for some iterators.243- Changed how Jinja2 enforces strings to be native strings in244 Python 2 to work when people break their default encoding.245- Added :func:`make_logging_undefined` which returns an undefined246 object that logs failures into a logger.247- If unmarshalling of cached data fails the template will be248 reloaded now.249- Implemented a block ``set`` tag.250- Default cache size was increased to 400 from a low 50.251- Fixed ``is number`` test to accept long integers in all Python versions.252- Changed ``is number`` to accept Decimal as a number.253- Added a check for default arguments followed by non-default arguments. This254 change makes ``{% macro m(x, y=1, z) %}...{% endmacro %}`` a syntax error.255 The previous behavior for this code was broken anyway (resulting in the256 default value being applied to ``y``).257- Add ability to use custom subclasses of ``jinja2.compiler.CodeGenerator`` and258 ``jinja2.runtime.Context`` by adding two new attributes to the environment259 (``code_generator_class`` and ``context_class``) (pull request ``#404``).260- added support for context/environment/evalctx decorator functions on261 the finalize callback of the environment.262- escape query strings for urlencode properly. Previously slashes were not263 escaped in that place.264- Add 'base' parameter to 'int' filter.232- Added ``target`` parameter to urlize function.233- Added support for ``followsymlinks`` to the file system loader.234- The truncate filter now counts the length.235- Added equalto filter that helps with select filters.236- Changed cache keys to use absolute file names if available instead237 of load names.238- Fixed loop length calculation for some iterators.239- Changed how Jinja2 enforces strings to be native strings in Python 2240 to work when people break their default encoding.241- Added :func:`make_logging_undefined` which returns an undefined242 object that logs failures into a logger.243- If unmarshalling of cached data fails the template will be reloaded244 now.245- Implemented a block ``set`` tag.246- Default cache size was increased to 400 from a low 50.247- Fixed ``is number`` test to accept long integers in all Python248 versions.249- Changed ``is number`` to accept Decimal as a number.250- Added a check for default arguments followed by non-default251 arguments. This change makes ``{% macro m(x, y=1, z) %}`` a syntax252 error. The previous behavior for this code was broken anyway253 (resulting in the default value being applied to ``y``).254- Add ability to use custom subclasses of255 ``jinja2.compiler.CodeGenerator`` and ``jinja2.runtime.Context`` by256 adding two new attributes to the environment257 (``code_generator_class`` and ``context_class``) (pull request258 ``:issue:`404```).259- Added support for context/environment/evalctx decorator functions on260 the finalize callback of the environment.261- Escape query strings for urlencode properly. Previously slashes were262 not escaped in that place.263- Add 'base' parameter to 'int' filter.264265266Version 2.7.3267-------------268270(bugfix release, released on June 6th 2014)269Released 2014-06-06270272- Security issue: Corrected the security fix for the cache folder. This273 fix was provided by RedHat.271- Security issue: Corrected the security fix for the cache folder.272 This fix was provided by RedHat.273274275Version 2.7.2276-------------277279(bugfix release, released on January 10th 2014)278Released 2014-01-10279281- Prefix loader was not forwarding the locals properly to282 inner loaders. This is now fixed.283- Security issue: Changed the default folder for the filesystem cache to be284 user specific and read and write protected on UNIX systems. See285 `Debian bug 734747`_ for more information.280- Prefix loader was not forwarding the locals properly to inner281 loaders. This is now fixed.282- Security issue: Changed the default folder for the filesystem cache283 to be user specific and read and write protected on UNIX systems.284 See `Debian bug 734747`_ for more information.285287.. _Debian bug 734747: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747286.. _Debian bug 734747: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747287288289Version 2.7.1290-------------291293(bugfix release, released on August 7th 2013)292Released 2013-08-07293295- Fixed a bug with ``call_filter`` not working properly on environment296 and context filters.297- Fixed lack of Python 3 support for bytecode caches.298- Reverted support for defining blocks in included templates as this299 broke existing templates for users.300- Fixed some warnings with hashing of undefineds and nodes if Python301 is run with warnings for Python 3.302- Added support for properly hashing undefined objects.303- Fixed a bug with the title filter not working on already uppercase304 strings.294- Fixed a bug with ``call_filter`` not working properly on environment295 and context filters.296- Fixed lack of Python 3 support for bytecode caches.297- Reverted support for defining blocks in included templates as this298 broke existing templates for users.299- Fixed some warnings with hashing of undefineds and nodes if Python300 is run with warnings for Python 3.301- Added support for properly hashing undefined objects.302- Fixed a bug with the title filter not working on already uppercase303 strings.304305306Version 2.7307-----------308310(codename Translation, released on May 20th 2013)309Released 2013-05-20, codename Translation310312- Choice and prefix loaders now dispatch source and template lookup313 separately in order to work in combination with module loaders as314 advertised.315- Fixed filesizeformat.316- Added a non-silent option for babel extraction.317- Added ``urlencode`` filter that automatically quotes values for318 URL safe usage with utf-8 as only supported encoding. If applications319 want to change this encoding they can override the filter.320- Added ``keep-trailing-newline`` configuration to environments and321 templates to optionally preserve the final trailing newline.322- Accessing ``last`` on the loop context no longer causes the iterator323 to be consumed into a list.324- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,325 supported by same source code, using the "six" compatibility library.326- Allow ``contextfunction`` and other decorators to be applied to ``__call__``.327- Added support for changing from newline to different signs in the ``wordwrap``328 filter.329- Added support for ignoring memcache errors silently.330- Added support for keeping the trailing newline in templates.331- Added finer grained support for stripping whitespace on the left side332 of blocks.333- Added ``map``, ``select``, ``reject``, ``selectattr`` and ``rejectattr``334 filters.335- Added support for ``loop.depth`` to figure out how deep inside a recursive336 loop the code is.337- Disabled py_compile for pypy and python 3.311- Choice and prefix loaders now dispatch source and template lookup312 separately in order to work in combination with module loaders as313 advertised.314- Fixed filesizeformat.315- Added a non-silent option for babel extraction.316- Added ``urlencode`` filter that automatically quotes values for URL317 safe usage with utf-8 as only supported encoding. If applications318 want to change this encoding they can override the filter.319- Added ``keep-trailing-newline`` configuration to environments and320 templates to optionally preserve the final trailing newline.321- Accessing ``last`` on the loop context no longer causes the iterator322 to be consumed into a list.323- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,324 supported by same source code, using the "six" compatibility325 library.326- Allow ``contextfunction`` and other decorators to be applied to327 ``__call__``.328- Added support for changing from newline to different signs in the329 ``wordwrap`` filter.330- Added support for ignoring memcache errors silently.331- Added support for keeping the trailing newline in templates.332- Added finer grained support for stripping whitespace on the left333 side of blocks.334- Added ``map``, ``select``, ``reject``, ``selectattr`` and335 ``rejectattr`` filters.336- Added support for ``loop.depth`` to figure out how deep inside a337 recursive loop the code is.338- Disabled py_compile for pypy and python 3.339340341Version 2.6342-----------343343(codename Convolution, released on July 24th 2011)344Released 2011-07-24, codename Convolution345345- internal attributes now raise an internal attribute error now instead346 of returning an undefined. This fixes problems when passing undefined347 objects to Python semantics expecting APIs.348- traceback support now works properly for PyPy. (Tested with 1.4)349- implemented operator intercepting for sandboxed environments. This350 allows application developers to disable builtin operators for better351 security. (For instance limit the mathematical operators to actual352 integers instead of longs)353- groupby filter now supports dotted notation for grouping by attributes354 of attributes.355- scoped blocks now properly treat toplevel assignments and imports.356 Previously an import suddenly "disappeared" in a scoped block.357- automatically detect newer Python interpreter versions before loading code358 from bytecode caches to prevent segfaults on invalid opcodes. The segfault359 in earlier Jinja2 versions here was not a Jinja2 bug but a limitation in360 the underlying Python interpreter. If you notice Jinja2 segfaulting in361 earlier versions after an upgrade of the Python interpreter you don't have362 to upgrade, it's enough to flush the bytecode cache. This just no longer363 makes this necessary, Jinja2 will automatically detect these cases now.364- the sum filter can now sum up values by attribute. This is a backwards365 incompatible change. The argument to the filter previously was the366 optional starting index which defaults to zero. This now became the367 second argument to the function because it's rarely used.368- like sum, sort now also makes it possible to order items by attribute.369- like sum and sort, join now also is able to join attributes of objects370 as string.371- the internal eval context now has a reference to the environment.372- added a mapping test to see if an object is a dict or an object with373 a similar interface.346- Internal attributes now raise an internal attribute error now347 instead of returning an undefined. This fixes problems when passing348 undefined objects to Python semantics expecting APIs.349- Traceback support now works properly for PyPy. (Tested with 1.4)350- Implemented operator intercepting for sandboxed environments. This351 allows application developers to disable builtin operators for352 better security. (For instance limit the mathematical operators to353 actual integers instead of longs)354- Groupby filter now supports dotted notation for grouping by355 attributes of attributes.356- Scoped blocks now properly treat toplevel assignments and imports.357 Previously an import suddenly "disappeared" in a scoped block.358- Automatically detect newer Python interpreter versions before359 loading code from bytecode caches to prevent segfaults on invalid360 opcodes. The segfault in earlier Jinja2 versions here was not a361 Jinja2 bug but a limitation in the underlying Python interpreter. If362 you notice Jinja2 segfaulting in earlier versions after an upgrade363 of the Python interpreter you don't have to upgrade, it's enough to364 flush the bytecode cache. This just no longer makes this necessary,365 Jinja2 will automatically detect these cases now.366- The sum filter can now sum up values by attribute. This is a367 backwards incompatible change. The argument to the filter previously368 was the optional starting index which defaults to zero. This now369 became the second argument to the function because it's rarely used.370- Like sum, sort now also makes it possible to order items by371 attribute.372- Like sum and sort, join now also is able to join attributes of373 objects as string.374- The internal eval context now has a reference to the environment.375- Added a mapping test to see if an object is a dict or an object with376 a similar interface.377378379Version 2.5.5380-------------381379(re-release of 2.5.4 with built documentation removed for filesize.380 Released on October 18th 2010)382Released 2010-10-18383382- built documentation is no longer part of release.384- Built documentation is no longer part of release.385386387Version 2.5.4388-------------389388(bugfix release, released on October 17th 2010)390Released 2010-10-17391390- Fixed extensions not loading properly with overlays.391- Work around a bug in cpython for the debugger that causes segfaults392 on 64bit big-endian architectures.392- Fixed extensions not loading properly with overlays.393- Work around a bug in cpython for the debugger that causes segfaults394 on 64bit big-endian architectures.395396397Version 2.5.3398-------------399398(bugfix release, released on October 17th 2010)400Released 2010-10-17401400- fixed an operator precedence error introduced in 2.5.2. Statements401 like "-foo.bar" had their implicit parentheses applied around the402 first part of the expression ("(-foo).bar") instead of the more403 correct "-(foo.bar)".402- Fixed an operator precedence error introduced in 2.5.2. Statements403 like "-foo.bar" had their implicit parentheses applied around the404 first part of the expression ("(-foo).bar") instead of the more405 correct "-(foo.bar)".406407408Version 2.5.2409-------------408(bugfix release, released on August 18th 2010)410410- improved setup.py script to better work with assumptions people411 might still have from it (``--with-speedups``).412- fixed a packaging error that excluded the new debug support.411Released 2010-08-18412413- Improved setup.py script to better work with assumptions people414 might still have from it (``--with-speedups``).415- Fixed a packaging error that excluded the new debug support.416417418Version 2.5.1419-------------420418(bugfix release, released on August 17th 2010)421Released 2010-08-17422420- StopIteration exceptions raised by functions called from templates421 are now intercepted and converted to undefineds. This solves a422 lot of debugging grief. (StopIteration is used internally to423 abort template execution)424- improved performance of macro calls slightly.425- babel extraction can now properly extract newstyle gettext calls.426- using the variable ``num`` in newstyle gettext for something else427 than the pluralize count will no longer raise a :exc:`KeyError`.428- removed builtin markup class and switched to markupsafe. For backwards429 compatibility the pure Python implementation still exists but is430 pulled from markupsafe by the Jinja2 developers. The debug support431 went into a separate feature called "debugsupport" and is disabled432 by default because it is only relevant for Python 2.4433- fixed an issue with unary operators having the wrong precedence.423- StopIteration exceptions raised by functions called from templates424 are now intercepted and converted to undefineds. This solves a lot425 of debugging grief. (StopIteration is used internally to abort426 template execution)427- Improved performance of macro calls slightly.428- Babel extraction can now properly extract newstyle gettext calls.429- Using the variable ``num`` in newstyle gettext for something else430 than the pluralize count will no longer raise a :exc:`KeyError`.431- Removed builtin markup class and switched to markupsafe. For432 backwards compatibility the pure Python implementation still exists433 but is pulled from markupsafe by the Jinja2 developers. The debug434 support went into a separate feature called "debugsupport" and is435 disabled by default because it is only relevant for Python 2.4436- Fixed an issue with unary operators having the wrong precedence.437438439Version 2.5440-----------441439(codename Incoherence, released on May 29th 2010)442Released 2010-05-29, codename Incoherence443441- improved the sort filter (should have worked like this for a442 long time) by adding support for case insensitive searches.443- fixed a bug for getattribute constant folding.444- support for newstyle gettext translations which result in a445 nicer in-template user interface and more consistent446 catalogs. (:ref:`newstyle-gettext`)447- it's now possible to register extensions after an environment448 was created.444- Improved the sort filter (should have worked like this for a long445 time) by adding support for case insensitive searches.446- Fixed a bug for getattribute constant folding.447- Support for newstyle gettext translations which result in a nicer448 in-template user interface and more consistent catalogs.449 (:ref:`newstyle-gettext`)450- It's now possible to register extensions after an environment was451 created.452453454Version 2.4.1455-------------456454(bugfix release, released on April 20th 2010)457Released 2010-04-20458456- fixed an error reporting bug for undefineds.459- Fixed an error reporting bug for undefined.460461462Version 2.4463-----------464462(codename Correlation, released on April 13th 2010)465Released 2010-04-13, codename Correlation466464- the environment template loading functions now transparently465 pass through a template object if it was passed to it. This466 makes it possible to import or extend from a template object467 that was passed to the template.468- added a :class:`ModuleLoader` that can load templates from469 precompiled sources. The environment now features a method470 to compile the templates from a configured loader into a zip471 file or folder.472- the _speedups C extension now supports Python 3.473- added support for autoescaping toggling sections and support474 for evaluation contexts (:ref:`eval-context`).475- extensions have a priority now.467- The environment template loading functions now transparently pass468 through a template object if it was passed to it. This makes it469 possible to import or extend from a template object that was passed470 to the template.471- Added a :class:`ModuleLoader` that can load templates from472 precompiled sources. The environment now features a method to473 compile the templates from a configured loader into a zip file or474 folder.475- The _speedups C extension now supports Python 3.476- Added support for autoescaping toggling sections and support for477 evaluation contexts (:ref:`eval-context`).478- Extensions have a priority now.479480481Version 2.3.1482-------------483481(bugfix release, released on February 19th 2010)484Released 2010-02-19485483- fixed an error reporting bug on all python versions484- fixed an error reporting bug on Python 2.4486- Fixed an error reporting bug on all python versions487- Fixed an error reporting bug on Python 2.4488489490Version 2.3491-----------492490(codename 3000 Pythons, released on February 10th 2010)493Released 2010-02-10, codename 3000 Pythons494492- fixes issue with code generator that causes unbound variables493 to be generated if set was used in if-blocks and other small494 identifier problems.495- include tags are now able to select between multiple templates496 and take the first that exists, if a list of templates is497 given.498- fixed a problem with having call blocks in outer scopes that499 have an argument that is also used as local variable in an500 inner frame (#360).501- greatly improved error message reporting (#339)502- implicit tuple expressions can no longer be totally empty.503 This change makes ``{% if %}...{% endif %}`` a syntax error504 now. (#364)505- added support for translator comments if extracted via babel.506- added with-statement extension.507- experimental Python 3 support.495- Fixes issue with code generator that causes unbound variables to be496 generated if set was used in if-blocks and other small identifier497 problems.498- Include tags are now able to select between multiple templates and499 take the first that exists, if a list of templates is given.500- Fixed a problem with having call blocks in outer scopes that have an501 argument that is also used as local variable in an inner frame502 :issue:`360`.503- Greatly improved error message reporting :pr:`339`504- Implicit tuple expressions can no longer be totally empty. This505 change makes ``{% if %}`` a syntax error now. :issue:`364`506- Added support for translator comments if extracted via babel.507- Added with-statement extension.508- Experimental Python 3 support.509510511Version 2.2.1512-------------513513(bugfix release, released on September 14th 2009)514Released 2009-09-14515515- fixes some smaller problems for Jinja2 on Jython.516- Fixes some smaller problems for Jinja2 on Jython.517518519Version 2.2520-----------521521(codename Kong, released on September 13th 2009)522Released 2009-09-13, codename Kong523523- Include statements can now be marked with ``ignore missing`` to skip524 non existing templates.525- Priority of ``not`` raised. It's now possible to write `not foo in bar`526 as an alias to `foo not in bar` like in python. Previously the grammar527 required parentheses (`not (foo in bar)`) which was odd.528- Fixed a bug that caused syntax errors when defining macros or using the529 `{% call %}` tag inside loops.530- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.531- Made it possible to refer to names from outer scopes in included templates532 that were unused in the callers frame (#327)533- Fixed a bug that caused internal errors if names where used as iteration534 variable and regular variable *after* the loop if that variable was unused535 *before* the loop. (#331)536- Added support for optional ``scoped`` modifier to blocks.537- Added support for line-comments.538- Added the ``meta`` module.539- Renamed (undocumented) attribute "overlay" to "overlayed" on the540 environment because it was clashing with a method of the same name.541- speedup extension is now disabled by default.524- Include statements can now be marked with ``ignore missing`` to skip525 non existing templates.526- Priority of ``not`` raised. It's now possible to write ``not foo in527 bar`` as an alias to ``foo not in bar`` like in python. Previously528 the grammar required parentheses (``not (foo in bar)``) which was529 odd.530- Fixed a bug that caused syntax errors when defining macros or using531 the ``{% call %}`` tag inside loops.532- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.533- Made it possible to refer to names from outer scopes in included534 templates that were unused in the callers frame :issue:`327`535- Fixed a bug that caused internal errors if names where used as536 iteration variable and regular variable *after* the loop if that537 variable was unused *before* the loop. :pr:`331`538- Added support for optional ``scoped`` modifier to blocks.539- Added support for line-comments.540- Added the ``meta`` module.541- Renamed (undocumented) attribute "overlay" to "overlayed" on the542 environment because it was clashing with a method of the same name.543- Speedup extension is now disabled by default.544545546Version 2.1.1547-------------548547(bugfix release, released on December 25th 2008)549Released 2008-12-25550549- Fixed a translation error caused by looping over empty recursive loops.551- Fixed a translation error caused by looping over empty recursive552 loops.553554555Version 2.1556-----------557555(codename Yasuzō, released on November 23rd 2008)558Released 2008-11-23, codename Yasuzō559557- fixed a bug with nested loops and the special loop variable. Before the558 change an inner loop overwrote the loop variable from the outer one after559 iteration.560- fixed a bug with the i18n extension that caused the explicit pluralization561 block to look up the wrong variable.562- fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` impossible.563- index based subscribing of variables with a constant value returns an564 undefined object now instead of raising an index error. This was a bug565 caused by eager optimizing.566- the i18n extension looks up ``foo.ugettext`` now followed by ``foo.gettext``567 if an translations object is installed. This makes dealing with custom568 translations classes easier.569- fixed a confusing behavior with conditional extending. loops were partially570 executed under some conditions even though they were not part of a visible571 area.572- added ``sort`` filter that works like ``dictsort`` but for arbitrary sequences.573- fixed a bug with empty statements in macros.574- implemented a bytecode cache system. (:ref:`bytecode-cache`)575- the template context is now weakref-able576- inclusions and imports "with context" forward all variables now, not only577 the initial context.578- added a cycle helper called ``cycler``.579- added a joining helper called ``joiner``.580- added a ``compile_expression`` method to the environment that allows compiling581 of Jinja expressions into callable Python objects.582- fixed an escaping bug in urlize560- Fixed a bug with nested loops and the special loop variable. Before561 the change an inner loop overwrote the loop variable from the outer562 one after iteration.563- Fixed a bug with the i18n extension that caused the explicit564 pluralization block to look up the wrong variable.565- Fixed a limitation in the lexer that made ``{{ foo.0.0 }}``566 impossible.567- Index based subscribing of variables with a constant value returns568 an undefined object now instead of raising an index error. This was569 a bug caused by eager optimizing.570- The i18n extension looks up ``foo.ugettext`` now followed by571 ``foo.gettext`` if an translations object is installed. This makes572 dealing with custom translations classes easier.573- Fixed a confusing behavior with conditional extending. loops were574 partially executed under some conditions even though they were not575 part of a visible area.576- Added ``sort`` filter that works like ``dictsort`` but for arbitrary577 sequences.578- Fixed a bug with empty statements in macros.579- Implemented a bytecode cache system. (:ref:`bytecode-cache`)580- The template context is now weakref-able581- Inclusions and imports "with context" forward all variables now, not582 only the initial context.583- Added a cycle helper called ``cycler``.584- Added a joining helper called ``joiner``.585- Added a ``compile_expression`` method to the environment that allows586 compiling of Jinja expressions into callable Python objects.587- Fixed an escaping bug in urlize588589590Version 2.0591-----------592588(codename jinjavitus, released on July 17th 2008)593Released 2008-07-17, codename Jinjavitus594590- the subscribing of objects (looking up attributes and items) changed from591 slightly. It's now possible to give attributes or items a higher priority592 by either using dot-notation lookup or the bracket syntax. This also593 changed the AST slightly. ``Subscript`` is gone and was replaced with594 :class:`~jinja2.nodes.Getitem` and :class:`~jinja2.nodes.Getattr`.595- The subscribing of objects (looking up attributes and items) changed596 from slightly. It's now possible to give attributes or items a597 higher priority by either using dot-notation lookup or the bracket598 syntax. This also changed the AST slightly. ``Subscript`` is gone599 and was replaced with :class:`~jinja2.nodes.Getitem` and600 :class:`~jinja2.nodes.Getattr`. For more information see :ref:`the601 implementation details <notes-on-subscriptions>`.602- Added support for preprocessing and token stream filtering for603 extensions. This would allow extensions to allow simplified gettext604 calls in template data and something similar.605- Added :meth:`jinja2.environment.TemplateStream.dump`.606- Added missing support for implicit string literal concatenation.607 ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``608- ``else`` is optional for conditional expressions. If not given it609 evaluates to ``false``.610- Improved error reporting for undefined values by providing a611 position.612- ``filesizeformat`` filter uses decimal prefixes now per default and613 can be set to binary mode with the second parameter.614- Fixed bug in finalizer615596 For more information see :ref:`the implementation details <notes-on-subscriptions>`.597- added support for preprocessing and token stream filtering for extensions.598 This would allow extensions to allow simplified gettext calls in template599 data and something similar.600- added :meth:`jinja2.environment.TemplateStream.dump`.601- added missing support for implicit string literal concatenation.602 ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``603- ``else`` is optional for conditional expressions. If not given it evaluates604 to ``false``.605- improved error reporting for undefined values by providing a position.606- ``filesizeformat`` filter uses decimal prefixes now per default and can be607 set to binary mode with the second parameter.608- fixed bug in finalizer616610617Version 2.0rc1618--------------619614(no codename, released on June 9th 2008)620Released 2008-06-09621616- first release of Jinja2622- First release of Jinja2