stencilproject/Stencil

Using block.super with multi-level inheritance

svanimpe opened this issue · 2 comments

From template-base.stencil:

{% block additional-head %}{% endblock %}

From template-main.stencil:

{% extends "template-base.stencil" %}

{% block additional-head %}
(some additional CSS styles)
{% endblock %}

From page.stencil:

{% extends "template-main.stencil" %}

{% block additional-head %}
    {{ block.super }}
    (even more CSS styles)
{% endblock %}

Here block.super does not include anything. It's as if it includes the content from template-base.stencil instead of its immediate parent template-main.stencil. I have used block.super before, but never with multiple levels of inheritance.

Is this a bug, or is this simply not supported?

What exactly does this fix do? Should my example code now work, or is this not the right way of achieving this result?

It should fix the issue you described, now when doing {{ block.super }} you should get the block of template you extend, before that base template was always used due to some implementation details.