stencilproject/Stencil

Blocks and if don't seem to mix

svanimpe opened this issue · 0 comments

Both of these don't do what I expected them to do (taken from stencil that extends another one):

{% block title %}
    {% if sort == "new" %}
        {{ block.super }} - Nieuwste spellen
    {% elif sort == "upcoming" %}
        {{ block.super }} - Binnenkort op de agenda
    {% elif sort == "near-me" %}
        {{ block.super }} - In mijn buurt
    {% endif %}
{% endblock %}
{% if sort == "new" %}
    {% block title %}{{ block.super }} - Nieuwste spellen{% endblock %}
{% elif sort == "upcoming" %}
    {% block title %}{{ block.super }} - Binnenkort op de agenda{% endblock %}
{% elif sort == "near-me" %}
    {% block title %}{{ block.super }} - In mijn buurt{% endblock %}
{% endif %}

In the former, only "- Nieuwste spellen" (for example) shows and {{ block.super }} evaluates to nothing.
In the latter, the reverse happens.

What does work is:

{% block title %}
    {{ block.super }} -
    {% if sort == "new" %}
         Nieuwste spellen
    {% elif sort == "upcoming" %}
        Binnenkort op de agenda
    {% elif sort == "near-me" %}
        In mijn buurt
    {% endif %}
{% endblock %}