diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2017-01-07 15:55:20 +0100 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2017-01-07 15:55:20 +0100 |
commit | a27a503cea8779db67a1bc21218a2e05e20ce6fc (patch) | |
tree | 949189fe5c6b7b721e35bba4282d7e2b1cd7a8f5 /docs/api.rst | |
parent | d67f0fd4cc2a4af08f51f4466150d49da7798729 (diff) | |
download | jinja-a27a503cea8779db67a1bc21218a2e05e20ce6fc.tar.gz |
Move the autoescape extension and with statement to be built-in
Diffstat (limited to 'docs/api.rst')
-rw-r--r-- | docs/api.rst | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/docs/api.rst b/docs/api.rst index 3b5bccde..b7c25d39 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -247,12 +247,14 @@ useful if you want to dig deeper into Jinja2 or :ref:`develop extensions Autoescaping ------------ -.. versionadded:: 2.4 +.. versionchanged:: 2.4 -As of Jinja 2.4 the preferred way to do autoescaping is to enable the -:ref:`autoescape-extension` and to configure a sensible default for -autoescaping. This makes it possible to enable and disable autoescaping -on a per-template basis (HTML versus text for instance). +Jinja2 now comes with autoescaping support. As of Jinja 2.9 the +autoescape extension is removed and built-in. However autoescaping is +not yet enabled by default though this might change in the future. +It's recommended to configure a sensible default for autoescaping. This +makes it possible to enable and disable autoescaping on a per-template +basis (HTML versus text for instance). Here a recommended setup that enables autoescaping for templates ending in ``'.html'``, ``'.htm'`` and ``'.xml'`` and disabling it by default @@ -265,8 +267,7 @@ for all other extensions:: return ext in ('html', 'htm', 'xml') env = Environment(autoescape=guess_autoescape, - loader=PackageLoader('mypackage'), - extensions=['jinja2.ext.autoescape']) + loader=PackageLoader('mypackage')) When implementing a guessing autoescape function, make sure you also accept `None` as valid template name. This will be passed when generating |