Opened 17 years ago

Closed 17 years ago

#6370 closed (wontfix)

Templates {% block %} does not work properly in {% if %}

Reported by: brandemk@… Owned by: nobody
Component: Template system Version: 0.96
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When I use the following code:
{% if site %}
<title>{% block titlebar %}{% endblock %} § {{ site.name }}</title>
{% else %}
<title>{% block titlebar %}{% endblock %} § Website</title>
{% endif %}

I get an error: titlebar block appears more than once.

While I do not see why an block cannot appear more than once, I do not see a reason that that cannot be valid. The titlebar block will only be rendered once.

Change History (2)

comment:1 by Collin Grady <cgrady@…>, 17 years ago

I'm pretty sure this is by design, because of how template extension works - you simply need to move your if.

<title>{% block titlebar %}{% endblock %} § {% if site %}{{ site.name }}{% else %}Website{% endif %}</title>

Less duplicated html, yet does the exact same thing your does.

comment:2 by Chris Beaven, 17 years ago

Resolution: wontfix
Status: newclosed

Yep, it's by design.

Note: See TracTickets for help on using tickets.
Back to Top