]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Merge branch '2.9.x' into docs
authorDavid Lord <davidism@gmail.com>
Fri, 26 Jul 2019 21:57:58 +0000 (14:57 -0700)
committerDavid Lord <davidism@gmail.com>
Fri, 26 Jul 2019 22:01:03 +0000 (15:01 -0700)
1  2 
CHANGES.rst
docs/api.rst
docs/extensions.rst
docs/faq.rst
docs/index.rst
docs/templates.rst

diff --cc CHANGES.rst
index 8b7c7a5b43eac3d3908057dfeab9bdc64556dced,7be9103d9da6247b487a7ee54fa7eeaed5d362bc..3199d559ef86605a8826410d93d118c8668ec0da
@@@ -1,81 -1,17 +1,69 @@@
- Jinja Changelog
- ===============
+ .. currentmodule:: jinja2
  
 -Version 2.9.7
 --------------
 +Version 2.10.2
 +--------------
  
  Unreleased
  
-     Python 2 to avoid memory use. #933
 +-   Fix Python 3.7 deprecation warnings.
 +-   Using ``range`` in the sandboxed environment uses ``xrange`` on
- released on November 8th 2017
- - Added a new extension node called ``OverlayScope`` which can be used to
-   create an unoptimized scope that will look up all variables from a
-   derived context.
- - Added an ``in`` test that works like the in operator.  This can be used
-   in combination with ``reject`` and ``select``.
- - Added ``previtem`` and ``nextitem`` to loop contexts, providing access to the
-   previous/next item in the loop. If such an item does not exist, the value is
-   undefined.
- - Added ``changed(*values)`` to loop contexts, providing an easy way of
-   checking whether a value has changed since the last iteration (or rather
-   since the last call of the method)
- - Added a ``namespace`` function that creates a special object which allows
-   attribute assignment using the ``set`` tag.  This can be used to carry data
-   across scopes, e.g. from a loop body to code that comes after the loop.
- - Added a ``trimmed`` modifier to ``{% trans %}`` to strip linebreaks and
-   surrounding whitespace. Also added a new policy to enable this for all
-   ``trans`` blocks.
- - The ``random`` filter is no longer incorrectly constant folded and will
-   produce a new random choice each time the template is rendered. (`#478`_)
- - Added a ``unique`` filter. (`#469`_)
- - Added ``min`` and ``max`` filters. (`#475`_)
- - Added tests for all comparison operators: ``eq``, ``ne``, ``lt``, ``le``,
-   ``gt``, ``ge``. (`#665`_)
- - ``import`` statement cannot end with a trailing comma. (`#617`_, `#618`_)
- - ``indent`` filter will not indent blank lines by default. (`#685`_)
- - Add ``reverse`` argument for ``dictsort`` filter. (`#692`_)
- - Add a ``NativeEnvironment`` that renders templates to native Python types
-   instead of strings. (`#708`_)
- - Added filter support to the block ``set`` tag. (`#489`_)
- - ``tojson`` filter marks output as safe to match documented behavior.
-   (`#718`_)
- - Resolved a bug where getting debug locals for tracebacks could
-   modify template context.
- - Fixed a bug where having many ``{% elif ... %}`` blocks resulted in a
-   "too many levels of indentation" error.  These blocks now compile to
-   native ``elif ..:`` instead of ``else: if ..:`` (`#759`_)
- .. _#469: https://github.com/pallets/jinja/pull/469
- .. _#475: https://github.com/pallets/jinja/pull/475
- .. _#478: https://github.com/pallets/jinja/pull/478
- .. _#489: https://github.com/pallets/jinja/pull/489
- .. _#617: https://github.com/pallets/jinja/pull/617
- .. _#618: https://github.com/pallets/jinja/pull/618
- .. _#665: https://github.com/pallets/jinja/pull/665
- .. _#685: https://github.com/pallets/jinja/pull/685
- .. _#692: https://github.com/pallets/jinja/pull/692
- .. _#708: https://github.com/pallets/jinja/pull/708
- .. _#718: https://github.com/pallets/jinja/pull/718
- .. _#759: https://github.com/pallets/jinja/pull/759
++    Python 2 to avoid memory use. :issue:`933`
 +
 +
 +Version 2.10.1
 +--------------
 +
 +Released 2019-04-06
 +
 +-   ``SandboxedEnvironment`` securely handles ``str.format_map`` in
 +    order to prevent code execution through untrusted format strings.
 +    The sandbox already handled ``str.format``.
 +
 +
 +Version 2.10
 +------------
 +
