summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2014-06-07 00:58:38 +0600
committerArmin Ronacher <armin.ronacher@active-4.com>2014-06-07 00:58:38 +0600
commit3d91ae5fff0cde03e09f430bcf7a314e1c09895a (patch)
tree106ed8086da1e988cf24db9053a257fecee01703 /docs
parent9bf94b533d7df02aea9754f7de6a68ace69a80ea (diff)
downloadjinja2-3d91ae5fff0cde03e09f430bcf7a314e1c09895a.tar.gz
Documented {% set %}...{% endset %}
Diffstat (limited to 'docs')
-rw-r--r--docs/templates.rst21
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/templates.rst b/docs/templates.rst
index cd947ca..20dacfd 100644
--- a/docs/templates.rst
+++ b/docs/templates.rst
@@ -809,6 +809,27 @@ Assignments use the `set` tag and can have multiple targets::
{% set key, value = call_something() %}
+Block Assignments
+~~~~~~~~~~~~~~~~~
+
+.. versionadded:: 2.8
+
+Starting with Jinja 2.8 it's possible to also use block assignments to
+capture the contents of a block into a variable name. This can be useful
+in some situations as an alternative for macros. In that case instead of
+using an equals sign and a value you just write the variable name and then
+everything until ``{% endset %}`` is captured.
+
+Example::
+
+ {% set navigation %}
+ <li><a href="/">Index</a>
+ <li><a href="/downloads">Downloads</a>
+ {% endset %}
+
+The `navigation` variable then contains the navigation HTML source.
+
+
Extends
~~~~~~~