#35636: differentiate placeholder and content provider blocks
---------------------------------+--------------------------------------
     Reporter:  Yingjie Lan      |                    Owner:  (none)
         Type:  New feature      |                   Status:  new
    Component:  Template system  |                  Version:  5.0
     Severity:  Normal           |               Resolution:
     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
---------------------------------+--------------------------------------
Description changed by Yingjie Lan:

Old description:

> 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.

New description:

 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 (e.g. by using a boolean property of the
 block object), 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#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070190f238bee2-84c42b66-9d34-4c83-833a-46a82ac90b37-000000%40eu-central-1.amazonses.com.

Reply via email to