++Released 2017-11-08
++
++-   Added a new extension node called ``OverlayScope`` which can be used
++    to create an unoptimized scope that will look up all variables from
++    a derived context.
++-   Added an ``in`` test that works like the in operator. This can be
++    used in combination with ``reject`` and ``select``.
++-   Added ``previtem`` and ``nextitem`` to loop contexts, providing
++    access to the previous/next item in the loop. If such an item does
++    not exist, the value is undefined.
++-   Added ``changed(*values)`` to loop contexts, providing an easy way
++    of checking whether a value has changed since the last iteration (or
++    rather since the last call of the method)
++-   Added a ``namespace`` function that creates a special object which
++    allows attribute assignment using the ``set`` tag. This can be used
++    to carry data across scopes, e.g. from a loop body to code that
++    comes after the loop.
++-   Added a ``trimmed`` modifier to ``{% trans %}`` to strip linebreaks
++    and surrounding whitespace. Also added a new policy to enable this
++    for all ``trans`` blocks.
++-   The ``random`` filter is no longer incorrectly constant folded and
++    will produce a new random choice each time the template is rendered.
++    :pr:`478`
++-   Added a ``unique`` filter. :pr:`469`
++-   Added ``min`` and ``max`` filters. :pr:`475`
++-   Added tests for all comparison operators: ``eq``, ``ne``, ``lt``,
++    ``le``, ``gt``, ``ge``. :pr:`665`
++-   ``import`` statement cannot end with a trailing comma. :pr:`617`,
++    :pr:`618`
++-   ``indent`` filter will not indent blank lines by default. :pr:`685`
++-   Add ``reverse`` argument for ``dictsort`` filter. :pr:`692`
++-   Add a ``NativeEnvironment`` that renders templates to native Python
++    types instead of strings. :pr:`708`
++-   Added filter support to the block ``set`` tag. :pr:`489`
+ -   ``tojson`` filter marks output as safe to match documented behavior.
+     :pr:`718`
+ -   Resolved a bug where getting debug locals for tracebacks could
+     modify template context.
+ -   Fixed a bug where having many ``{% elif ... %}`` blocks resulted in
+     a "too many levels of indentation" error. These blocks now compile
+     to native ``elif ..:`` instead of ``else: if ..:`` :issue:`759`
  
  
  Version 2.9.6
diff --cc docs/api.rst
Simple merge
Simple merge
diff --cc docs/faq.rst
Simple merge
diff --cc docs/index.rst
index a08d6281df47eb6d6076d864f288efed4d59e132,616e5bf35d6bdaf2587ae464b4edc0eabdddb04a..65d5d3d4a1db378e83187994e467573e091c788c
@@@ -25,10 -31,20 +31,21 @@@ Features
      the correct line in the template.
  -   configurable syntax
  
- .. include:: contents.rst.inc
- If you can't find the information you're looking for, have a look at the
- index or try to find it using the search function:
+ .. toctree::
 -   :maxdepth: 2
 -   :caption: Contents:
 -
 -   intro
 -   api
 -   sandbox
 -   templates
 -   extensions
 -   integration
 -   switching
 -   tricks
 -   faq
 -   changelog
++    :maxdepth: 2
++    :caption: Contents:
++
++    intro
++    api
++    sandbox
++    nativetypes
++    templates
++    extensions
++    integration
++    switching
++    tricks
++    faq
++    changelog
  
  * :ref:`genindex`
  * :ref:`search`
index 345344e053a05e57ebc71feafab15c91cfaa5482,dd05add7ca69a2c1cdcc54775d6bd1f91f85669f..4f61469801146835f824e9dfa9a28a5b24aca582
@@@ -1310,35 -1247,11 +1310,35 @@@ The general syntax is ``<do something> 
  something else>``.
  
  The `else` part is optional.  If not provided, the else block implicitly
 -evaluates into an undefined object::
 +evaluates into an undefined object:
 +
 +.. sourcecode:: jinja
  
-     {{ '[%s]' % page.title if page.title }}
+     {{ "[{}]".format(page.title) if page.title }}
  
  
 +.. _python-methods:
 +
 +Python Methods
 +~~~~~~~~~~~~~~
 +
 +You can also use any of the methods of defined on a variable's type.
 +The value returned from the method invocation is used as the value of the expression.
 +Here is an example that uses methods defined on strings (where ``page.title`` is a string):
 +
 +.. code-block:: text
 +
 +    {{ page.title.capitalize() }}
 +
 +This also works for methods on user-defined types.
 +For example, if variable ``f`` of type ``Foo`` has a method ``bar`` defined on it,
 +you can do the following:
 +
 +.. code-block:: text
 +
 +    {{ f.bar() }}
 +
 +
  .. _builtin-filters:
  
  List of Builtin Filters