From aa023e4947728c3797f5d506f6ddd174bd49a3f5 Mon Sep 17 00:00:00 2001 From: Dimitris Leventeas Date: Thu, 1 Nov 2012 23:21:32 +0100 Subject: [PATCH] Update docs/templates.rst Loop (recursive) --> Another loop -> loop(...) --- docs/templates.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/templates.rst b/docs/templates.rst index 790b95e7..13813145 100644 --- a/docs/templates.rst +++ b/docs/templates.rst @@ -588,6 +588,10 @@ The following example implements a sitemap with recursive loops:: {%- endfor %} +The `loop` variable always refers to the closest (innermost) loop. If we +have more than one levels of loops, we can rebind the variable `loop` by +writing `{% set outer_loop = loop %}` after the loop that we want to +use recursively. Then, we can call it using `{{ outer_loop(...) }}` If ~~ -- 2.47.2