From 87e2c1e051d106e88506a67d134b9623137b3fcf Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Tue, 30 Jun 2015 12:29:36 +0200 Subject: [PATCH] Note about nesting blocks and {% endblock NAME %} | Q | A | ------------- | --- | Doc fix? | [yes] | New docs? | [yes] | Applies to | [2.3] | Fixed tickets | [] --- book/templating.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/book/templating.rst b/book/templating.rst index 62500e250bb..b1fa09bb865 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -370,6 +370,19 @@ When working with template inheritance, here are some tips to keep in mind: {{ parent() }} {% endblock %} +* Blocks can be nested. For better overview, you can add the block name to the + ``{% endblock %}`` tag like so: + + .. code-block:: html+jinja + + {% block foo %} + {# ... #} + {% block bar %} + {# ... #} + {% endblock bar %} + {# ... #} + {% endblock foo %} + .. index:: single: Templating; Naming conventions single: Templating; File locations