#3090 closed enhancement (invalid)
Support for arguments on intermediate tag tokens (ex. {% if arg %}{% elif arg %}{% endif %})
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Template system | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Currently the template functionality prevents creation of tags which have intermediate tags requiring arguments.
For instance:
{% myif arg %} first block {% elif arg %} <-- current version would fail to parse this correctly because of the arg second block {% endmyif %}
The attached patch removes this restriction.
Attachments (1)
Change History (10)
comment:1 by , 18 years ago
Component: | Core framework → Template system |
---|---|
Summary: | [Patch]Extend enclose tag process → Extend enclose tag process |
by , 18 years ago
Attachment: | template.patch added |
---|
comment:2 by , 18 years ago
Summary: | Extend enclose tag process → [patch]Extend enclose tag process |
---|
I added the patch. I'm sorry forgot that.
comment:3 by , 18 years ago
I added a similar patch before stumbling on this ticket.
I took the liberty of marking mine as a duplicate: http://code.djangoproject.com/ticket/3100
comment:4 by , 18 years ago
Hi, Eric:
I checked your patch, it's very similar with mine. And I hope the patch can be accepted.
comment:5 by , 18 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Summary: | [patch]Extend enclose tag process → [patch] Extend enclose tag process |
Triage Stage: | Unreviewed → Design decision needed |
comment:9 by , 17 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
The tag presented in this snippet at djangosnippets seems to show that what you want is possible. Closing "worksforme".
comment:10 by , 15 years ago
Needs tests: | unset |
---|---|
Resolution: | worksforme |
Status: | closed → reopened |
I would like to see this change. The snippet mentioned uses multiple templatetags, and would need more to support 'default' or 'else'. http://www.djangosnippets.org/snippets/967/ shows a way to achieve this, but it's a hack that would be unnecessary with this patch.
Since the patch is so simple - it's clear by inspection that the reordering can't break anything (unless someone attempts to 'parse_until' an empty block tag) - I would really like to see its inclusion.
comment:11 by , 15 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
This ticket was closed by a core developer. If you disagree with the decision please use the django-developers mailing to discuss this
comment:12 by , 15 years ago
Description: | modified (diff) |
---|---|
Summary: | [patch] Extend enclose tag process → Support for arguments on intermediate tag tokens (ex. {% if arg %}{% elif arg %}{% endif %}) |
Following discussion on django-developers, it looks like this ticket may have been closed in error - the snippet may solve the same problem (elseif/case), but doesn't address the core issue of the ticket. The description on #3100, which was closed as a duplicate of this ticket, is much more enlightening as to the actual problem. To that end, I've reopened #3100.
I don't see a patch here...Maybe you forgot to upload it?