Open legutierr opened 7 years ago
I've noticed the same behavior on my end, jinja2 and twig both support the super() method on nested blocks.
+1
The super'd block apparently doesn't need to be in the grandparent as I'm getting this behavior when trying to super a parent block from child in a three deep nesting of templates on 1.3.4.
To state this in terms of the example above, the following code in child would return nothing:
{% block inner2 %}
{{ super() }}
{% endblock %}
Suppose we have a set of three templates, a child, a parent and a grandparent:
When we render them...
...we should expect to see the contents of the grandparent's
inner1
block print out. But we don't;super()
doesn't do anything:This is inconsistent with the behavior of both Jinja2 and Twig, which are in agreement as to behavior here. For instance:
Here,
super()
does actually print the contents of the grandparent'sinner1
block:Again, Twig's behavior is consistent with that of Jinja2, but for brevity's sake I will avoid demonstrating it here.