From d458e8c8920d6e646f59c762cd4d401a80735423 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 25 Apr 2012 07:35:12 +0200 Subject: [PATCH] tweaked doc for the escape filter --- doc/filters/escape.rst | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/filters/escape.rst b/doc/filters/escape.rst index dd927b4..5142977 100644 --- a/doc/filters/escape.rst +++ b/doc/filters/escape.rst @@ -15,8 +15,16 @@ For convenience, the ``e`` filter is defined as an alias: {{ user.username|e }} -The ``escape`` filter can also be used in another context than HTML; for -instance, to escape variables included in a JavaScript: +The ``escape`` filter can also be used in other contexts than HTML thanks to +an optional argument which defines the escaping strategy to use: + +.. code-block:: jinja + + {{ user.username|e }} + {# is equivalent to #} + {{ user.username|e('html') }} + +And here is how to escape variables included in JavaScript code: .. code-block:: jinja @@ -25,6 +33,7 @@ instance, to escape variables included in a JavaScript: .. note:: - Internally, ``escape`` uses the PHP native `htmlspecialchars`_ function. + Internally, ``escape`` uses the PHP native `htmlspecialchars`_ function + for the HTML escaping strategy. .. _`htmlspecialchars`: http://php.net/htmlspecialchars -- 1.7.2.5