Let's say I've got "base.jinja". Two blocks: "headers" and
"content". Tons of pages, they all extend base.jinja.
Later, I add an intermediary layout, "headers.jinja2", and it wraps
headers in a pretty box. Not *all* pages use it, only some internal
pages.
{% extends "base.jinja2" %}
{% block headers %}
<div class="headers">{% block wrapped_headers %}{% endblock
wrapped_headers %}</div>
{% endblock %}
Now I need to change those pages, from
{% extends "base.jinja" %}
{% block headers %}...
to:
{% extends "headers.jinja" %}
{% block wrapped_headers %}...
My inclination, though, is to write this code like THIS (which doesn't
compile, obviously):
headers.jinja:
{% extends "base.jinja2" %}
{% block headers %}
<div class="headers">
{# redeclare headers block #}
{% block headers %}{% endblock headers %}
</div>
{% endblock %}
index.jinja
{% extends "headers.jinja" %}
{# no change needed! #}
{% block headers %}...
Any thoughts? Is there a similar-but-already-supported option?
Another use case is, in a parent layout, when you want to wrap a block
*if it is provided*:
{% block nav %}
{% if block %}<nav>{% block nav %}{% end block %}</nav>{% endif %}
{% endblock %}
Can this be accomplished using macros?
Thanks,
#colin
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en.