summaryrefslogtreecommitdiff
path: root/docs/templates.rst
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2019-10-04 19:00:11 -0700
committerDavid Lord <davidism@gmail.com>2019-10-04 19:13:39 -0700
commit5e645ab25c0798c2e038f37a249cd74ea57bdde9 (patch)
tree865f6c32f0b26098707cac1673e097096017aeeb /docs/templates.rst
parent93565e6cd8f254e69ba21876fa1e72e2483eed31 (diff)
downloadjinja2-5e645ab25c0798c2e038f37a249cd74ea57bdde9.tar.gz
document debug extension
Diffstat (limited to 'docs/templates.rst')
-rw-r--r--docs/templates.rst23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/templates.rst b/docs/templates.rst
index 59a34dd..f6fb609 100644
--- a/docs/templates.rst
+++ b/docs/templates.rst
@@ -1658,6 +1658,29 @@ Note that ``loop.index`` starts with 1, and ``loop.index0`` starts with 0
(See: :ref:`for-loop`).
+Debug Statement
+~~~~~~~~~~~~~~~
+
+If the :ref:`debug-extension` is enabled, a ``{% debug %}`` tag will be
+available to dump the current context as well as the available filters
+and tests. This is useful to see what's available to use in the template
+without setting up a debugger.
+
+.. code-block:: html+jinja
+
+ <pre>{% debug %}</pre>
+
+.. code-block:: text
+
+ {'context': {'cycler': <class 'jinja2.utils.Cycler'>,
+ ...,
+ 'namespace': <class 'jinja2.utils.Namespace'>},
+ 'filters': ['abs', 'attr', 'batch', 'capitalize', 'center', 'count', 'd',
+ ..., 'urlencode', 'urlize', 'wordcount', 'wordwrap', 'xmlattr'],
+ 'tests': ['!=', '<', '<=', '==', '>', '>=', 'callable', 'defined',
+ ..., 'odd', 'sameas', 'sequence', 'string', 'undefined', 'upper']}
+
+
With Statement
~~~~~~~~~~~~~~