modernize docs config, use pallets-sphinx-themes
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 · parent cde2a54 · Browse files · 32 files·+662 added−1669 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
32 files+662 added−1669 removed
- other:+662 added−1669 removed
Provenance
- Commit
f77b09d- Tree
9cc5d6a- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
cde2a54
32 files changed+662 added−1669 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
1234567891011121314151617181920<h3>About Jinja2</h3><p> Jinja2 is a full featured template engine for Python. It has full unicode support, an optional integrated sandboxed execution environment, widely used and BSD licensed.</p><h3>Other Formats</h3><p> You can download the documentation in other formats as well:</p><ul> <li><a href="http://jinja.pocoo.org/docs/jinja-docs.pdf">as PDF</a> <li><a href="http://jinja.pocoo.org/docs/jinja-docs.zip">as zipped HTML</a></ul><h3>Useful Links</h3><ul> <li><a href="http://jinja.pocoo.org/">The Jinja2 Website</a></li> <li><a href="http://pypi.python.org/pypi/Jinja2">Jinja2 @ PyPI</a></li> <li><a href="http://github.com/pallets/jinja">Jinja2 @ github</a></li></ul>deleted:docs/_templates/sidebarlogo.html-3 removed
123<p class="logo"><a href="{{ pathto(master_doc) }}"> <img class="logo" src="{{ pathto('_static/jinja-small.png', 1) }}" alt="Logo"/></a></p>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- */8-9-@import url(http://fonts.googleapis.com/css?family=Crimson+Text);10-11-{% 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- 20-body {21- font-family: {{ font_family }};22- font-size: 17px;23- background-color: white;24- color: #000;25- margin: 0;26- padding: 0;27-}28-29-div.document {30- width: {{ page_width }};31- margin: 30px auto 0 auto;32-}33-34-div.documentwrapper {35- float: left;36- width: 100%;37-}38-39-div.bodywrapper {40- margin: 0 0 0 {{ sidebar_width }};41-}42-43-div.sphinxsidebar {44- width: {{ sidebar_width }};45-}46-47-hr {48- border: 1px solid #B1B4B6;49-}50- 51-div.body {52- background-color: #ffffff;53- color: #3E4349;54- padding: 0 30px 0 30px;55-}56-57-img.floatingflask {58- padding: 0 0 10px 10px;59- float: right;60-}61- 62-div.footer {63- width: {{ page_width }};64- margin: 20px auto 30px auto;65- font-size: 14px;66- color: #888;67- text-align: right;68-}69-70-div.footer a {71- color: #888;72-}73-74-div.related {75- display: none;76-}77- 78-div.sphinxsidebar a {79- color: #444;80- text-decoration: none;81- border-bottom: 1px dotted #999;82-}83-84-div.sphinxsidebar a:hover {85- border-bottom: 1px solid #999;86-}87- 88-div.sphinxsidebar {89- font-size: 15px;90- line-height: 1.5;91-}92-93-div.sphinxsidebarwrapper {94- padding: 18px 10px;95-}96-97-div.sphinxsidebarwrapper p.logo {98- padding: 0 0 20px 0;99- margin: 0;100- text-align: center;101-}102- 103-div.sphinxsidebar h3,104-div.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-}112-113-div.sphinxsidebar h4 {114- font-size: 20px;115-}116- 117-div.sphinxsidebar h3 a {118- color: #444;119-}120-121-div.sphinxsidebar p.logo a,122-div.sphinxsidebar h3 a,123-div.sphinxsidebar p.logo a:hover,124-div.sphinxsidebar h3 a:hover {125- border: none;126-}127- 128-div.sphinxsidebar p {129- color: #555;130- margin: 10px 0;131-}132-133-div.sphinxsidebar ul {134- margin: 10px 0;135- padding: 0;136- color: #000;137-}138- 139-div.sphinxsidebar input {140- border: 1px solid #ccc;141- font-family: {{ font_family }};142- font-size: 14px;143-}144-145-div.sphinxsidebar form.search input[name="q"] {146- width: 130px;147-}148- 149-/* -- body styles ----------------------------------------------------------- */150- 151-a {152- color: #aa0000;153- text-decoration: underline;154-}155- 156-a:hover {157- color: #dd0000;158- text-decoration: underline;159-}160- 161-div.body h1,162-div.body h2,163-div.body h3,164-div.body h4,165-div.body h5,166-div.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- 174-div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }175-div.body h2 { font-size: 180%; }176-div.body h3 { font-size: 150%; }177-div.body h4 { font-size: 130%; }178-div.body h5 { font-size: 100%; }179-div.body h6 { font-size: 100%; }180- 181-a.headerlink {182- color: #ddd;183- padding: 0 4px;184- text-decoration: none;185-}186- 187-a.headerlink:hover {188- color: #444;189- background: #eaeaea;190-}191- 192-div.body p, div.body dd, div.body li {193- line-height: 1.4em;194-}195-196-div.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-}203-204-div.admonition tt.xref, div.admonition a tt {205- border-bottom: 1px solid #fafafa;206-}207-208-dd div.admonition {209- margin-left: -60px;210- padding-left: 60px;211-}212-213-div.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-}221-222-div.admonition p.last {223- margin-bottom: 0;224-}225-226-div.highlight {227- background-color: white;228-}229-230-dt:target, .highlight {231- background: #FAF3E8;232-}233-234-div.note {235- background-color: #eee;236- border: 1px solid #ccc;237-}238- 239-div.seealso {240- background-color: #ffc;241- border: 1px solid #ff6;242-}243- 244-div.topic {245- background-color: #eee;246-}247- 248-p.admonition-title {249- display: inline;250-}251- 252-p.admonition-title:after {253- content: ":";254-}255-256-pre, tt {257- font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;258- font-size: 0.85em;259-}260-261-img.screenshot {262-}263-264-tt.descname, tt.descclassname {265- font-size: 0.95em;266-}267-268-tt.descname {269- padding-right: 0.08em;270-}271-272-img.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-}277-278-table.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-}284-285-table.docutils td, table.docutils th {286- border: 1px solid #888;287- padding: 0.25em 0.7em;288-}289-290-table.field-list, table.footnote {291- border: none;292- -moz-box-shadow: none;293- -webkit-box-shadow: none;294- box-shadow: none;295-}296-297-table.footnote {298- margin: 15px 0;299- width: 100%;300- border: 1px solid #eee;301- background: #fdfdfd;302- font-size: 0.9em;303-}304-305-table.footnote + table.footnote {306- margin-top: -15px;307- border-top: none;308-}309-310-table.field-list th {311- padding: 0 0.8em 0 0;312-}313-314-table.field-list td {315- padding: 0;316-}317-318-table.footnote td.label {319- width: 0px;320- padding: 0.3em 0 0.3em 0.5em;321-}322-323-table.footnote td {324- padding: 0.3em 0.5em;325-}326-327-dl {328- margin: 0;329- padding: 0;330-}331-332-dl dd {333- margin-left: 30px;334-}335-336-blockquote {337- margin: 0 0 0 30px;338- padding: 0;339-}340-341-ul, ol {342- margin: 10px 0 10px 30px;343- padding: 0;344-}345- 346-pre {347- background: #eee;348- padding: 7px 30px;349- margin: 15px -30px;350- line-height: 1.3em;351-}352-353-dl pre, blockquote pre, li pre {354- margin-left: -60px;355- padding-left: 60px;356-}357-358-dl dl pre {359- margin-left: -90px;360- padding-left: 90px;361-}362- 363-tt {364- background-color: #E8EFF0;365- color: #222;366- /* padding: 1px 2px; */367-}368-369-tt.xref, a tt {370- background-color: #E8EFF0;371- border-bottom: 1px solid white;372-}373-374-a.reference {375- text-decoration: none;376- border-bottom: 1px dotted #bb0000;377-}378-379-a.reference:hover {380- border-bottom: 1px solid #dd0000;381-}382-383-a.footnote-reference {384- text-decoration: none;385- font-size: 0.7em;386- vertical-align: top;387- border-bottom: 1px dotted #bb0000;388-}389-390-a.footnote-reference:hover {391- border-bottom: 1px solid #dd0000;392-}393-394-a:hover tt {395- background: #EEE;396-}deleted:docs/_themes/jinja/layout.html-8 removed
12345678{%- extends "basic/layout.html" %}{%- block relbar2 %}{% endblock %}{%- block footer %} <div class="footer"> © Copyright {{ copyright }}. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. </div>{%- endblock %}deleted:docs/_themes/jinja/relations.html-19 removed
12345678910111213141516171819<h3>Related Topics</h3><ul> <li><a href="{{ pathto(master_doc) }}">Documentation overview</a><ul> {%- for parent in parents %} <li><a href="{{ parent.link|e }}">{{ parent.title }}</a><ul> {%- endfor %} {%- if prev %} <li>Previous: <a href="{{ prev.link|e }}" title="{{ _('previous chapter') }}">{{ prev.title }}</a></li> {%- endif %} {%- if next %} <li>Next: <a href="{{ next.link|e }}" title="{{ _('next chapter') }}">{{ next.title }}</a></li> {%- endif %} {%- for parent in parents %} </ul></li> {%- endfor %} </ul></li></ul>deleted:docs/_themes/jinja/theme.conf-3 removed
1-[theme]2-inherit = basic3-stylesheet = jinja.cssdeleted:docs/_themes/LICENSE-37 removed
1-Copyright (c) 2010 by Armin Ronacher.2-3-Some rights reserved.4-5-Redistribution and use in source and binary forms of the theme, with or6-without modification, are permitted provided that the following conditions7-are met:8-9-* Redistributions of source code must retain the above copyright10- notice, this list of conditions and the following disclaimer.11-12-* 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.16-17-* The names of the contributors may not be used to endorse or18- promote products derived from this software without specific19- prior written permission.20-21-We kindly ask you to only use these themes in an unmodified manner just22-for Flask and Flask-related products, not for unrelated projects. If you23-like the visual style and want to use it for your own projects, please24-consider making some larger changes to the themes (such as changing25-font faces, sizes, colors or margins).26-27-THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"28-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE29-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE30-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE31-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR32-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF33-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS34-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN35-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)36-ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE37-POSSIBILITY OF SUCH DAMAGE.deleted:docs/_themes/README-31 removed
1-Flask Sphinx Styles2-===================3-4-This repository contains sphinx styles for Flask and Flask related5-projects. To use this style in your Sphinx documentation, follow6-this guide:7-8-1. put this folder as _themes into your docs folder. Alternatively9- you can also use git submodules to check out the contents there.10-2. add this to your conf.py:11-12- sys.path.append(os.path.abspath('_themes'))13- html_theme_path = ['_themes']14- html_theme = 'flask'15-16-The following themes exist:17-18-- '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.22-23-The following options exist for the flask_small theme:24-25- [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" badgemodified:docs/api.rst+3 added-3 removed
17 unmodified lines18 :class:`Template` class, an environment is created automatically for you,19 albeit a shared one.20 21 Most applications will create one :class:`Environment` object on application22-initialization and use that to load templates. In some cases however, it's 22+initialization and use that to load templates. In some cases however, it's23 useful to have multiple environments side by side, if different configurations24 are in use.25 26 The simplest way to configure Jinja2 to load templates for your application185 unmodified lines212 213 For a more complex example you can provide a hint. For example214 the :func:`first` filter creates an undefined object that way::215 216- return environment.undefined('no first item, sequence was empty') 216+ return environment.undefined('no first item, sequence was empty')217 218 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 the607 unmodified lines828 for i in xrange(2, int(math.ceil(math.sqrt(n))) + 1):829 if n % i == 0:830 return False831 return True832- 832 833+834 You can register it on the template environment by updating the835 :attr:`~Environment.tests` dict on the environment::836 837 environment.tests['prime'] = is_prime86 unmodified linesmodified:docs/cache_extension.py+1 added-1 removed
2 unmodified lines3 4 5 class FragmentCacheExtension(Extension):6 # a set of names that trigger the extension.7- tags = set(['cache'])7+ tags = {'cache'}8 9 def __init__(self, environment):10 super(FragmentCacheExtension, self).__init__(environment)11 45 unmodified linesmodified:docs/changelog.rst+3 added-2 removed
1-.. module:: jinja21+Changelog2+=========3 3-.. include:: ../CHANGES4+.. include:: ../CHANGES.rstmodified: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.1+from pallets_sphinx_themes import get_version2+from pallets_sphinx_themes import ProjectLink3 14-import sys, os4+# Project --------------------------------------------------------------5 16-# 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.19-sys.path.append(os.path.dirname(os.path.abspath(__file__)))6+project = "Jinja"7+copyright = "2007 Pallets"8+author = "Pallets"9+release, version = get_version("Jinja2")10 21-# General configuration22-# ---------------------11+# General --------------------------------------------------------------12 24-# Add any Sphinx extension module names here, as strings. They can be extensions25-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.26-extensions = ['sphinx.ext.autodoc', 'jinjaext']27-28-# Add any paths that contain templates here, relative to this directory.29-templates_path = ['_templates']30-31-# The suffix of source filenames.32-source_suffix = '.rst'33-34-# The master toctree document.35-master_doc = 'index'36-37-# General substitutions.38-project = 'Jinja2'39-copyright = '2008, Armin Ronacher'40-41-# The default replacements for |version| and |release|, also used in various42-# other places throughout the built documents.43-#44-# The short X.Y version.45-import pkg_resources46-try:47- release = pkg_resources.get_distribution('Jinja2').version48-except 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)54-if 'dev' in release:55- release = release.split('dev')[0] + 'dev'56-version = '.'.join(release.split('.')[:2])57-58-# 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.62-today_fmt = '%B %d, %Y'63-64-# List of documents that shouldn't be included in the build.65-#unused_docs = []66-67-# If true, '()' will be appended to :func: etc. cross-reference text.68-#add_function_parentheses = True69-70-# If true, the current module name will be prepended to all description71-# unit titles (such as .. function::).72-#add_module_names = True73-74-# If true, sectionauthor and moduleauthor directives will be shown in the75-# output. They are ignored by default.76-#show_authors = False77-78-# The name of the Pygments (syntax highlighting) style to use.79-pygments_style = 'jinjaext.JinjaStyle'80-81-82-# Options for HTML output83-# -----------------------84-85-html_theme = 'jinja'86-html_theme_path = ['_themes']87-88-# The name for this set of Sphinx documents. If None, it defaults to89-# "<project> v<release> documentation".90-#html_title = None91-92-# 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".95-html_static_path = ['_static']96-97-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,98-# using the given strftime format.99-html_last_updated_fmt = '%b %d, %Y'100-101-# If true, SmartyPants will be used to convert quotes and dashes to102-# typographically correct entities.103-#html_use_smartypants = True104-105-# no modindex106-html_use_modindex = False107-108-# If true, the reST sources are included in the HTML build as _sources/<name>.109-#html_copy_source = True110-111-# If true, an OpenSearch description file will be output, and all pages will112-# contain a <link> tag referring to it.113-#html_use_opensearch = False114-115-# Output file base name for HTML help builder.116-htmlhelp_basename = 'Jinja2doc'117-118-119-# Options for LaTeX output120-# ------------------------121-122-# The paper size ('letter' or 'a4').123-latex_paper_size = 'a4'124-125-# The font size ('10pt', '11pt' or '12pt').126-#latex_font_size = '10pt'127-128-# Grouping the document tree into LaTeX files. List of tuples129-# (source start file, target name, title, author, document class [howto/manual]).130-latex_documents = [131- ('latexindex', 'Jinja2.tex', 'Jinja2 Documentation', 'Armin Ronacher',132- 'manual'),13+master_doc = "index"14+extensions = [15+ "sphinx.ext.autodoc",16+ "sphinx.ext.intersphinx",17+ "pallets_sphinx_themes",18+ "sphinxcontrib.log_cabinet",19+ "sphinx_issues",20 ]21+intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)}22+issues_github_path = "pallets/jinja"23 135-# Additional stuff for LaTeX136-latex_elements = {137- 'fontpkg': r'\usepackage{mathpazo}',138- 'papersize': 'a4paper',139- 'pointsize': '12pt',140- 'preamble': r'''141-\usepackage{jinjastyle}24+# HTML -----------------------------------------------------------------25 143-% i hate you latex144-\DeclareUnicodeCharacter{14D}{o}145-'''26+html_theme = "jinja"27+html_theme_options = {"index_sidebar_logo": False}28+html_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 }147-148-latex_use_parts = True149-150-latex_additional_files = ['jinjastyle.sty', 'logo.pdf']151-152-# If false, no module index is generated.153-latex_use_modindex = False154-37 html_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 }41+singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}42+html_static_path = ["_static"]43+html_favicon = "_static/jinja-logo-sidebar.png"44+html_logo = "_static/jinja-logo-sidebar.png"45+html_title = "Jinja Documentation ({})".format(version)46+html_show_sourcelink = False47+48+# LaTeX ----------------------------------------------------------------49+50+latex_documents = [51+ (master_doc, "Jinja-{}.tex".format(version), html_title, author, "manual")52+]deleted:docs/contents.rst.inc-23 removed
1-Jinja2 Documentation2---------------------3-4-.. toctree::5- :maxdepth: 26-7- intro8- api9- sandbox10- templates11- extensions12- integration13- switching14- tricks15-16-Additional Information17-----------------------18-19-.. toctree::20- :maxdepth: 221-22- faq23- changelogmodified:docs/extensions.rst+4 added-4 removed
25 unmodified lines26 --------------27 28 **Import name:** `jinja2.ext.i18n`29 30-The i18n extension can be used in combination with `gettext`_ or `babel`_. If 31-the i18n extension is enabled Jinja2 provides a `trans` statement that marks 30+The i18n extension can be used in combination with `gettext`_ or `babel`_. If31+the i18n extension is enabled Jinja2 provides a `trans` statement that marks32 the wrapped string as translatable and calls `gettext`.33 34 After enabling, dummy `_` function that forwards calls to `gettext` is added35 to the environment globals. An internationalized application then has to257 unmodified lines293 294 The current :class:`~jinja2.lexer.TokenStream`295 296 .. autoclass:: jinja2.lexer.TokenStream297- :members: push, look, eos, skip, next, next_if, skip_if, expect297+ :members: push, look, eos, skip, __next__, next_if, skip_if, expect298 299 .. attribute:: current300 301 The current :class:`~jinja2.lexer.Token`.33 unmodified lines335 For more information have a look at the repr of :meth:`jinja2.Environment.parse`.336 337 .. module:: jinja2.nodes338 339-.. jinjanodes::339+.. jinja:nodes:: jinja2.nodes.Node340 341 .. autoexception:: Impossiblemodified:docs/index.rst+23 added-7 removed
1-Welcome to Jinja22-=================1+.. rst-class:: hide-header2 3+Jinja4+=====5+6+.. image:: _static/jinja-logo.png7+ :align: center8+ :target: https://palletsprojects.com/p/jinja/9+4-Jinja2 is a modern and designer-friendly templating language for Python,10+Jinja is a modern and designer-friendly templating language for Python,11 modelled after Django's templates. It is fast, widely used and secure12 with the optional sandboxed template execution environment:13 14 .. sourcecode:: html+jinja4 unmodified lines19 <li><a href="{{ user.url }}">{{ user.username }}</a></li>20 {% endfor %}21 </ul>22 17-**Features:**23+Features:24 25 - sandboxed execution26 - powerful automatic HTML escaping system for XSS prevention27 - template inheritance2 unmodified lines30 - easy to debug. Line numbers of exceptions directly point to31 the correct line in the template.32 - configurable syntax33 28-.. include:: contents.rst.inc34+.. toctree::35+ :maxdepth: 236+ :caption: Contents:37 30-If you can't find the information you're looking for, have a look at the31-index or try to find it using the search function:38+ intro39+ api40+ sandbox41+ templates42+ extensions43+ integration44+ switching45+ tricks46+ faq47+ changelog48 49 * :ref:`genindex`50 * :ref:`search`deleted:docs/jinjaext.py-194 removed
1-# -*- coding: utf-8 -*-2-"""3- Jinja Documentation Extensions4- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~5-6- Support for automatically documenting filters and tests.7-8- :copyright: Copyright 2008 by Armin Ronacher.9- :license: BSD.10-"""11-import collections12-import os13-import re14-import inspect15-import jinja216-from itertools import islice17-from types import BuiltinFunctionType18-from docutils import nodes19-from docutils.statemachine import ViewList20-from sphinx.ext.autodoc import prepare_docstring21-from sphinx.application import TemplateBridge22-from pygments.style import Style23-from pygments.token import Keyword, Name, Comment, String, Error, \24- Number, Operator, Generic25-from jinja2 import Environment, FileSystemLoader26-27-28-def parse_rst(state, content_offset, doc):29- node = nodes.section()30- # hack around title style bookkeeping31- surrounding_title_styles = state.memo.title_styles32- surrounding_section_level = state.memo.section_level33- state.memo.title_styles = []34- state.memo.section_level = 035- state.nested_parse(doc, content_offset, node, match_titles=1)36- state.memo.title_styles = surrounding_title_styles37- state.memo.section_level = surrounding_section_level38- return node.children39-40-41-class JinjaStyle(Style):42- title = 'Jinja Style'43- default_style = ""44- styles = {45- Comment: 'italic #aaaaaa',46- Comment.Preproc: 'noitalic #B11414',47- Comment.Special: 'italic #505050',48-49- Keyword: 'bold #B80000',50- Keyword.Type: '#808080',51-52- Operator.Word: 'bold #B80000',53-54- Name.Builtin: '#333333',55- Name.Function: '#333333',56- Name.Class: 'bold #333333',57- Name.Namespace: 'bold #333333',58- Name.Entity: 'bold #363636',59- Name.Attribute: '#686868',60- Name.Tag: 'bold #686868',61- Name.Decorator: '#686868',62-63- String: '#AA891C',64- Number: '#444444',65-66- Generic.Heading: 'bold #000080',67- Generic.Subheading: 'bold #800080',68- Generic.Deleted: '#aa0000',69- Generic.Inserted: '#00aa00',70- Generic.Error: '#aa0000',71- Generic.Emph: 'italic',72- Generic.Strong: 'bold',73- Generic.Prompt: '#555555',74- Generic.Output: '#888888',75- Generic.Traceback: '#aa0000',76-77- Error: '#F00 bg:#FAA'78- }79-80-81-_sig_re = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*(\(.*?\))')82-83-84-def format_function(name, aliases, func):85- lines = inspect.getdoc(func).splitlines()86- signature = '()'87- if isinstance(func, BuiltinFunctionType):88- match = _sig_re.match(lines[0])89- if match is not None:90- del lines[:1 + bool(lines and not lines[0])]91- signature = match.group(1)92- else:93- try:94- argspec = inspect.getargspec(func)95- if getattr(func, 'environmentfilter', False) or \96- getattr(func, 'contextfilter', False) or \97- getattr(func, 'evalcontextfilter', False):98- del argspec[0][0]99- signature = inspect.formatargspec(*argspec)100- except:101- pass102- result = ['.. function:: %s%s' % (name, signature), '']103- result.extend(' ' + line for line in lines)104- if aliases:105- result.extend(('', ' :aliases: %s' % ', '.join(106- '``%s``' % x for x in sorted(aliases))))107- return result108-109-110-def dump_functions(mapping):111- def directive(dirname, arguments, options, content, lineno,112- content_offset, block_text, state, state_machine):113- reverse_mapping = {}114- for name, func in mapping.items():115- reverse_mapping.setdefault(func, []).append(name)116- filters = []117- for func, names in reverse_mapping.items():118- aliases = sorted(names, key=lambda x: len(x))119- name = aliases.pop()120- filters.append((name, aliases, func))121- filters.sort()122-123- result = ViewList()124- for name, aliases, func in filters:125- for item in format_function(name, aliases, func):126- result.append(item, '<jinjaext>')127-128- node = nodes.paragraph()129- state.nested_parse(result, content_offset, node)130- return node.children131- return directive132-133-134-from jinja2.defaults import DEFAULT_FILTERS, DEFAULT_TESTS135-jinja_filters = dump_functions(DEFAULT_FILTERS)136-jinja_tests = dump_functions(DEFAULT_TESTS)137-138-139-def jinja_nodes(dirname, arguments, options, content, lineno,140- content_offset, block_text, state, state_machine):141- from jinja2.nodes import Node142- doc = ViewList()143- def walk(node, indent):144- p = ' ' * indent145- sig = ', '.join(node.fields)146- doc.append(p + '.. autoclass:: %s(%s)' % (node.__name__, sig), '')147- if node.abstract:148- members = []149- for key, name in node.__dict__.items():150- if not key.startswith('_') and \151- not hasattr(node.__base__, key) and isinstance(name, collections.Callable):152- members.append(key)153- if members:154- members.sort()155- doc.append('%s :members: %s' % (p, ', '.join(members)), '')156- if node.__base__ != object:157- doc.append('', '')158- doc.append('%s :Node type: :class:`%s`' %159- (p, node.__base__.__name__), '')160- doc.append('', '')161- children = node.__subclasses__()162- children.sort(key=lambda x: x.__name__.lower())163- for child in children:164- walk(child, indent)165- walk(Node, 0)166- return parse_rst(state, content_offset, doc)167-168-169-def inject_toc(app, doctree, docname):170- titleiter = iter(doctree.traverse(nodes.title))171- try:172- # skip first title, we are not interested in that one173- next(titleiter)174- title = next(titleiter)175- # and check if there is at least another title176- next(titleiter)177- except StopIteration:178- return179- tocnode = nodes.section('')180- tocnode['classes'].append('toc')181- toctitle = nodes.section('')182- toctitle['classes'].append('toctitle')183- toctitle.append(nodes.title(text='Table Of Contents'))184- tocnode.append(toctitle)185- tocnode += doctree.document.settings.env.get_toc_for(docname)[0][1]186- title.parent.insert(title.parent.children.index(title), tocnode)187-188-189-def setup(app):190- app.add_directive('jinjafilters', jinja_filters, 0, (0, 0, 0))191- app.add_directive('jinjatests', jinja_tests, 0, (0, 0, 0))192- app.add_directive('jinjanodes', jinja_nodes, 0, (0, 0, 0))193- # uncomment for inline toc. links are broken unfortunately194- ##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}4-5-\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-}42-43-\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-}52-53-\fancypagestyle{plain}{54- \fancyhf{}55- \fancyfoot[LE,RO]{{\thepage}}56- \renewcommand{\headrulewidth}{0pt}57- \renewcommand{\footrulewidth}{0.4pt}58-}59-60-\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}68-69-\ChNameVar{\raggedleft\normalsize}70-\ChNumVar{\raggedleft \bfseries\Large}71-\ChTitleVar{\raggedleft \rm\Huge}72-73-\renewcommand\thepart{\@Roman\c@part}74-\renewcommand\part{%75- \pagestyle{plain}76- \if@noskipsec \leavevmode \fi77- \cleardoublepage78- \vspace*{6cm}%79- \@afterindentfalse80- \secdef\@part\@spart}81-82-\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}109-110-% use inconsolata font111-\usepackage{inconsolata}112-113-% fix single quotes, for inconsolata. (does not work)114-%%\usepackage{textcomp}115-%%\begingroup116-%% \catcode`'=\active117-%% \g@addto@macro\@noligs{\let'\textsinglequote}118-%% \endgroup119-%%\endinputdeleted:docs/latexindex.rst-6 removed
1-:orphan:2-3-Jinja2 Documentation4-====================5-6-.. include:: contents.rst.incdeleted:docs/logo.pdfbinary
A binary file, deleted.
added:docs/make.bat+35 added
1+@ECHO OFF2+3+pushd %~dp04+5+REM Command file for Sphinx documentation6+7+if "%SPHINXBUILD%" == "" (8+ set SPHINXBUILD=sphinx-build9+)10+set SOURCEDIR=.11+set BUILDDIR=_build12+13+if "%1" == "" goto help14+15+%SPHINXBUILD% >NUL 2>NUL16+if 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+)27+28+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%29+goto end30+31+:help32+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%33+34+:end35+popdmodified:docs/Makefile+9 added-108 removed
1-# Makefile for Sphinx documentation1+# Minimal makefile for Sphinx documentation2 #3 4 # You can set these variables from the command line.5 SPHINXOPTS =6 SPHINXBUILD = sphinx-build7-PAPER =7+SOURCEDIR = .8 BUILDDIR = _build9 10-# Internal variables.11-PAPEROPT_a4 = -D latex_paper_size=a412-PAPEROPT_letter = -D latex_paper_size=letter13-ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .14-15-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp epub latex changes linkcheck doctest16-10+# Put it first so that "make" without argument is like "make help".11 help: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)13 34-clean:35- -rm -rf $(BUILDDIR)/*14+.PHONY: help Makefile15 37-html:38- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html39- @echo40- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."41-42-dirhtml:43- $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml44- @echo45- @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."46-47-singlehtml:48- $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml49- @echo50- @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."51-52-pickle:53- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle54- @echo55- @echo "Build finished; now you can process the pickle files."56-57-json:58- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json59- @echo60- @echo "Build finished; now you can process the JSON files."61-62-htmlhelp: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."67-68-qthelp: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"76-77-devhelp: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"85-86-epub:87- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub88- @echo89- @echo "Build finished. The epub file is in $(BUILDDIR)/epub."90-91-latex: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."97-98-latexpdf: 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."103-104-changes:105- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes106- @echo107- @echo "The overview file is in $(BUILDDIR)/changes."108-109-linkcheck: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."114-115-doctest: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
1+Sphinx~=2.1.22+Pallets-Sphinx-Themes~=1.2.03+sphinxcontrib-log-cabinet~=1.0.14+sphinx-issues~=1.2.0modified:docs/templates.rst+9 added-8 removed
195 unmodified lines196 197 gets rendered with blank lines inside the div::198 199 <div>200- 200+201 yay202- 202+203 </div>204 205 But with both `trim_blocks` and `lstrip_blocks` enabled, the template block206 lines are removed and other whitespace is preserved::207- 207+208 <div>209 yay210 </div>211 309 unmodified lines521 Working with Automatic Escaping522 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~523 524 When automatic escaping is enabled, everything is escaped by default except525-for values explicitly marked as safe. Variables and expressions 525+for values explicitly marked as safe. Variables and expressions526 can be marked as safe either in:527 528 a. the context dictionary by the application with `MarkupSafe.Markup`, or529 b. the template, with the `|safe` filter530- 530+531 The main problem with this approach is that Python itself doesn't have the532 concept of tainted values; so whether a value is safe or unsafe can get lost.533 534 If a value is not marked safe, auto-escaping will take place; which means that713 unmodified lines1248 1249 The `else` part is optional. If not provided, the else block implicitly1250 evaluates into an undefined object::1251 1252- {{ '[%s]' % page.title if page.title }}1252+ {{ "[{}]".format(page.title) if page.title }}1253 1254 1255 .. _builtin-filters:1256 1257 List of Builtin Filters1258 -----------------------1259 1260-.. jinjafilters::1260+.. jinja:filters:: jinja2.defaults.DEFAULT_FILTERS1261 1262 1263 .. _builtin-tests:1264 1265 List of Builtin Tests1266 ---------------------1267 1268-.. jinjatests::1268+.. jinja:tests:: jinja2.defaults.DEFAULT_TESTS1269 1270+1271 .. _builtin-globals:1272 1273 List of Global Functions1274 ------------------------293 unmodified linesmodified:jinja2/lexer.py+4 added-1 removed
350 unmodified lines351 """Like :meth:`next_if` but only returns `True` or `False`."""352 return self.next_if(expr) is not None353 354 def __next__(self):355- """Go one token ahead and return the old one"""355+ """Go one token ahead and return the old one.356+357+ Use Python's :func:`next` rather than calling this directly.358+ """359 rv = self.current360 if self._pushed:361 self.current = self._pushed.popleft()362 elif self.current.type is not TOKEN_EOF:378 unmodified linesmodified:scripts/make-release.py+1 added-1 removed
23 unmodified lines24 _date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')25 26 27 def parse_changelog():28- with open('CHANGES') as f:28+ with open('CHANGES.rst') as f:29 lineiter = iter(f)30 for line in lineiter:31 match = re.search('^Version\s+(.*)', line.strip())32 if match is None:132 unmodified linesdeleted:CHANGES-525 removed
1-Jinja2 Changelog2-================3-4-Version 2.9.75--------------6-7-(bugfix release, in development)8-9-- ``tojson`` filter marks output as safe to match documented behavior.10- (`#718`_)11-- Resolved a bug where getting debug locals for tracebacks could12- modify template context.13-- Fixed a bug where having many `{% elif ... %}` blocks resulted in a14- "too many levels of indentation" error. These blocks now compile to15- native `elif ..:` instead of `else: if ..:` (#759)16-17-.. _#718: https://github.com/pallets/jinja/pull/71818-19-Version 2.9.620--------------21-(bugfix release, released on April 3rd 2017)22-23-- Fixed custom context behavior in fast resolve mode (#675)24-25-Version 2.9.526--------------27-(bugfix release, released on January 28th 2017)28-29-- Restored the original repr of the internal `_GroupTuple` because this30- caused issues with ansible and it was an unintended change. (#654)31-- Added back support for custom contexts that override the old `resolve`32- method since it was hard for people to spot that this could cause a33- regression.34-- Correctly use the buffer for the else block of for loops. This caused35- invalid syntax errors to be caused on 2.x and completely wrong behavior36- on Python 3 (#669)37-- Resolve an issue where the `{% extends %}` tag could not be used with38- async environments. (#668)39-- Reduce memory footprint slightly by reducing our unicode database dump40- we use for identifier matching on Python 3 (#666)41-- Fixed autoescaping not working for macros in async compilation mode. (#671)42-43-Version 2.9.444--------------45-(bugfix release, released on January 10th 2017)46-47-- Solved some warnings for string literals. (#646)48-- Increment the bytecode cache version which was not done due to an49- oversight before.50-- Corrected bad code generation and scoping for filtered loops. (#649)51-- Resolved an issue where top-level output silencing after known extend52- blocks could generate invalid code when blocks where contained in if53- statements. (#651)54-- Made the `truncate.leeway` default configurable to improve compatibility55- with older templates.56-57-Version 2.9.358--------------59-(bugfix release, released on January 8th 2017)60-61-- Restored the use of blocks in macros to the extend that was possible62- before. On Python 3 it would render a generator repr instead of63- the block contents. (#645)64-- Set a consistent behavior for assigning of variables in inner scopes65- when the variable is also read from an outer scope. This now sets the66- intended behavior in all situations however it does not restore the67- old behavior where limited assignments to outer scopes was possible.68- For more information and a discussion see #64169-- Resolved an issue where `block scoped` would not take advantage of the70- new scoping rules. In some more exotic cases a variable overriden in a71- local scope would not make it into a block.72-- Change the code generation of the `with` statement to be in line with the73- new scoping rules. This resolves some unlikely bugs in edge cases. This74- also introduces a new internal `With` node that can be used by extensions.75-76-Version 2.9.277--------------78-(bugfix release, released on January 8th 2017)79-80-- Fixed a regression that caused for loops to not be able to use the same81- variable for the target as well as source iterator. (#640)82-- Add support for a previously unknown behavior of macros. It used to be83- possible in some circumstances to explicitly provide a caller argument84- to macros. While badly buggy and unintended it turns out that this is a85- common case that gets copy pasted around. To not completely break backwards86- compatibility with the most common cases it's now possible to provide an87- explicit keyword argument for caller if it's given an explicit default.88- (#642)89-90-Version 2.9.191--------------92-(bugfix release, released on January 7th 2017)93-94-- Resolved a regression with call block scoping for macros. Nested caller95- blocks that used the same identifiers as outer macros could refer to the96- wrong variable incorrectly.97-98-Version 2.999------------100-(codename Derivation, released on January 7th 2017)101-102-- Change cache key definition in environment. This fixes a performance103- regression introduced in 2.8.104-- Added support for `generator_stop` on supported Python versions105- (Python 3.5 and later)106-- Corrected a long standing issue with operator precedence of math operations107- not being what was expected.108-- Added support for Python 3.6 async iterators through a new async mode.109-- Added policies for filter defaults and similar things.110-- urlize now sets "rel noopener" by default.111-- Support attribute fallback for old-style classes in 2.x.112-- Support toplevel set statements in extend situations.113-- Restored behavior of Cycler for Python 3 users.114-- Subtraction now follows the same behavior as other operators on undefined115- values.116-- `map` and friends will now give better error messages if you forgot to117- quote the parameter.118-- Depend on MarkupSafe 0.23 or higher.119-- Improved the `truncate` filter to support better truncation in case120- the string is barely truncated at all.121-- Change the logic for macro autoescaping to be based on the runtime122- autoescaping information at call time instead of macro define time.123-- Ported a modified version of the `tojson` filter from Flask to Jinja2124- and hooked it up with the new policy framework.125-- Block sets are now marked `safe` by default.126-- On Python 2 the asciification of ASCII strings can now be disabled with127- the `compiler.ascii_str` policy.128-- Tests now no longer accept an arbitrary expression as first argument but129- a restricted one. This means that you can now properly use multiple130- tests in one expression without extra parentheses. In particular you can131- now write ``foo is divisibleby 2 or foo is divisibleby 3``132- as you would expect.133-- Greatly changed the scoping system to be more consistent with what template134- designers and developers expect. There is now no more magic difference135- between the different include and import constructs. Context is now always136- propagated the same way. The only remaining differences is the defaults137- for `with context` and `without context`.138-- The `with` and `autoescape` tags are now built-in.139-- Added the new `select_autoescape` function which helps configuring better140- autoescaping easier.141-142-Version 2.8.2143--------------144-145-(bugfix release, unreleased)146-147-- Fixed a runtime error in the sandbox when attributes of async generators148- were accessed.149-150-Version 2.8.1151--------------152-153-(bugfix release, released on December 29th 2016)154-155-- Fixed the `for_qs` flag for `urlencode`.156-- Fixed regression when applying `int` to non-string values.157-- SECURITY: if the sandbox mode is used format expressions are now sandboxed158- with the same rules as in Jinja. This solves various information leakage159- problems that can occur with format strings.160-161-Version 2.8162------------163-(codename Replacement, released on July 26th 2015)164-165-- Added `target` parameter to urlize function.166-- Added support for `followsymlinks` to the file system loader.167-- The truncate filter now counts the length.168-- Added equalto filter that helps with select filters.169-- Changed cache keys to use absolute file names if available170- instead of load names.171-- Fixed loop length calculation for some iterators.172-- Changed how Jinja2 enforces strings to be native strings in173- Python 2 to work when people break their default encoding.174-- Added :func:`make_logging_undefined` which returns an undefined175- object that logs failures into a logger.176-- If unmarshalling of cached data fails the template will be177- reloaded now.178-- Implemented a block ``set`` tag.179-- Default cache size was increased to 400 from a low 50.180-- Fixed ``is number`` test to accept long integers in all Python versions.181-- Changed ``is number`` to accept Decimal as a number.182-- Added a check for default arguments followed by non-default arguments. This183- change makes ``{% macro m(x, y=1, z) %}...{% endmacro %}`` a syntax error. The184- previous behavior for this code was broken anyway (resulting in the default185- value being applied to `y`).186-- Add ability to use custom subclasses of ``jinja2.compiler.CodeGenerator`` and187- ``jinja2.runtime.Context`` by adding two new attributes to the environment188- (`code_generator_class` and `context_class`) (pull request ``#404``).189-- added support for context/environment/evalctx decorator functions on190- the finalize callback of the environment.191-- escape query strings for urlencode properly. Previously slashes were not192- escaped in that place.193-- Add 'base' parameter to 'int' filter.194-195-Version 2.7.3196--------------197-(bugfix release, released on June 6th 2014)198-199-- Security issue: Corrected the security fix for the cache folder. This200- fix was provided by RedHat.201-202-Version 2.7.2203--------------204-(bugfix release, released on January 10th 2014)205-206-- Prefix loader was not forwarding the locals properly to207- inner loaders. This is now fixed.208-- Security issue: Changed the default folder for the filesystem cache to be209- user specific and read and write protected on UNIX systems. See `Debian bug210- 734747`_ for more information.211-212-.. _Debian bug 734747: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747213-214-Version 2.7.1215--------------216-(bugfix release, released on August 7th 2013)217-218-- Fixed a bug with ``call_filter`` not working properly on environment219- and context filters.220-- Fixed lack of Python 3 support for bytecode caches.221-- Reverted support for defining blocks in included templates as this222- broke existing templates for users.223-- Fixed some warnings with hashing of undefineds and nodes if Python224- is run with warnings for Python 3.225-- Added support for properly hashing undefined objects.226-- Fixed a bug with the title filter not working on already uppercase227- strings.228-229-Version 2.7230------------231-(codename Translation, released on May 20th 2013)232-233-- Choice and prefix loaders now dispatch source and template lookup234- separately in order to work in combination with module loaders as235- advertised.236-- Fixed filesizeformat.237-- Added a non-silent option for babel extraction.238-- Added `urlencode` filter that automatically quotes values for239- URL safe usage with utf-8 as only supported encoding. If applications240- want to change this encoding they can override the filter.241-- Added `keep-trailing-newline` configuration to environments and242- templates to optionally preserve the final trailing newline.243-- Accessing `last` on the loop context no longer causes the iterator244- to be consumed into a list.245-- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,246- supported by same source code, using the "six" compatibility library.247-- Allow `contextfunction` and other decorators to be applied to `__call__`.248-- Added support for changing from newline to different signs in the `wordwrap`249- filter.250-- Added support for ignoring memcache errors silently.251-- Added support for keeping the trailing newline in templates.252-- Added finer grained support for stripping whitespace on the left side253- of blocks.254-- Added `map`, `select`, `reject`, `selectattr` and `rejectattr`255- filters.256-- Added support for `loop.depth` to figure out how deep inside a recursive257- loop the code is.258-- Disabled py_compile for pypy and python 3.259-260-Version 2.6261------------262-(codename Convolution, released on July 24th 2011)263-264-- internal attributes now raise an internal attribute error now instead265- of returning an undefined. This fixes problems when passing undefined266- objects to Python semantics expecting APIs.267-- traceback support now works properly for PyPy. (Tested with 1.4)268-- implemented operator intercepting for sandboxed environments. This269- allows application developers to disable builtin operators for better270- security. (For instance limit the mathematical operators to actual271- integers instead of longs)272-- groupby filter now supports dotted notation for grouping by attributes273- of attributes.274-- scoped blocks now properly treat toplevel assignments and imports.275- Previously an import suddenly "disappeared" in a scoped block.276-- automatically detect newer Python interpreter versions before loading code277- from bytecode caches to prevent segfaults on invalid opcodes. The segfault278- in earlier Jinja2 versions here was not a Jinja2 bug but a limitation in279- the underlying Python interpreter. If you notice Jinja2 segfaulting in280- earlier versions after an upgrade of the Python interpreter you don't have281- to upgrade, it's enough to flush the bytecode cache. This just no longer282- makes this necessary, Jinja2 will automatically detect these cases now.283-- the sum filter can now sum up values by attribute. This is a backwards284- incompatible change. The argument to the filter previously was the285- optional starting index which defaults to zero. This now became the286- second argument to the function because it's rarely used.287-- like sum, sort now also makes it possible to order items by attribute.288-- like sum and sort, join now also is able to join attributes of objects289- as string.290-- the internal eval context now has a reference to the environment.291-- added a mapping test to see if an object is a dict or an object with292- a similar interface.293-294-Version 2.5.5295--------------296-(re-release of 2.5.4 with built documentation removed for filesize.297- Released on October 18th 2010)298-299-- built documentation is no longer part of release.300-301-Version 2.5.4302--------------303-(bugfix release, released on October 17th 2010)304-305-- Fixed extensions not loading properly with overlays.306-- Work around a bug in cpython for the debugger that causes segfaults307- on 64bit big-endian architectures.308-309-Version 2.5.3310--------------311-(bugfix release, released on October 17th 2010)312-313-- fixed an operator precedence error introduced in 2.5.2. Statements314- like "-foo.bar" had their implicit parentheses applied around the315- first part of the expression ("(-foo).bar") instead of the more316- correct "-(foo.bar)".317-318-Version 2.5.2319--------------320-(bugfix release, released on August 18th 2010)321-322-- improved setup.py script to better work with assumptions people323- might still have from it (``--with-speedups``).324-- fixed a packaging error that excluded the new debug support.325-326-Version 2.5.1327--------------328-(bugfix release, released on August 17th 2010)329-330-- StopIteration exceptions raised by functions called from templates331- are now intercepted and converted to undefineds. This solves a332- lot of debugging grief. (StopIteration is used internally to333- abort template execution)334-- improved performance of macro calls slightly.335-- babel extraction can now properly extract newstyle gettext calls.336-- using the variable `num` in newstyle gettext for something else337- than the pluralize count will no longer raise a :exc:`KeyError`.338-- removed builtin markup class and switched to markupsafe. For backwards339- compatibility the pure Python implementation still exists but is340- pulled from markupsafe by the Jinja2 developers. The debug support341- went into a separate feature called "debugsupport" and is disabled342- by default because it is only relevant for Python 2.4343-- fixed an issue with unary operators having the wrong precedence.344-345-Version 2.5346------------347-(codename Incoherence, released on May 29th 2010)348-349-- improved the sort filter (should have worked like this for a350- long time) by adding support for case insensitive searches.351-- fixed a bug for getattribute constant folding.352-- support for newstyle gettext translations which result in a353- nicer in-template user interface and more consistent354- catalogs. (:ref:`newstyle-gettext`)355-- it's now possible to register extensions after an environment356- was created.357-358-Version 2.4.1359--------------360-(bugfix release, released on April 20th 2010)361-362-- fixed an error reporting bug for undefineds.363-364-Version 2.4365------------366-(codename Correlation, released on April 13th 2010)367-368-- the environment template loading functions now transparently369- pass through a template object if it was passed to it. This370- makes it possible to import or extend from a template object371- that was passed to the template.372-- added a :class:`ModuleLoader` that can load templates from373- precompiled sources. The environment now features a method374- to compile the templates from a configured loader into a zip375- file or folder.376-- the _speedups C extension now supports Python 3.377-- added support for autoescaping toggling sections and support378- for evaluation contexts (:ref:`eval-context`).379-- extensions have a priority now.380-381-Version 2.3.1382--------------383-(bugfix release, released on February 19th 2010)384-385-- fixed an error reporting bug on all python versions386-- fixed an error reporting bug on Python 2.4387-388-Version 2.3389------------390-(3000 Pythons, released on February 10th 2010)391-392-- fixes issue with code generator that causes unbound variables393- to be generated if set was used in if-blocks and other small394- identifier problems.395-- include tags are now able to select between multiple templates396- and take the first that exists, if a list of templates is397- given.398-- fixed a problem with having call blocks in outer scopes that399- have an argument that is also used as local variable in an400- inner frame (#360).401-- greatly improved error message reporting (#339)402-- implicit tuple expressions can no longer be totally empty.403- This change makes ``{% if %}...{% endif %}`` a syntax error404- now. (#364)405-- added support for translator comments if extracted via babel.406-- added with-statement extension.407-- experimental Python 3 support.408-409-Version 2.2.1410--------------411-(bugfix release, released on September 14th 2009)412-413-- fixes some smaller problems for Jinja2 on Jython.414-415-Version 2.2416------------417-(codename Kong, released on September 13th 2009)418-419-- Include statements can now be marked with ``ignore missing`` to skip420- non existing templates.421-- Priority of `not` raised. It's now possible to write `not foo in bar`422- as an alias to `foo not in bar` like in python. Previously the grammar423- required parentheses (`not (foo in bar)`) which was odd.424-- Fixed a bug that caused syntax errors when defining macros or using the425- `{% call %}` tag inside loops.426-- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.427-- Made it possible to refer to names from outer scopes in included templates428- that were unused in the callers frame (#327)429-- Fixed a bug that caused internal errors if names where used as iteration430- variable and regular variable *after* the loop if that variable was unused431- *before* the loop. (#331)432-- Added support for optional `scoped` modifier to blocks.433-- Added support for line-comments.434-- Added the `meta` module.435-- Renamed (undocumented) attribute "overlay" to "overlayed" on the436- environment because it was clashing with a method of the same name.437-- speedup extension is now disabled by default.438-439-Version 2.1.1440--------------441-(Bugfix release)442-443-- Fixed a translation error caused by looping over empty recursive loops.444-445-Version 2.1446------------447-(codename Yasuzō, released on November 23rd 2008)448-449-- fixed a bug with nested loops and the special loop variable. Before the450- change an inner loop overwrote the loop variable from the outer one after451- iteration.452-453-- fixed a bug with the i18n extension that caused the explicit pluralization454- block to look up the wrong variable.455-456-- fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` impossible.457-458-- index based subscribing of variables with a constant value returns an459- undefined object now instead of raising an index error. This was a bug460- caused by eager optimizing.461-462-- the i18n extension looks up `foo.ugettext` now followed by `foo.gettext`463- if an translations object is installed. This makes dealing with custom464- translations classes easier.465-466-- fixed a confusing behavior with conditional extending. loops were partially467- executed under some conditions even though they were not part of a visible468- area.469-470-- added `sort` filter that works like `dictsort` but for arbitrary sequences.471-472-- fixed a bug with empty statements in macros.473-474-- implemented a bytecode cache system. (:ref:`bytecode-cache`)475-476-- the template context is now weakref-able477-478-- inclusions and imports "with context" forward all variables now, not only479- the initial context.480-481-- added a cycle helper called `cycler`.482-483-- added a joining helper called `joiner`.484-485-- added a `compile_expression` method to the environment that allows compiling486- of Jinja expressions into callable Python objects.487-488-- fixed an escaping bug in urlize489-490-Version 2.0491------------492-(codename jinjavitus, released on July 17th 2008)493-494-- the subscribing of objects (looking up attributes and items) changed from495- slightly. It's now possible to give attributes or items a higher priority496- by either using dot-notation lookup or the bracket syntax. This also497- changed the AST slightly. `Subscript` is gone and was replaced with498- :class:`~jinja2.nodes.Getitem` and :class:`~jinja2.nodes.Getattr`.499-500- For more information see :ref:`the implementation details <notes-on-subscriptions>`.501-502-- added support for preprocessing and token stream filtering for extensions.503- This would allow extensions to allow simplified gettext calls in template504- data and something similar.505-506-- added :meth:`jinja2.environment.TemplateStream.dump`.507-508-- added missing support for implicit string literal concatenation.509- ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``510-511-- `else` is optional for conditional expressions. If not given it evaluates512- to `false`.513-514-- improved error reporting for undefined values by providing a position.515-516-- `filesizeformat` filter uses decimal prefixes now per default and can be517- set to binary mode with the second parameter.518-519-- fixed bug in finalizer520-521-Version 2.0rc1522---------------523-(no codename, released on June 9th 2008)524-525-- first release of Jinja2added:CHANGES.rst+524 added
1+.. currentmodule:: jinja22+3+Version 2.9.74+-------------5+6+(bugfix release, in development)7+8+- ``tojson`` filter marks output as safe to match documented behavior.9+ (`#718`_)10+- Resolved a bug where getting debug locals for tracebacks could11+ modify template context.12+- Fixed a bug where having many `{% elif ... %}` blocks resulted in a13+ "too many levels of indentation" error. These blocks now compile to14+ native `elif ..:` instead of `else: if ..:` (#759)15+16+.. _#718: https://github.com/pallets/jinja/pull/71817+18+Version 2.9.619+-------------20+(bugfix release, released on April 3rd 2017)21+22+- Fixed custom context behavior in fast resolve mode (#675)23+24+Version 2.9.525+-------------26+(bugfix release, released on January 28th 2017)27+28+- Restored the original repr of the internal `_GroupTuple` because this29+ caused issues with ansible and it was an unintended change. (#654)30+- Added back support for custom contexts that override the old `resolve`31+ method since it was hard for people to spot that this could cause a32+ regression.33+- Correctly use the buffer for the else block of for loops. This caused34+ invalid syntax errors to be caused on 2.x and completely wrong behavior35+ on Python 3 (#669)36+- Resolve an issue where the `{% extends %}` tag could not be used with37+ async environments. (#668)38+- Reduce memory footprint slightly by reducing our unicode database dump39+ we use for identifier matching on Python 3 (#666)40+- Fixed autoescaping not working for macros in async compilation mode. (#671)41+42+Version 2.9.443+-------------44+(bugfix release, released on January 10th 2017)45+46+- Solved some warnings for string literals. (#646)47+- Increment the bytecode cache version which was not done due to an48+ oversight before.49+- Corrected bad code generation and scoping for filtered loops. (#649)50+- Resolved an issue where top-level output silencing after known extend51+ blocks could generate invalid code when blocks where contained in if52+ statements. (#651)53+- Made the `truncate.leeway` default configurable to improve compatibility54+ with older templates.55+56+Version 2.9.357+-------------58+(bugfix release, released on January 8th 2017)59+60+- Restored the use of blocks in macros to the extend that was possible61+ before. On Python 3 it would render a generator repr instead of62+ the block contents. (#645)63+- Set a consistent behavior for assigning of variables in inner scopes64+ when the variable is also read from an outer scope. This now sets the65+ intended behavior in all situations however it does not restore the66+ old behavior where limited assignments to outer scopes was possible.67+ For more information and a discussion see #64168+- Resolved an issue where `block scoped` would not take advantage of the69+ new scoping rules. In some more exotic cases a variable overriden in a70+ local scope would not make it into a block.71+- Change the code generation of the `with` statement to be in line with the72+ new scoping rules. This resolves some unlikely bugs in edge cases. This73+ also introduces a new internal `With` node that can be used by extensions.74+75+Version 2.9.276+-------------77+(bugfix release, released on January 8th 2017)78+79+- Fixed a regression that caused for loops to not be able to use the same80+ variable for the target as well as source iterator. (#640)81+- Add support for a previously unknown behavior of macros. It used to be82+ possible in some circumstances to explicitly provide a caller argument83+ to macros. While badly buggy and unintended it turns out that this is a84+ common case that gets copy pasted around. To not completely break backwards85+ compatibility with the most common cases it's now possible to provide an86+ explicit keyword argument for caller if it's given an explicit default.87+ (#642)88+89+Version 2.9.190+-------------91+(bugfix release, released on January 7th 2017)92+93+- Resolved a regression with call block scoping for macros. Nested caller94+ blocks that used the same identifiers as outer macros could refer to the95+ wrong variable incorrectly.96+97+Version 2.998+-----------99+(codename Derivation, released on January 7th 2017)100+101+- Change cache key definition in environment. This fixes a performance102+ regression introduced in 2.8.103+- Added support for `generator_stop` on supported Python versions104+ (Python 3.5 and later)105+- Corrected a long standing issue with operator precedence of math operations106+ not being what was expected.107+- Added support for Python 3.6 async iterators through a new async mode.108+- Added policies for filter defaults and similar things.109+- urlize now sets "rel noopener" by default.110+- Support attribute fallback for old-style classes in 2.x.111+- Support toplevel set statements in extend situations.112+- Restored behavior of Cycler for Python 3 users.113+- Subtraction now follows the same behavior as other operators on undefined114+ values.115+- `map` and friends will now give better error messages if you forgot to116+ quote the parameter.117+- Depend on MarkupSafe 0.23 or higher.118+- Improved the `truncate` filter to support better truncation in case119+ the string is barely truncated at all.120+- Change the logic for macro autoescaping to be based on the runtime121+ autoescaping information at call time instead of macro define time.122+- Ported a modified version of the `tojson` filter from Flask to Jinja2123+ and hooked it up with the new policy framework.124+- Block sets are now marked `safe` by default.125+- On Python 2 the asciification of ASCII strings can now be disabled with126+ the `compiler.ascii_str` policy.127+- Tests now no longer accept an arbitrary expression as first argument but128+ a restricted one. This means that you can now properly use multiple129+ tests in one expression without extra parentheses. In particular you can130+ now write ``foo is divisibleby 2 or foo is divisibleby 3``131+ as you would expect.132+- Greatly changed the scoping system to be more consistent with what template133+ designers and developers expect. There is now no more magic difference134+ between the different include and import constructs. Context is now always135+ propagated the same way. The only remaining differences is the defaults136+ for `with context` and `without context`.137+- The `with` and `autoescape` tags are now built-in.138+- Added the new `select_autoescape` function which helps configuring better139+ autoescaping easier.140+141+Version 2.8.2142+-------------143+144+(bugfix release, unreleased)145+146+- Fixed a runtime error in the sandbox when attributes of async generators147+ were accessed.148+149+Version 2.8.1150+-------------151+152+(bugfix release, released on December 29th 2016)153+154+- Fixed the `for_qs` flag for `urlencode`.155+- Fixed regression when applying `int` to non-string values.156+- SECURITY: if the sandbox mode is used format expressions are now sandboxed157+ with the same rules as in Jinja. This solves various information leakage158+ problems that can occur with format strings.159+160+Version 2.8161+-----------162+(codename Replacement, released on July 26th 2015)163+164+- Added `target` parameter to urlize function.165+- Added support for `followsymlinks` to the file system loader.166+- The truncate filter now counts the length.167+- Added equalto filter that helps with select filters.168+- Changed cache keys to use absolute file names if available169+ instead of load names.170+- Fixed loop length calculation for some iterators.171+- Changed how Jinja2 enforces strings to be native strings in172+ Python 2 to work when people break their default encoding.173+- Added :func:`make_logging_undefined` which returns an undefined174+ object that logs failures into a logger.175+- If unmarshalling of cached data fails the template will be176+ reloaded now.177+- Implemented a block ``set`` tag.178+- Default cache size was increased to 400 from a low 50.179+- Fixed ``is number`` test to accept long integers in all Python versions.180+- Changed ``is number`` to accept Decimal as a number.181+- Added a check for default arguments followed by non-default arguments. This182+ change makes ``{% macro m(x, y=1, z) %}...{% endmacro %}`` a syntax error. The183+ previous behavior for this code was broken anyway (resulting in the default184+ value being applied to `y`).185+- Add ability to use custom subclasses of ``jinja2.compiler.CodeGenerator`` and186+ ``jinja2.runtime.Context`` by adding two new attributes to the environment187+ (`code_generator_class` and `context_class`) (pull request ``#404``).188+- added support for context/environment/evalctx decorator functions on189+ the finalize callback of the environment.190+- escape query strings for urlencode properly. Previously slashes were not191+ escaped in that place.192+- Add 'base' parameter to 'int' filter.193+194+Version 2.7.3195+-------------196+(bugfix release, released on June 6th 2014)197+198+- Security issue: Corrected the security fix for the cache folder. This199+ fix was provided by RedHat.200+201+Version 2.7.2202+-------------203+(bugfix release, released on January 10th 2014)204+205+- Prefix loader was not forwarding the locals properly to206+ inner loaders. This is now fixed.207+- Security issue: Changed the default folder for the filesystem cache to be208+ user specific and read and write protected on UNIX systems. See `Debian bug209+ 734747`_ for more information.210+211+.. _Debian bug 734747: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747212+213+Version 2.7.1214+-------------215+(bugfix release, released on August 7th 2013)216+217+- Fixed a bug with ``call_filter`` not working properly on environment218+ and context filters.219+- Fixed lack of Python 3 support for bytecode caches.220+- Reverted support for defining blocks in included templates as this221+ broke existing templates for users.222+- Fixed some warnings with hashing of undefineds and nodes if Python223+ is run with warnings for Python 3.224+- Added support for properly hashing undefined objects.225+- Fixed a bug with the title filter not working on already uppercase226+ strings.227+228+Version 2.7229+-----------230+(codename Translation, released on May 20th 2013)231+232+- Choice and prefix loaders now dispatch source and template lookup233+ separately in order to work in combination with module loaders as234+ advertised.235+- Fixed filesizeformat.236+- Added a non-silent option for babel extraction.237+- Added `urlencode` filter that automatically quotes values for238+ URL safe usage with utf-8 as only supported encoding. If applications239+ want to change this encoding they can override the filter.240+- Added `keep-trailing-newline` configuration to environments and241+ templates to optionally preserve the final trailing newline.242+- Accessing `last` on the loop context no longer causes the iterator243+ to be consumed into a list.244+- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,245+ supported by same source code, using the "six" compatibility library.246+- Allow `contextfunction` and other decorators to be applied to `__call__`.247+- Added support for changing from newline to different signs in the `wordwrap`248+ filter.249+- Added support for ignoring memcache errors silently.250+- Added support for keeping the trailing newline in templates.251+- Added finer grained support for stripping whitespace on the left side252+ of blocks.253+- Added `map`, `select`, `reject`, `selectattr` and `rejectattr`254+ filters.255+- Added support for `loop.depth` to figure out how deep inside a recursive256+ loop the code is.257+- Disabled py_compile for pypy and python 3.258+259+Version 2.6260+-----------261+(codename Convolution, released on July 24th 2011)262+263+- internal attributes now raise an internal attribute error now instead264+ of returning an undefined. This fixes problems when passing undefined265+ objects to Python semantics expecting APIs.266+- traceback support now works properly for PyPy. (Tested with 1.4)267+- implemented operator intercepting for sandboxed environments. This268+ allows application developers to disable builtin operators for better269+ security. (For instance limit the mathematical operators to actual270+ integers instead of longs)271+- groupby filter now supports dotted notation for grouping by attributes272+ of attributes.273+- scoped blocks now properly treat toplevel assignments and imports.274+ Previously an import suddenly "disappeared" in a scoped block.275+- automatically detect newer Python interpreter versions before loading code276+ from bytecode caches to prevent segfaults on invalid opcodes. The segfault277+ in earlier Jinja2 versions here was not a Jinja2 bug but a limitation in278+ the underlying Python interpreter. If you notice Jinja2 segfaulting in279+ earlier versions after an upgrade of the Python interpreter you don't have280+ to upgrade, it's enough to flush the bytecode cache. This just no longer281+ makes this necessary, Jinja2 will automatically detect these cases now.282+- the sum filter can now sum up values by attribute. This is a backwards283+ incompatible change. The argument to the filter previously was the284+ optional starting index which defaults to zero. This now became the285+ second argument to the function because it's rarely used.286+- like sum, sort now also makes it possible to order items by attribute.287+- like sum and sort, join now also is able to join attributes of objects288+ as string.289+- the internal eval context now has a reference to the environment.290+- added a mapping test to see if an object is a dict or an object with291+ a similar interface.292+293+Version 2.5.5294+-------------295+(re-release of 2.5.4 with built documentation removed for filesize.296+ Released on October 18th 2010)297+298+- built documentation is no longer part of release.299+300+Version 2.5.4301+-------------302+(bugfix release, released on October 17th 2010)303+304+- Fixed extensions not loading properly with overlays.305+- Work around a bug in cpython for the debugger that causes segfaults306+ on 64bit big-endian architectures.307+308+Version 2.5.3309+-------------310+(bugfix release, released on October 17th 2010)311+312+- fixed an operator precedence error introduced in 2.5.2. Statements313+ like "-foo.bar" had their implicit parentheses applied around the314+ first part of the expression ("(-foo).bar") instead of the more315+ correct "-(foo.bar)".316+317+Version 2.5.2318+-------------319+(bugfix release, released on August 18th 2010)320+321+- improved setup.py script to better work with assumptions people322+ might still have from it (``--with-speedups``).323+- fixed a packaging error that excluded the new debug support.324+325+Version 2.5.1326+-------------327+(bugfix release, released on August 17th 2010)328+329+- StopIteration exceptions raised by functions called from templates330+ are now intercepted and converted to undefineds. This solves a331+ lot of debugging grief. (StopIteration is used internally to332+ abort template execution)333+- improved performance of macro calls slightly.334+- babel extraction can now properly extract newstyle gettext calls.335+- using the variable `num` in newstyle gettext for something else336+ than the pluralize count will no longer raise a :exc:`KeyError`.337+- removed builtin markup class and switched to markupsafe. For backwards338+ compatibility the pure Python implementation still exists but is339+ pulled from markupsafe by the Jinja2 developers. The debug support340+ went into a separate feature called "debugsupport" and is disabled341+ by default because it is only relevant for Python 2.4342+- fixed an issue with unary operators having the wrong precedence.343+344+Version 2.5345+-----------346+(codename Incoherence, released on May 29th 2010)347+348+- improved the sort filter (should have worked like this for a349+ long time) by adding support for case insensitive searches.350+- fixed a bug for getattribute constant folding.351+- support for newstyle gettext translations which result in a352+ nicer in-template user interface and more consistent353+ catalogs. (:ref:`newstyle-gettext`)354+- it's now possible to register extensions after an environment355+ was created.356+357+Version 2.4.1358+-------------359+(bugfix release, released on April 20th 2010)360+361+- fixed an error reporting bug for undefineds.362+363+Version 2.4364+-----------365+(codename Correlation, released on April 13th 2010)366+367+- the environment template loading functions now transparently368+ pass through a template object if it was passed to it. This369+ makes it possible to import or extend from a template object370+ that was passed to the template.371+- added a :class:`ModuleLoader` that can load templates from372+ precompiled sources. The environment now features a method373+ to compile the templates from a configured loader into a zip374+ file or folder.375+- the _speedups C extension now supports Python 3.376+- added support for autoescaping toggling sections and support377+ for evaluation contexts (:ref:`eval-context`).378+- extensions have a priority now.379+380+Version 2.3.1381+-------------382+(bugfix release, released on February 19th 2010)383+384+- fixed an error reporting bug on all python versions385+- fixed an error reporting bug on Python 2.4386+387+Version 2.3388+-----------389+(3000 Pythons, released on February 10th 2010)390+391+- fixes issue with code generator that causes unbound variables392+ to be generated if set was used in if-blocks and other small393+ identifier problems.394+- include tags are now able to select between multiple templates395+ and take the first that exists, if a list of templates is396+ given.397+- fixed a problem with having call blocks in outer scopes that398+ have an argument that is also used as local variable in an399+ inner frame (#360).400+- greatly improved error message reporting (#339)401+- implicit tuple expressions can no longer be totally empty.402+ This change makes ``{% if %}...{% endif %}`` a syntax error403+ now. (#364)404+- added support for translator comments if extracted via babel.405+- added with-statement extension.406+- experimental Python 3 support.407+408+Version 2.2.1409+-------------410+(bugfix release, released on September 14th 2009)411+412+- fixes some smaller problems for Jinja2 on Jython.413+414+Version 2.2415+-----------416+(codename Kong, released on September 13th 2009)417+418+- Include statements can now be marked with ``ignore missing`` to skip419+ non existing templates.420+- Priority of `not` raised. It's now possible to write `not foo in bar`421+ as an alias to `foo not in bar` like in python. Previously the grammar422+ required parentheses (`not (foo in bar)`) which was odd.423+- Fixed a bug that caused syntax errors when defining macros or using the424+ `{% call %}` tag inside loops.425+- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.426+- Made it possible to refer to names from outer scopes in included templates427+ that were unused in the callers frame (#327)428+- Fixed a bug that caused internal errors if names where used as iteration429+ variable and regular variable *after* the loop if that variable was unused430+ *before* the loop. (#331)431+- Added support for optional `scoped` modifier to blocks.432+- Added support for line-comments.433+- Added the `meta` module.434+- Renamed (undocumented) attribute "overlay" to "overlayed" on the435+ environment because it was clashing with a method of the same name.436+- speedup extension is now disabled by default.437+438+Version 2.1.1439+-------------440+(Bugfix release)441+442+- Fixed a translation error caused by looping over empty recursive loops.443+444+Version 2.1445+-----------446+(codename Yasuzō, released on November 23rd 2008)447+448+- fixed a bug with nested loops and the special loop variable. Before the449+ change an inner loop overwrote the loop variable from the outer one after450+ iteration.451+452+- fixed a bug with the i18n extension that caused the explicit pluralization453+ block to look up the wrong variable.454+455+- fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` impossible.456+457+- index based subscribing of variables with a constant value returns an458+ undefined object now instead of raising an index error. This was a bug459+ caused by eager optimizing.460+461+- the i18n extension looks up `foo.ugettext` now followed by `foo.gettext`462+ if an translations object is installed. This makes dealing with custom463+ translations classes easier.464+465+- fixed a confusing behavior with conditional extending. loops were partially466+ executed under some conditions even though they were not part of a visible467+ area.468+469+- added `sort` filter that works like `dictsort` but for arbitrary sequences.470+471+- fixed a bug with empty statements in macros.472+473+- implemented a bytecode cache system. (:ref:`bytecode-cache`)474+475+- the template context is now weakref-able476+477+- inclusions and imports "with context" forward all variables now, not only478+ the initial context.479+480+- added a cycle helper called `cycler`.481+482+- added a joining helper called `joiner`.483+484+- added a `compile_expression` method to the environment that allows compiling485+ of Jinja expressions into callable Python objects.486+487+- fixed an escaping bug in urlize488+489+Version 2.0490+-----------491+(codename jinjavitus, released on July 17th 2008)492+493+- the subscribing of objects (looking up attributes and items) changed from494+ slightly. It's now possible to give attributes or items a higher priority495+ by either using dot-notation lookup or the bracket syntax. This also496+ changed the AST slightly. `Subscript` is gone and was replaced with497+ :class:`~jinja2.nodes.Getitem` and :class:`~jinja2.nodes.Getattr`.498+499+ For more information see :ref:`the implementation details <notes-on-subscriptions>`.500+501+- added support for preprocessing and token stream filtering for extensions.502+ This would allow extensions to allow simplified gettext calls in template503+ data and something similar.504+505+- added :meth:`jinja2.environment.TemplateStream.dump`.506+507+- added missing support for implicit string literal concatenation.508+ ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``509+510+- `else` is optional for conditional expressions. If not given it evaluates511+ to `false`.512+513+- improved error reporting for undefined values by providing a position.514+515+- `filesizeformat` filter uses decimal prefixes now per default and can be516+ set to binary mode with the second parameter.517+518+- fixed bug in finalizer519+520+Version 2.0rc1521+--------------522+(no codename, released on June 9th 2008)523+524+- first release of Jinja2