#35636: differentiate placeholder and content provider blocks
-------------------------------------+-------------------------------------
Reporter: langit | Type: New
| feature
Status: new | Component: Template
| system
Version: 5.0 | Severity: Normal
Keywords: template block | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
The block is a core feature in the template system. Currently, the syntax
provides no explicit grammar to differentiate between a placeholder block
and a content provider block. In this ticket, an optional and fully
backward compatible syntax is proposed to mark a block as a content
provider. This new syntax enhances readability, and imposes little effort
to implement, and opens the door to allow multiple occurrences of the same
block in a single template being given different contents on different
conditions (this feature has been requested many times over the years).
Here is the proposed syntax illustrated with an example:
{{{
{% block usertools = %} here are my user tools. {% endblock %}
}}}
Note the equal sign in the end of the block opening mark, which is an
optional element added here to indicate that this is not a placeholder,
but a content provider for the block named 'usertools' defined somewhere
else.
If this syntax is implemented, the multiple occurrence of such content
providers in a single template file can be allowed in the future if deemed
desirable.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35636>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.