Merge branch '2.10.x'
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 0209b0f, d601b3f · Browse files · 37 files·+602 added−1622 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
37 files+602 added−1622 removed
- tests:+9 added−0 removed
- other:+593 added−1622 removed
Provenance
- Commit
9550dc8- Tree
109df75- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent 1
0209b0f- Parent 2
d601b3f
37 files changed+602 added−1622 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="https://pypi.org/project/Jinja2/">Jinja2 @ PyPI</a></li> <li><a href="https://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+1 added-1 removed
113 unmodified lines114 >>> m.b115 u'f\xf6\xf6'116 117 118-.. _Unicode documentation: https://docs.python.org/dev/howto/unicode.html118+.. _Unicode documentation: https://docs.python.org/3/howto/unicode.html119 120 High Level API121 --------------122 813 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+2 added-1 removed
1-.. module:: jinja21+Changelog2+=========3 4 .. 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-24 removed
1-Jinja2 Documentation2---------------------3-4-.. toctree::5- :maxdepth: 26-7- intro8- api9- sandbox10- nativetypes11- templates12- extensions13- integration14- switching15- tricks16-17-Additional Information18-----------------------19-20-.. toctree::21- :maxdepth: 222-23- faq24- changelogmodified:docs/extensions.rst+5 added-5 removed
104 unmodified lines105 106 The usage of the `i18n` extension for template designers is covered as part107 :ref:`of the template documentation <i18n-in-templates>`.108 109-.. _gettext: https://docs.python.org/dev/library/gettext109+.. _gettext: https://docs.python.org/3/library/gettext.html110 .. _Babel: http://babel.pocoo.org/111 112 .. _newstyle-gettext:113 117 unmodified lines231 Example Extension232 ~~~~~~~~~~~~~~~~~233 234 The following example implements a `cache` tag for Jinja2 by using the235-`Werkzeug`_ caching contrib module:235+`cachelib`_ library:236 237 .. literalinclude:: cache_extension.py238 :language: python239 240 And here is how you use it in an environment::241 242 from jinja2 import Environment243- from werkzeug.contrib.cache import SimpleCache243+ from cachelib import SimpleCache244 245 env = Environment(extensions=[FragmentCacheExtension])246 env.fragment_cache = SimpleCache()247 7 unmodified lines255 ...256 </div>257 {% endcache %}258 259-.. _Werkzeug: http://werkzeug.pocoo.org/259+.. _cachelib: https://github.com/pallets/cachelib260 261 Extension API262 ~~~~~~~~~~~~~263 80 unmodified lines344 For more information have a look at the repr of :meth:`jinja2.Environment.parse`.345 346 .. module:: jinja2.nodes347 348-.. jinjanodes::348+.. jinja:nodes:: jinja2.nodes.Node349 350 .. autoexception:: Impossiblemodified:docs/faq.rst+2 added-1 removed
24 unmodified lines25 speaking the performance of a template engine doesn't matter much as the26 usual bottleneck in a web application is either the database or the application27 code.28 29-.. _Mako: http://www.makotemplates.org/29+.. _Mako: https://www.makotemplates.org/30 31 How Compatible is Jinja2 with Django?32 -------------------------------------33 157 unmodified lines191 templates passing information to the parent template. To avoid this192 issue rename the macro or variable in the parent template to have an193 uncommon prefix.194 195+.. _Jinja 1: https://pypi.org/project/Jinja/modified:docs/index.rst+24 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+ nativetypes42+ templates43+ extensions44+ integration45+ switching46+ tricks47+ faq48+ changelog49 50 * :ref:`genindex`51 * :ref:`search`modified:docs/integration.rst+2 added-2 removed
74 unmodified lines75 snippet and add it into your `config/environment.py`::76 77 config['pylons.strict_c'] = True78 79-.. _Pylons: http://www.pylonshq.com/79+.. _Pylons: https://pylonshq.com/80 81 TextMate82 --------83 17 unmodified lines101 <https://github.com/mitsuhiko/vim-jinja>`_ repository for installing in the102 ``bundle/`` directory.103 104 .. _Babel: http://babel.pocoo.org/105-.. _Vim: http://www.vim.org/105+.. _Vim: https://www.vim.org/106 .. _Pathogen: https://github.com/tpope/vim-pathogenmodified:docs/intro.rst+3 added-3 removed
40 unmodified lines41 which will install the package via `distribute` in development mode. This also42 has the advantage that the C extensions are compiled.43 44 .. _distribute: https://pypi.org/project/distribute/45-.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools45+.. _setuptools: https://pypi.org/project/setuptools/46 .. _pip: https://pypi.org/project/pip/47-.. _git: https://git-scm.org/47+.. _git: https://git-scm.com/48 49 50 MarkupSafe Dependency51 ~~~~~~~~~~~~~~~~~~~~~52 53 As of version 2.7 Jinja2 depends on the `MarkupSafe`_ module. If you install54 Jinja2 via ``pip`` it will be installed automatically for you.55 56-.. _MarkupSafe: https://pypi.org/project/MarkupSafe/56+.. _MarkupSafe: https://markupsafe.palletsprojects.com/57 58 Basic API Usage59 ---------------60 22 unmodified linesdeleted:docs/jinjaext.py-206 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 os12-import re13-import inspect14-15-import logging16-17-import jinja218-from itertools import islice19-from types import BuiltinFunctionType20-from docutils import nodes21-from docutils.statemachine import ViewList22-from sphinx.ext.autodoc import prepare_docstring23-from sphinx.application import TemplateBridge24-from pygments.style import Style25-from pygments.token import Keyword, Name, Comment, String, Error, \26- Number, Operator, Generic27-from jinja2 import Environment, FileSystemLoader28-from jinja2._compat import abc29-30-31-def 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.children42-43-44-class 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',51-52- Keyword: 'bold #B80000',53- Keyword.Type: '#808080',54-55- Operator.Word: 'bold #B80000',56-57- 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',65-66- String: '#AA891C',67- Number: '#444444',68-69- 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',79-80- Error: '#F00 bg:#FAA'81- }82-83-84-_sig_re = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*(\(.*?\))')85-86-87-def 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 result111-112-113-def dump_functions(mapping):114- def directive(115- dirname, arguments, options, content, lineno, content_offset,116- block_text, state, state_machine117- ):118- reverse_mapping = {}119-120- for name, func in mapping.items():121- reverse_mapping.setdefault(func, []).append(name)122-123- filters = []124- compare_ops = set(('lt', 'le', 'eq', 'ne', 'ge', 'gt'))125-126- 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))131-132- filters.sort()133- result = ViewList()134-135- for name, aliases, func in filters:136- for item in format_function(name, aliases, func):137- result.append(item, '<jinjaext>')138-139- node = nodes.paragraph()140- state.nested_parse(result, content_offset, node)141- return node.children142-143- return directive144-145-146-from jinja2.defaults import DEFAULT_FILTERS, DEFAULT_TESTS147-jinja_filters = dump_functions(DEFAULT_FILTERS)148-jinja_tests = dump_functions(DEFAULT_TESTS)149-150-151-def 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)179-180-181-def 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)199-200-201-def 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}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+6 added-30 removed
1353 unmodified lines1354 The general syntax is ``<do something> if <something is true> else <do1355 something else>``.1356 1357 The `else` part is optional. If not provided, the else block implicitly1358-evaluates into an undefined object::1358+evaluates into an undefined object:1359 1360- {{ ('[%s]' % page.title) if page.title }}1360+.. sourcecode:: jinja1361 1362+ {{ "[{}]".format(page.title) if page.title }}1363 1364+1365 .. _python-methods:1366 1367 Python Methods1368 ~~~~~~~~~~~~~~19 unmodified lines1388 1389 List of Builtin Filters1390 -----------------------1391 1390-=================== =================== ================== ====================== ====================1391-Built-in Filters Index1392-==========================================================================================================1393-:func:`abs` :func:`attr` :func:`batch` :func:`capitalize` :func:`center`1394-:func:`default` :func:`dictsort` :func:`escape` :func:`filesizeformat` :func:`first`1395-:func:`float` :func:`forceescape` :func:`format` :func:`groupby` :func:`indent`1396-:func:`int` :func:`join` :func:`last` :func:`length` :func:`list`1397-:func:`lower` :func:`map` :func:`max` :func:`min` :func:`pprint`1398-:func:`random` :func:`reject` :func:`rejectattr` :func:`replace` :func:`reverse`1399-:func:`round` :func:`safe` :func:`select` :func:`selectattr` :func:`slice`1400-:func:`sort` :func:`string` :func:`striptags` :func:`sum` :func:`title`1401-:func:`tojson` :func:`trim` :func:`truncate` :func:`unique` :func:`upper`1402-:func:`urlencode` :func:`urlize` :func:`wordcount` :func:`wordwrap` :func:`xmlattr`1403-=================== =================== ================== ====================== ====================1392+.. jinja:filters:: jinja2.defaults.DEFAULT_FILTERS1393 1394 1406-1407-.. jinjafilters::1408-1409-1395 .. _builtin-tests:1396 1397 List of Builtin Tests1398 ---------------------1399 1415-=================== ================== =================== ================ ================1416-Built-in Test Index1417-================================================================================================1418-:func:`callable` :func:`defined` :func:`divisibleby` :func:`eq` :func:`escaped`1419-:func:`even` :func:`ge` :func:`gt` :func:`in` :func:`iterable`1420-:func:`le` :func:`lower` :func:`lt` :func:`mapping` :func:`ne`1421-:func:`none` :func:`number` :func:`odd` :func:`sameas` :func:`sequence`1422-:func:`string` :func:`undefined` .. .. ..1423-=================== ================== =================== ================ ================1400+.. jinja:tests:: jinja2.defaults.DEFAULT_TESTS1401 1425-.. jinjatests::1402 1403 .. _builtin-globals:1404 1405 List of Global Functions333 unmodified linesmodified:jinja2/bccache.py+2 added-3 removed
294 unmodified lines295 the minimal interface required.296 297 Libraries compatible with this class:298 299- - `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/>`_301 302 (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 available57 unmodified linesmodified:jinja2/sandbox.py+8 added-4 removed
14 unmodified lines15 import types16 import operator17 from jinja2.environment import Environment18 from jinja2.exceptions import SecurityError19-from jinja2._compat import string_types, PY2, abc19+from jinja2._compat import string_types, PY2, abc, range_type20 from jinja2.utils import Markup21 22 from markupsafe import EscapeFormatter23 from string import Formatter121 unmodified lines145 def safe_range(*args):146 """A range that can't generate ranges with a length of more than147 MAX_RANGE items.148 """149- rng = range(*args)149+ rng = range_type(*args)150+151 if len(rng) > MAX_RANGE:151- raise OverflowError('range too big, maximum size for range is %d' %152- MAX_RANGE)152+ raise OverflowError(153+ "Range too big. The sandbox blocks ranges larger than"154+ " MAX_RANGE (%d)." % MAX_RANGE155+ )156+157 return rng158 159 160 def unsafe(f):328 unmodified linesmodified:tests/test_api.py+9 added
102 unmodified lines103 assert t.render(foo='<foo>') == '<foo>'104 t = env.from_string('{{ foo }}')105 assert t.render(foo='<foo>') == '<foo>'106 107+ def test_sandbox_max_range(self, env):108+ from jinja2.sandbox import SandboxedEnvironment, MAX_RANGE109 110+ env = SandboxedEnvironment()111+ t = env.from_string("{% for item in range(total) %}{{ item }}{% endfor %}")112+113+ with pytest.raises(OverflowError):114+ t.render(total=MAX_RANGE + 1)115+116+117 @pytest.mark.api118 @pytest.mark.meta119 class TestMeta(object):120 254 unmodified linesmodified:CHANGES.rst+435 added-434 removed
1 .. currentmodule:: jinja22 3-Jinja Changelog4-===============5-6-3 Version 2.114 ------------5 10-unreleased6+Unreleased7 12-- Async support is only loaded the first time an13- :class:`~environment.Environment` enables it, in order to avoid a14- slow initial import. (`#765`_)15-- Python 2.6 and 3.3 are not supported anymore.16-- The ``map`` filter in async mode now automatically awaits17-- Added a new ``ChainableUndefined`` class to support getitem18- and getattr on an undefined object. (`#977`_)19-- Allow ``{%+`` syntax (with NOP behavior) when20- ``lstrip_blocks == False`` (`#748`_)21-- Added a ``default`` parameter for the ``map`` filter. (`#557`_)8+- Async support is only loaded the first time an9+ :class:`~environment.Environment` enables it, in order to avoid a10+ slow initial import. :issue:`765`11+- Python 2.6 and 3.3 are not supported anymore.12+- The ``map`` filter in async mode now automatically awaits13+- Added a new ``ChainableUndefined`` class to support getitem and14+ getattr on an undefined object. :issue:`977`15+- Allow ``{%+`` syntax (with NOP behavior) when ``lstrip_blocks`` is16+ disabled. :issue:`748`17+- Added a ``default`` parameter for the ``map`` filter. :issue:`557`18 - Exclude environment globals from23- :func:`meta.find_undeclared_variables`. #93119+ :func:`meta.find_undeclared_variables`. :issue:`931`20 - Float literals can be written with scientific notation, like25- ``{{ 2.56e-3 }}``. #912, #92221+ 2.56e-3. :issue:`912`, :pr:`922`22 - Int and float literals can be written with the '_' separator for27- legibility, like ``{{ 12_345 }}``. #92323+ legibility, like 12_345. :pr:`923`24 29-.. _#557: https://github.com/pallets/jinja/issues/55730-.. _#765: https://github.com/pallets/jinja/issues/76531-.. _#748: https://github.com/pallets/jinja/issues/74832-.. _#977: https://github.com/pallets/jinja/issues/97725 34-26 Version 2.10.227 --------------28 38-_Unreleased_29+Unreleased30 40-- Fix Python 3.7 deprecation warnings.31+- Fix Python 3.7 deprecation warnings.32+- Using ``range`` in the sandboxed environment uses ``xrange`` on33+ Python 2 to avoid memory use. :issue:`933`34 35 36 Version 2.10.137 --------------7 unmodified lines45 46 Version 2.1047 ------------48 56-released on November 8th 201749+Released 2017-11-0850 58-- Added a new extension node called ``OverlayScope`` which can be used to59- create an unoptimized scope that will look up all variables from a60- derived context.61-- Added an ``in`` test that works like the in operator. This can be used62- in combination with ``reject`` and ``select``.63-- Added ``previtem`` and ``nextitem`` to loop contexts, providing access to the64- previous/next item in the loop. If such an item does not exist, the value is65- undefined.66-- Added ``changed(*values)`` to loop contexts, providing an easy way of67- checking whether a value has changed since the last iteration (or rather68- since the last call of the method)69-- Added a ``namespace`` function that creates a special object which allows70- attribute assignment using the ``set`` tag. This can be used to carry data71- across scopes, e.g. from a loop body to code that comes after the loop.72-- Added a ``trimmed`` modifier to ``{% trans %}`` to strip linebreaks and73- surrounding whitespace. Also added a new policy to enable this for all74- ``trans`` blocks.75-- The ``random`` filter is no longer incorrectly constant folded and will76- produce a new random choice each time the template is rendered. (`#478`_)77-- Added a ``unique`` filter. (`#469`_)78-- Added ``min`` and ``max`` filters. (`#475`_)79-- Added tests for all comparison operators: ``eq``, ``ne``, ``lt``, ``le``,80- ``gt``, ``ge``. (`#665`_)81-- ``import`` statement cannot end with a trailing comma. (`#617`_, `#618`_)82-- ``indent`` filter will not indent blank lines by default. (`#685`_)83-- Add ``reverse`` argument for ``dictsort`` filter. (`#692`_)84-- Add a ``NativeEnvironment`` that renders templates to native Python types85- instead of strings. (`#708`_)86-- Added filter support to the block ``set`` tag. (`#489`_)87-- ``tojson`` filter marks output as safe to match documented behavior.88- (`#718`_)89-- Resolved a bug where getting debug locals for tracebacks could90- modify template context.91-- Fixed a bug where having many ``{% elif ... %}`` blocks resulted in a92- "too many levels of indentation" error. These blocks now compile to93- native ``elif ..:`` instead of ``else: if ..:`` (`#759`_)51+- Added a new extension node called ``OverlayScope`` which can be used52+ to create an unoptimized scope that will look up all variables from53+ a derived context.54+- Added an ``in`` test that works like the in operator. This can be55+ used in combination with ``reject`` and ``select``.56+- Added ``previtem`` and ``nextitem`` to loop contexts, providing57+ access to the previous/next item in the loop. If such an item does58+ not exist, the value is undefined.59+- Added ``changed(*values)`` to loop contexts, providing an easy way60+ of checking whether a value has changed since the last iteration (or61+ rather since the last call of the method)62+- Added a ``namespace`` function that creates a special object which63+ allows attribute assignment using the ``set`` tag. This can be used64+ to carry data across scopes, e.g. from a loop body to code that65+ comes after the loop.66+- Added a ``trimmed`` modifier to ``{% trans %}`` to strip linebreaks67+ and surrounding whitespace. Also added a new policy to enable this68+ for all ``trans`` blocks.69+- The ``random`` filter is no longer incorrectly constant folded and70+ will produce a new random choice each time the template is rendered.71+ :pr:`478`72+- Added a ``unique`` filter. :pr:`469`73+- Added ``min`` and ``max`` filters. :pr:`475`74+- Added tests for all comparison operators: ``eq``, ``ne``, ``lt``,75+ ``le``, ``gt``, ``ge``. :pr:`665`76+- ``import`` statement cannot end with a trailing comma. :pr:`617`,77+ :pr:`618`78+- ``indent`` filter will not indent blank lines by default. :pr:`685`79+- Add ``reverse`` argument for ``dictsort`` filter. :pr:`692`80+- Add a ``NativeEnvironment`` that renders templates to native Python81+ types instead of strings. :pr:`708`82+- Added filter support to the block ``set`` tag. :pr:`489`83+- ``tojson`` filter marks output as safe to match documented behavior.84+ :pr:`718`85+- Resolved a bug where getting debug locals for tracebacks could86+ modify template context.87+- Fixed a bug where having many ``{% elif ... %}`` blocks resulted in88+ a "too many levels of indentation" error. These blocks now compile89+ to native ``elif ..:`` instead of ``else: if ..:`` :issue:`759`90 95-.. _#469: https://github.com/pallets/jinja/pull/46996-.. _#475: https://github.com/pallets/jinja/pull/47597-.. _#478: https://github.com/pallets/jinja/pull/47898-.. _#489: https://github.com/pallets/jinja/pull/48999-.. _#617: https://github.com/pallets/jinja/pull/617100-.. _#618: https://github.com/pallets/jinja/pull/618101-.. _#665: https://github.com/pallets/jinja/pull/665102-.. _#685: https://github.com/pallets/jinja/pull/685103-.. _#692: https://github.com/pallets/jinja/pull/692104-.. _#708: https://github.com/pallets/jinja/pull/708105-.. _#718: https://github.com/pallets/jinja/pull/718106-.. _#759: https://github.com/pallets/jinja/pull/75991 108-92 Version 2.9.693 -------------94 112-(bugfix release, released on April 3rd 2017)95+Released 2017-04-0396 114-- Fixed custom context behavior in fast resolve mode (#675)97+- Fixed custom context behavior in fast resolve mode :issue:`675`98 99 100 Version 2.9.5101 -------------102 120-(bugfix release, released on January 28th 2017)103+Released 2017-01-28104 122-- Restored the original repr of the internal ``_GroupTuple`` because this123- caused issues with ansible and it was an unintended change. (#654)124-- Added back support for custom contexts that override the old ``resolve``125- method since it was hard for people to spot that this could cause a126- regression.127-- Correctly use the buffer for the else block of for loops. This caused128- invalid syntax errors to be caused on 2.x and completely wrong behavior129- on Python 3 (#669)130-- Resolve an issue where the ``{% extends %}`` tag could not be used with131- async environments. (#668)132-- Reduce memory footprint slightly by reducing our unicode database dump133- we use for identifier matching on Python 3 (#666)134-- Fixed autoescaping not working for macros in async compilation mode. (#671)105+- Restored the original repr of the internal ``_GroupTuple`` because106+ this caused issues with ansible and it was an unintended change.107+ :issue:`654`108+- Added back support for custom contexts that override the old109+ ``resolve`` method since it was hard for people to spot that this110+ could cause a regression.111+- Correctly use the buffer for the else block of for loops. This112+ caused invalid syntax errors to be caused on 2.x and completely113+ wrong behavior on Python 3 :issue:`669`114+- Resolve an issue where the ``{% extends %}`` tag could not be used115+ with async environments. :issue:`668`116+- Reduce memory footprint slightly by reducing our unicode database117+ dump we use for identifier matching on Python 3 :issue:`666`118+- Fixed autoescaping not working for macros in async compilation mode.119+ :issue:`671`120 121 122 Version 2.9.4123 -------------124 140-(bugfix release, released on January 10th 2017)125+Released 2017-01-10126 142-- Solved some warnings for string literals. (#646)143-- Increment the bytecode cache version which was not done due to an144- oversight before.145-- Corrected bad code generation and scoping for filtered loops. (#649)146-- Resolved an issue where top-level output silencing after known extend147- blocks could generate invalid code when blocks where contained in if148- statements. (#651)149-- Made the ``truncate.leeway`` default configurable to improve compatibility150- with older templates.127+- Solved some warnings for string literals. :issue:`646`128+- Increment the bytecode cache version which was not done due to an129+ oversight before.130+- Corrected bad code generation and scoping for filtered loops.131+ :issue:`649`132+- Resolved an issue where top-level output silencing after known133+ extend blocks could generate invalid code when blocks where134+ contained in if statements. :issue:`651`135+- Made the ``truncate.leeway`` default configurable to improve136+ compatibility with older templates.137 138 139 Version 2.9.3140 -------------141 156-(bugfix release, released on January 8th 2017)142+Released 2017-01-08143 158-- Restored the use of blocks in macros to the extend that was possible159- before. On Python 3 it would render a generator repr instead of160- the block contents. (#645)161-- Set a consistent behavior for assigning of variables in inner scopes162- when the variable is also read from an outer scope. This now sets the163- intended behavior in all situations however it does not restore the164- old behavior where limited assignments to outer scopes was possible.165- For more information and a discussion see #641166-- Resolved an issue where ``block scoped`` would not take advantage of the167- new scoping rules. In some more exotic cases a variable overridden in a168- local scope would not make it into a block.169-- Change the code generation of the ``with`` statement to be in line with the170- new scoping rules. This resolves some unlikely bugs in edge cases. This171- also introduces a new internal ``With`` node that can be used by extensions.144+- Restored the use of blocks in macros to the extend that was possible145+ before. On Python 3 it would render a generator repr instead of the146+ block contents. :issue:`645`147+- Set a consistent behavior for assigning of variables in inner scopes148+ when the variable is also read from an outer scope. This now sets149+ the intended behavior in all situations however it does not restore150+ the old behavior where limited assignments to outer scopes was151+ possible. For more information and a discussion see :issue:`641`152+- Resolved an issue where ``block scoped`` would not take advantage of153+ the new scoping rules. In some more exotic cases a variable154+ overriden in a local scope would not make it into a block.155+- Change the code generation of the ``with`` statement to be in line156+ with the new scoping rules. This resolves some unlikely bugs in edge157+ cases. This also introduces a new internal ``With`` node that can be158+ used by extensions.159 160 161 Version 2.9.2162 -------------163 177-(bugfix release, released on January 8th 2017)164+Released 2017-01-08165 179-- Fixed a regression that caused for loops to not be able to use the same180- variable for the target as well as source iterator. (#640)181-- Add support for a previously unknown behavior of macros. It used to be182- possible in some circumstances to explicitly provide a caller argument183- to macros. While badly buggy and unintended it turns out that this is a184- common case that gets copy pasted around. To not completely break backwards185- compatibility with the most common cases it's now possible to provide an186- explicit keyword argument for caller if it's given an explicit default.187- (#642)166+- Fixed a regression that caused for loops to not be able to use the167+ same variable for the target as well as source iterator.168+ :issue:`640`169+- Add support for a previously unknown behavior of macros. It used to170+ be possible in some circumstances to explicitly provide a caller171+ argument to macros. While badly buggy and unintended it turns out172+ that this is a common case that gets copy pasted around. To not173+ completely break backwards compatibility with the most common cases174+ it's now possible to provide an explicit keyword argument for caller175+ if it's given an explicit default. :issue:`642`176 177 178 Version 2.9.1179 -------------180 193-(bugfix release, released on January 7th 2017)181+Released 2017-01-07182 195-- Resolved a regression with call block scoping for macros. Nested caller196- blocks that used the same identifiers as outer macros could refer to the197- wrong variable incorrectly.183+- Resolved a regression with call block scoping for macros. Nested184+ caller blocks that used the same identifiers as outer macros could185+ refer to the wrong variable incorrectly.186 187 188 Version 2.9189 -----------202-(codename Derivation, released on January 7th 2017)190 204-- Change cache key definition in environment. This fixes a performance205- regression introduced in 2.8.206-- Added support for ``generator_stop`` on supported Python versions207- (Python 3.5 and later)208-- Corrected a long standing issue with operator precedence of math operations209- not being what was expected.210-- Added support for Python 3.6 async iterators through a new async mode.211-- Added policies for filter defaults and similar things.212-- urlize now sets "rel noopener" by default.213-- Support attribute fallback for old-style classes in 2.x.214-- Support toplevel set statements in extend situations.215-- Restored behavior of Cycler for Python 3 users.216-- Subtraction now follows the same behavior as other operators on undefined217- values.218-- ``map`` and friends will now give better error messages if you forgot to219- quote the parameter.220-- Depend on MarkupSafe 0.23 or higher.221-- Improved the ``truncate`` filter to support better truncation in case222- the string is barely truncated at all.223-- Change the logic for macro autoescaping to be based on the runtime224- autoescaping information at call time instead of macro define time.225-- Ported a modified version of the ``tojson`` filter from Flask to Jinja2226- and hooked it up with the new policy framework.227-- Block sets are now marked ``safe`` by default.228-- On Python 2 the asciification of ASCII strings can now be disabled with229- the ``compiler.ascii_str`` policy.230-- Tests now no longer accept an arbitrary expression as first argument but231- a restricted one. This means that you can now properly use multiple232- tests in one expression without extra parentheses. In particular you can233- now write ``foo is divisibleby 2 or foo is divisibleby 3``234- as you would expect.235-- Greatly changed the scoping system to be more consistent with what template236- designers and developers expect. There is now no more magic difference237- between the different include and import constructs. Context is now always238- propagated the same way. The only remaining differences is the defaults239- for ``with context`` and ``without context``.240-- The ``with`` and ``autoescape`` tags are now built-in.241-- Added the new ``select_autoescape`` function which helps configuring better242- autoescaping easier.243-- Fixed a runtime error in the sandbox when attributes of async generators244- were accessed.191+Released 2017-01-07, codename Derivation192 193+- Change cache key definition in environment. This fixes a performance194+ regression introduced in 2.8.195+- Added support for ``generator_stop`` on supported Python versions196+ (Python 3.5 and later)197+- Corrected a long standing issue with operator precedence of math198+ operations not being what was expected.199+- Added support for Python 3.6 async iterators through a new async200+ mode.201+- Added policies for filter defaults and similar things.202+- Urlize now sets "rel noopener" by default.203+- Support attribute fallback for old-style classes in 2.x.204+- Support toplevel set statements in extend situations.205+- Restored behavior of Cycler for Python 3 users.206+- Subtraction now follows the same behavior as other operators on207+ undefined values.208+- ``map`` and friends will now give better error messages if you209+ forgot to quote the parameter.210+- Depend on MarkupSafe 0.23 or higher.211+- Improved the ``truncate`` filter to support better truncation in212+ case the string is barely truncated at all.213+- Change the logic for macro autoescaping to be based on the runtime214+ autoescaping information at call time instead of macro define time.215+- Ported a modified version of the ``tojson`` filter from Flask to216+ Jinja2 and hooked it up with the new policy framework.217+- Block sets are now marked ``safe`` by default.218+- On Python 2 the asciification of ASCII strings can now be disabled219+ with the ``compiler.ascii_str`` policy.220+- Tests now no longer accept an arbitrary expression as first argument221+ but a restricted one. This means that you can now properly use222+ multiple tests in one expression without extra parentheses. In223+ particular you can now write ``foo is divisibleby 2 or foo is224+ divisibleby 3`` as you would expect.225+- Greatly changed the scoping system to be more consistent with what226+ template designers and developers expect. There is now no more magic227+ difference between the different include and import constructs.228+ Context is now always propagated the same way. The only remaining229+ differences is the defaults for ``with context`` and ``without230+ context``.231+- The ``with`` and ``autoescape`` tags are now built-in.232+- Added the new ``select_autoescape`` function which helps configuring233+ better autoescaping easier.234+- Fixed a runtime error in the sandbox when attributes of async235+ generators were accessed.236 237+238 Version 2.8.1239 -------------240 250-(bugfix release, released on December 29th 2016)241+Released 2016-12-29242 252-- Fixed the ``for_qs`` flag for ``urlencode``.253-- Fixed regression when applying ``int`` to non-string values.254-- SECURITY: if the sandbox mode is used format expressions are now sandboxed255- with the same rules as in Jinja. This solves various information leakage256- problems that can occur with format strings.243+- Fixed the ``for_qs`` flag for ``urlencode``.244+- Fixed regression when applying ``int`` to non-string values.245+- SECURITY: if the sandbox mode is used format expressions are now246+ sandboxed with the same rules as in Jinja. This solves various247+ information leakage problems that can occur with format strings.248 249 250 Version 2.8251 -----------252 262-(codename Replacement, released on July 26th 2015)253+Released 2015-07-26, codename Replacement254 264-- Added ``target`` parameter to urlize function.265-- Added support for ``followsymlinks`` to the file system loader.266-- The truncate filter now counts the length.267-- Added equalto filter that helps with select filters.268-- Changed cache keys to use absolute file names if available269- instead of load names.270-- Fixed loop length calculation for some iterators.271-- Changed how Jinja2 enforces strings to be native strings in272- Python 2 to work when people break their default encoding.273-- Added :func:`make_logging_undefined` which returns an undefined274- object that logs failures into a logger.275-- If unmarshalling of cached data fails the template will be276- reloaded now.277-- Implemented a block ``set`` tag.278-- Default cache size was increased to 400 from a low 50.279-- Fixed ``is number`` test to accept long integers in all Python versions.280-- Changed ``is number`` to accept Decimal as a number.281-- Added a check for default arguments followed by non-default arguments. This282- change makes ``{% macro m(x, y=1, z) %}...{% endmacro %}`` a syntax error.283- The previous behavior for this code was broken anyway (resulting in the284- default value being applied to ``y``).285-- Add ability to use custom subclasses of ``jinja2.compiler.CodeGenerator`` and286- ``jinja2.runtime.Context`` by adding two new attributes to the environment287- (``code_generator_class`` and ``context_class``) (pull request ``#404``).288-- added support for context/environment/evalctx decorator functions on289- the finalize callback of the environment.290-- escape query strings for urlencode properly. Previously slashes were not291- escaped in that place.292-- Add 'base' parameter to 'int' filter.255+- Added ``target`` parameter to urlize function.256+- Added support for ``followsymlinks`` to the file system loader.257+- The truncate filter now counts the length.258+- Added equalto filter that helps with select filters.259+- Changed cache keys to use absolute file names if available instead260+ of load names.261+- Fixed loop length calculation for some iterators.262+- Changed how Jinja2 enforces strings to be native strings in Python 2263+ to work when people break their default encoding.264+- Added :func:`make_logging_undefined` which returns an undefined265+ object that logs failures into a logger.266+- If unmarshalling of cached data fails the template will be reloaded267+ now.268+- Implemented a block ``set`` tag.269+- Default cache size was increased to 400 from a low 50.270+- Fixed ``is number`` test to accept long integers in all Python271+ versions.272+- Changed ``is number`` to accept Decimal as a number.273+- Added a check for default arguments followed by non-default274+ arguments. This change makes ``{% macro m(x, y=1, z) %}`` a syntax275+ error. The previous behavior for this code was broken anyway276+ (resulting in the default value being applied to ``y``).277+- Add ability to use custom subclasses of278+ ``jinja2.compiler.CodeGenerator`` and ``jinja2.runtime.Context`` by279+ adding two new attributes to the environment280+ (``code_generator_class`` and ``context_class``) (pull request281+ ``:issue:`404```).282+- Added support for context/environment/evalctx decorator functions on283+ the finalize callback of the environment.284+- Escape query strings for urlencode properly. Previously slashes were285+ not escaped in that place.286+- Add 'base' parameter to 'int' filter.287 288 289 Version 2.7.3290 -------------291 298-(bugfix release, released on June 6th 2014)292+Released 2014-06-06293 300-- Security issue: Corrected the security fix for the cache folder. This301- fix was provided by RedHat.294+- Security issue: Corrected the security fix for the cache folder.295+ This fix was provided by RedHat.296 297 298 Version 2.7.2299 -------------300 307-(bugfix release, released on January 10th 2014)301+Released 2014-01-10302 309-- Prefix loader was not forwarding the locals properly to310- inner loaders. This is now fixed.311-- Security issue: Changed the default folder for the filesystem cache to be312- user specific and read and write protected on UNIX systems. See313- `Debian bug 734747`_ for more information.303+- Prefix loader was not forwarding the locals properly to inner304+ loaders. This is now fixed.305+- Security issue: Changed the default folder for the filesystem cache306+ to be user specific and read and write protected on UNIX systems.307+ See `Debian bug 734747`_ for more information.308 315-.. _Debian bug 734747: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747309+.. _Debian bug 734747: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747310 311 312 Version 2.7.1313 -------------314 321-(bugfix release, released on August 7th 2013)315+Released 2013-08-07316 323-- Fixed a bug with ``call_filter`` not working properly on environment324- and context filters.325-- Fixed lack of Python 3 support for bytecode caches.326-- Reverted support for defining blocks in included templates as this327- broke existing templates for users.328-- Fixed some warnings with hashing of undefineds and nodes if Python329- is run with warnings for Python 3.330-- Added support for properly hashing undefined objects.331-- Fixed a bug with the title filter not working on already uppercase332- strings.317+- Fixed a bug with ``call_filter`` not working properly on environment318+ and context filters.319+- Fixed lack of Python 3 support for bytecode caches.320+- Reverted support for defining blocks in included templates as this321+ broke existing templates for users.322+- Fixed some warnings with hashing of undefineds and nodes if Python323+ is run with warnings for Python 3.324+- Added support for properly hashing undefined objects.325+- Fixed a bug with the title filter not working on already uppercase326+ strings.327 328 329 Version 2.7330 -----------331 338-(codename Translation, released on May 20th 2013)332+Released 2013-05-20, codename Translation333 340-- Choice and prefix loaders now dispatch source and template lookup341- separately in order to work in combination with module loaders as342- advertised.343-- Fixed filesizeformat.344-- Added a non-silent option for babel extraction.345-- Added ``urlencode`` filter that automatically quotes values for346- URL safe usage with utf-8 as only supported encoding. If applications347- want to change this encoding they can override the filter.348-- Added ``keep-trailing-newline`` configuration to environments and349- templates to optionally preserve the final trailing newline.350-- Accessing ``last`` on the loop context no longer causes the iterator351- to be consumed into a list.352-- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,353- supported by same source code, using the "six" compatibility library.354-- Allow ``contextfunction`` and other decorators to be applied to ``__call__``.355-- Added support for changing from newline to different signs in the ``wordwrap``356- filter.357-- Added support for ignoring memcache errors silently.358-- Added support for keeping the trailing newline in templates.359-- Added finer grained support for stripping whitespace on the left side360- of blocks.361-- Added ``map``, ``select``, ``reject``, ``selectattr`` and ``rejectattr``362- filters.363-- Added support for ``loop.depth`` to figure out how deep inside a recursive364- loop the code is.365-- Disabled py_compile for pypy and python 3.334+- Choice and prefix loaders now dispatch source and template lookup335+ separately in order to work in combination with module loaders as336+ advertised.337+- Fixed filesizeformat.338+- Added a non-silent option for babel extraction.339+- Added ``urlencode`` filter that automatically quotes values for URL340+ safe usage with utf-8 as only supported encoding. If applications341+ want to change this encoding they can override the filter.342+- Added ``keep-trailing-newline`` configuration to environments and343+ templates to optionally preserve the final trailing newline.344+- Accessing ``last`` on the loop context no longer causes the iterator345+ to be consumed into a list.346+- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,347+ supported by same source code, using the "six" compatibility348+ library.349+- Allow ``contextfunction`` and other decorators to be applied to350+ ``__call__``.351+- Added support for changing from newline to different signs in the352+ ``wordwrap`` filter.353+- Added support for ignoring memcache errors silently.354+- Added support for keeping the trailing newline in templates.355+- Added finer grained support for stripping whitespace on the left356+ side of blocks.357+- Added ``map``, ``select``, ``reject``, ``selectattr`` and358+ ``rejectattr`` filters.359+- Added support for ``loop.depth`` to figure out how deep inside a360+ recursive loop the code is.361+- Disabled py_compile for pypy and python 3.362 363 364 Version 2.6365 -----------366 371-(codename Convolution, released on July 24th 2011)367+Released 2011-07-24, codename Convolution368 373-- internal attributes now raise an internal attribute error now instead374- of returning an undefined. This fixes problems when passing undefined375- objects to Python semantics expecting APIs.376-- traceback support now works properly for PyPy. (Tested with 1.4)377-- implemented operator intercepting for sandboxed environments. This378- allows application developers to disable builtin operators for better379- security. (For instance limit the mathematical operators to actual380- integers instead of longs)381-- groupby filter now supports dotted notation for grouping by attributes382- of attributes.383-- scoped blocks now properly treat toplevel assignments and imports.384- Previously an import suddenly "disappeared" in a scoped block.385-- automatically detect newer Python interpreter versions before loading code386- from bytecode caches to prevent segfaults on invalid opcodes. The segfault387- in earlier Jinja2 versions here was not a Jinja2 bug but a limitation in388- the underlying Python interpreter. If you notice Jinja2 segfaulting in389- earlier versions after an upgrade of the Python interpreter you don't have390- to upgrade, it's enough to flush the bytecode cache. This just no longer391- makes this necessary, Jinja2 will automatically detect these cases now.392-- the sum filter can now sum up values by attribute. This is a backwards393- incompatible change. The argument to the filter previously was the394- optional starting index which defaults to zero. This now became the395- second argument to the function because it's rarely used.396-- like sum, sort now also makes it possible to order items by attribute.397-- like sum and sort, join now also is able to join attributes of objects398- as string.399-- the internal eval context now has a reference to the environment.400-- added a mapping test to see if an object is a dict or an object with401- a similar interface.369+- Internal attributes now raise an internal attribute error now370+ instead of returning an undefined. This fixes problems when passing371+ undefined objects to Python semantics expecting APIs.372+- Traceback support now works properly for PyPy. (Tested with 1.4)373+- Implemented operator intercepting for sandboxed environments. This374+ allows application developers to disable builtin operators for375+ better security. (For instance limit the mathematical operators to376+ actual integers instead of longs)377+- Groupby filter now supports dotted notation for grouping by378+ attributes of attributes.379+- Scoped blocks now properly treat toplevel assignments and imports.380+ Previously an import suddenly "disappeared" in a scoped block.381+- Automatically detect newer Python interpreter versions before382+ loading code from bytecode caches to prevent segfaults on invalid383+ opcodes. The segfault in earlier Jinja2 versions here was not a384+ Jinja2 bug but a limitation in the underlying Python interpreter. If385+ you notice Jinja2 segfaulting in earlier versions after an upgrade386+ of the Python interpreter you don't have to upgrade, it's enough to387+ flush the bytecode cache. This just no longer makes this necessary,388+ Jinja2 will automatically detect these cases now.389+- The sum filter can now sum up values by attribute. This is a390+ backwards incompatible change. The argument to the filter previously391+ was the optional starting index which defaults to zero. This now392+ became the second argument to the function because it's rarely used.393+- Like sum, sort now also makes it possible to order items by394+ attribute.395+- Like sum and sort, join now also is able to join attributes of396+ objects as string.397+- The internal eval context now has a reference to the environment.398+- Added a mapping test to see if an object is a dict or an object with399+ a similar interface.400 401 402 Version 2.5.5403 -------------404 407-(re-release of 2.5.4 with built documentation removed for filesize.408- Released on October 18th 2010)405+Released 2010-10-18406 410-- built documentation is no longer part of release.407+- Built documentation is no longer part of release.408 409 410 Version 2.5.4411 -------------412 416-(bugfix release, released on October 17th 2010)413+Released 2010-10-17414 418-- Fixed extensions not loading properly with overlays.419-- Work around a bug in cpython for the debugger that causes segfaults420- on 64bit big-endian architectures.415+- Fixed extensions not loading properly with overlays.416+- Work around a bug in cpython for the debugger that causes segfaults417+ on 64bit big-endian architectures.418 419 420 Version 2.5.3421 -------------422 426-(bugfix release, released on October 17th 2010)423+Released 2010-10-17424 428-- fixed an operator precedence error introduced in 2.5.2. Statements429- like "-foo.bar" had their implicit parentheses applied around the430- first part of the expression ("(-foo).bar") instead of the more431- correct "-(foo.bar)".425+- Fixed an operator precedence error introduced in 2.5.2. Statements426+ like "-foo.bar" had their implicit parentheses applied around the427+ first part of the expression ("(-foo).bar") instead of the more428+ correct "-(foo.bar)".429 430 431 Version 2.5.2432 -------------436-(bugfix release, released on August 18th 2010)433 438-- improved setup.py script to better work with assumptions people439- might still have from it (``--with-speedups``).440-- fixed a packaging error that excluded the new debug support.434+Released 2010-08-18435 436+- Improved setup.py script to better work with assumptions people437+ might still have from it (``--with-speedups``).438+- Fixed a packaging error that excluded the new debug support.439 440+441 Version 2.5.1442 -------------443 446-(bugfix release, released on August 17th 2010)444+Released 2010-08-17445 448-- StopIteration exceptions raised by functions called from templates449- are now intercepted and converted to undefineds. This solves a450- lot of debugging grief. (StopIteration is used internally to451- abort template execution)452-- improved performance of macro calls slightly.453-- babel extraction can now properly extract newstyle gettext calls.454-- using the variable ``num`` in newstyle gettext for something else455- than the pluralize count will no longer raise a :exc:`KeyError`.456-- removed builtin markup class and switched to markupsafe. For backwards457- compatibility the pure Python implementation still exists but is458- pulled from markupsafe by the Jinja2 developers. The debug support459- went into a separate feature called "debugsupport" and is disabled460- by default because it is only relevant for Python 2.4461-- fixed an issue with unary operators having the wrong precedence.446+- StopIteration exceptions raised by functions called from templates447+ are now intercepted and converted to undefineds. This solves a lot448+ of debugging grief. (StopIteration is used internally to abort449+ template execution)450+- Improved performance of macro calls slightly.451+- Babel extraction can now properly extract newstyle gettext calls.452+- Using the variable ``num`` in newstyle gettext for something else453+ than the pluralize count will no longer raise a :exc:`KeyError`.454+- Removed builtin markup class and switched to markupsafe. For455+ backwards compatibility the pure Python implementation still exists456+ but is pulled from markupsafe by the Jinja2 developers. The debug457+ support went into a separate feature called "debugsupport" and is458+ disabled by default because it is only relevant for Python 2.4459+- Fixed an issue with unary operators having the wrong precedence.460 461 462 Version 2.5463 -----------464 467-(codename Incoherence, released on May 29th 2010)465+Released 2010-05-29, codename Incoherence466 469-- improved the sort filter (should have worked like this for a470- long time) by adding support for case insensitive searches.471-- fixed a bug for getattribute constant folding.472-- support for newstyle gettext translations which result in a473- nicer in-template user interface and more consistent474- catalogs. (:ref:`newstyle-gettext`)475-- it's now possible to register extensions after an environment476- was created.467+- Improved the sort filter (should have worked like this for a long468+ time) by adding support for case insensitive searches.469+- Fixed a bug for getattribute constant folding.470+- Support for newstyle gettext translations which result in a nicer471+ in-template user interface and more consistent catalogs.472+ (:ref:`newstyle-gettext`)473+- It's now possible to register extensions after an environment was474+ created.475 476 477 Version 2.4.1478 -------------479 482-(bugfix release, released on April 20th 2010)480+Released 2010-04-20481 484-- fixed an error reporting bug for undefineds.482+- Fixed an error reporting bug for undefined.483 484 485 Version 2.4486 -----------487 490-(codename Correlation, released on April 13th 2010)488+Released 2010-04-13, codename Correlation489 492-- the environment template loading functions now transparently493- pass through a template object if it was passed to it. This494- makes it possible to import or extend from a template object495- that was passed to the template.496-- added a :class:`ModuleLoader` that can load templates from497- precompiled sources. The environment now features a method498- to compile the templates from a configured loader into a zip499- file or folder.500-- the _speedups C extension now supports Python 3.501-- added support for autoescaping toggling sections and support502- for evaluation contexts (:ref:`eval-context`).503-- extensions have a priority now.490+- The environment template loading functions now transparently pass491+ through a template object if it was passed to it. This makes it492+ possible to import or extend from a template object that was passed493+ to the template.494+- Added a :class:`ModuleLoader` that can load templates from495+ precompiled sources. The environment now features a method to496+ compile the templates from a configured loader into a zip file or497+ folder.498+- The _speedups C extension now supports Python 3.499+- Added support for autoescaping toggling sections and support for500+ evaluation contexts (:ref:`eval-context`).501+- Extensions have a priority now.502 503 504 Version 2.3.1505 -------------506 509-(bugfix release, released on February 19th 2010)507+Released 2010-02-19508 511-- fixed an error reporting bug on all python versions512-- fixed an error reporting bug on Python 2.4509+- Fixed an error reporting bug on all python versions510+- Fixed an error reporting bug on Python 2.4511 512 513 Version 2.3514 -----------515 518-(codename 3000 Pythons, released on February 10th 2010)516+Released 2010-02-10, codename 3000 Pythons517 520-- fixes issue with code generator that causes unbound variables521- to be generated if set was used in if-blocks and other small522- identifier problems.523-- include tags are now able to select between multiple templates524- and take the first that exists, if a list of templates is525- given.526-- fixed a problem with having call blocks in outer scopes that527- have an argument that is also used as local variable in an528- inner frame (#360).529-- greatly improved error message reporting (#339)530-- implicit tuple expressions can no longer be totally empty.531- This change makes ``{% if %}...{% endif %}`` a syntax error532- now. (#364)533-- added support for translator comments if extracted via babel.534-- added with-statement extension.535-- experimental Python 3 support.518+- Fixes issue with code generator that causes unbound variables to be519+ generated if set was used in if-blocks and other small identifier520+ problems.521+- Include tags are now able to select between multiple templates and522+ take the first that exists, if a list of templates is given.523+- Fixed a problem with having call blocks in outer scopes that have an524+ argument that is also used as local variable in an inner frame525+ :issue:`360`.526+- Greatly improved error message reporting :pr:`339`527+- Implicit tuple expressions can no longer be totally empty. This528+ change makes ``{% if %}`` a syntax error now. :issue:`364`529+- Added support for translator comments if extracted via babel.530+- Added with-statement extension.531+- Experimental Python 3 support.532 533 534 Version 2.2.1535 -------------536 541-(bugfix release, released on September 14th 2009)537+Released 2009-09-14538 543-- fixes some smaller problems for Jinja2 on Jython.539+- Fixes some smaller problems for Jinja2 on Jython.540 541 542 Version 2.2543 -----------544 549-(codename Kong, released on September 13th 2009)545+Released 2009-09-13, codename Kong546 551-- Include statements can now be marked with ``ignore missing`` to skip552- non existing templates.553-- Priority of ``not`` raised. It's now possible to write `not foo in bar`554- as an alias to `foo not in bar` like in python. Previously the grammar555- required parentheses (`not (foo in bar)`) which was odd.556-- Fixed a bug that caused syntax errors when defining macros or using the557- `{% call %}` tag inside loops.558-- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.559-- Made it possible to refer to names from outer scopes in included templates560- that were unused in the callers frame (#327)561-- Fixed a bug that caused internal errors if names where used as iteration562- variable and regular variable *after* the loop if that variable was unused563- *before* the loop. (#331)564-- Added support for optional ``scoped`` modifier to blocks.565-- Added support for line-comments.566-- Added the ``meta`` module.567-- Renamed (undocumented) attribute "overlay" to "overlayed" on the568- environment because it was clashing with a method of the same name.569-- speedup extension is now disabled by default.547+- Include statements can now be marked with ``ignore missing`` to skip548+ non existing templates.549+- Priority of ``not`` raised. It's now possible to write ``not foo in550+ bar`` as an alias to ``foo not in bar`` like in python. Previously551+ the grammar required parentheses (``not (foo in bar)``) which was552+ odd.553+- Fixed a bug that caused syntax errors when defining macros or using554+ the ``{% call %}`` tag inside loops.555+- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.556+- Made it possible to refer to names from outer scopes in included557+ templates that were unused in the callers frame :issue:`327`558+- Fixed a bug that caused internal errors if names where used as559+ iteration variable and regular variable *after* the loop if that560+ variable was unused *before* the loop. :pr:`331`561+- Added support for optional ``scoped`` modifier to blocks.562+- Added support for line-comments.563+- Added the ``meta`` module.564+- Renamed (undocumented) attribute "overlay" to "overlayed" on the565+ environment because it was clashing with a method of the same name.566+- Speedup extension is now disabled by default.567 568 569 Version 2.1.1570 -------------571 575-(bugfix release, released on December 25th 2008)572+Released 2008-12-25573 577-- Fixed a translation error caused by looping over empty recursive loops.574+- Fixed a translation error caused by looping over empty recursive575+ loops.576 577 578 Version 2.1579 -----------580 583-(codename Yasuzō, released on November 23rd 2008)581+Released 2008-11-23, codename Yasuzō582 585-- fixed a bug with nested loops and the special loop variable. Before the586- change an inner loop overwrote the loop variable from the outer one after587- iteration.588-- fixed a bug with the i18n extension that caused the explicit pluralization589- block to look up the wrong variable.590-- fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` impossible.591-- index based subscribing of variables with a constant value returns an592- undefined object now instead of raising an index error. This was a bug593- caused by eager optimizing.594-- the i18n extension looks up ``foo.ugettext`` now followed by ``foo.gettext``595- if an translations object is installed. This makes dealing with custom596- translations classes easier.597-- fixed a confusing behavior with conditional extending. loops were partially598- executed under some conditions even though they were not part of a visible599- area.600-- added ``sort`` filter that works like ``dictsort`` but for arbitrary sequences.601-- fixed a bug with empty statements in macros.602-- implemented a bytecode cache system. (:ref:`bytecode-cache`)603-- the template context is now weakref-able604-- inclusions and imports "with context" forward all variables now, not only605- the initial context.606-- added a cycle helper called ``cycler``.607-- added a joining helper called ``joiner``.608-- added a ``compile_expression`` method to the environment that allows compiling609- of Jinja expressions into callable Python objects.610-- fixed an escaping bug in urlize583+- Fixed a bug with nested loops and the special loop variable. Before584+ the change an inner loop overwrote the loop variable from the outer585+ one after iteration.586+- Fixed a bug with the i18n extension that caused the explicit587+ pluralization block to look up the wrong variable.588+- Fixed a limitation in the lexer that made ``{{ foo.0.0 }}``589+ impossible.590+- Index based subscribing of variables with a constant value returns591+ an undefined object now instead of raising an index error. This was592+ a bug caused by eager optimizing.593+- The i18n extension looks up ``foo.ugettext`` now followed by594+ ``foo.gettext`` if an translations object is installed. This makes595+ dealing with custom translations classes easier.596+- Fixed a confusing behavior with conditional extending. loops were597+ partially executed under some conditions even though they were not598+ part of a visible area.599+- Added ``sort`` filter that works like ``dictsort`` but for arbitrary600+ sequences.601+- Fixed a bug with empty statements in macros.602+- Implemented a bytecode cache system. (:ref:`bytecode-cache`)603+- The template context is now weakref-able604+- Inclusions and imports "with context" forward all variables now, not605+ only the initial context.606+- Added a cycle helper called ``cycler``.607+- Added a joining helper called ``joiner``.608+- Added a ``compile_expression`` method to the environment that allows609+ compiling of Jinja expressions into callable Python objects.610+- Fixed an escaping bug in urlize611 612 613 Version 2.0614 -----------615 616-(codename jinjavitus, released on July 17th 2008)616+Released 2008-07-17, codename Jinjavitus617 618-- the subscribing of objects (looking up attributes and items) changed from619- slightly. It's now possible to give attributes or items a higher priority620- by either using dot-notation lookup or the bracket syntax. This also621- changed the AST slightly. ``Subscript`` is gone and was replaced with622- :class:`~jinja2.nodes.Getitem` and :class:`~jinja2.nodes.Getattr`.618+- The subscribing of objects (looking up attributes and items) changed619+ from slightly. It's now possible to give attributes or items a620+ higher priority by either using dot-notation lookup or the bracket621+ syntax. This also changed the AST slightly. ``Subscript`` is gone622+ and was replaced with :class:`~jinja2.nodes.Getitem` and623+ :class:`~jinja2.nodes.Getattr`. For more information see :ref:`the624+ implementation details <notes-on-subscriptions>`.625+- Added support for preprocessing and token stream filtering for626+ extensions. This would allow extensions to allow simplified gettext627+ calls in template data and something similar.628+- Added :meth:`jinja2.environment.TemplateStream.dump`.629+- Added missing support for implicit string literal concatenation.630+ ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``631+- ``else`` is optional for conditional expressions. If not given it632+ evaluates to ``false``.633+- Improved error reporting for undefined values by providing a634+ position.635+- ``filesizeformat`` filter uses decimal prefixes now per default and636+ can be set to binary mode with the second parameter.637+- Fixed bug in finalizer638 624- For more information see :ref:`the implementation details <notes-on-subscriptions>`.625-- added support for preprocessing and token stream filtering for extensions.626- This would allow extensions to allow simplified gettext calls in template627- data and something similar.628-- added :meth:`jinja2.environment.TemplateStream.dump`.629-- added missing support for implicit string literal concatenation.630- ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``631-- ``else`` is optional for conditional expressions. If not given it evaluates632- to ``false``.633-- improved error reporting for undefined values by providing a position.634-- ``filesizeformat`` filter uses decimal prefixes now per default and can be635- set to binary mode with the second parameter.636-- fixed bug in finalizer639 638-640 Version 2.0rc1641 --------------642 642-(no codename, released on June 9th 2008)643+Released 2008-06-09644 644-- first release of Jinja2645+- First release of Jinja2modified:README.rst+11 added
47 unmodified lines48 +---------------------+------------------------------------------------------------------------------+49 | ``2.9-maintenance`` | .. image:: https://travis-ci.org/pallets/jinja.svg?branch=2.9-maintenance |50 | | :target: https://travis-ci.org/pallets/jinja |51 +---------------------+------------------------------------------------------------------------------+52+53+Links54+-----55+56+* Website: http://jinja.pocoo.org/57+* Documentation: http://jinja.pocoo.org/docs/58+* License: `BSD <https://raw.githubusercontent.com/pallets/jinja/master/LICENSE>`_59+* Releases: https://pypi.org/project/Jinja/60+* Code: https://github.com/pallets/jinja61+* Issue tracker: https://github.com/pallets/jinja/issues62+* Official chat: https://discord.gg/t6rrQZHmodified:tox.ini+1 added
13 unmodified lines14 [testenv:docs-html]15 deps =16 Sphinx17 Pallets-Sphinx-Themes18+ sphinxcontrib-log-cabinet19 sphinx-issues20 commands = sphinx-build -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html21 22 [testenv:coverage]14 unmodified lines