Opened 16 years ago

Closed 15 years ago

#8652 closed (wontfix)

Multiline tags and tag escape tags

Reported by: Michael Manfre <mmanfre@…> Owned by: nobody
Component: Template system Version: dev
Severity: Keywords: escape multiline
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


Multiline tag support would help make templates more readable and allow support for the ability to escape chunks of a template so that they are not parsed.

Multiline tag example:

{# This is a length comment that would benefit from multiple lines

due to its verbosity or some other reason #}

Tag escaping:
I have run in to the need to display template syntax to the end user. Being able to escape a chunk of the text so that the template parser ignores it would clean up the existing template. Some of the existing methods for passing template syntax through the parser unmolested is to use html entity escaping to trick the lexer, or use the very verbose "templatetag" tag.

Attached is a patch that provides the mentioned multiline tag support and provides tags that allow escaping blocks of template text.

Escaping example:

"{$ {% if foo %}...{% endif %} $}" would output "{% if foo %}...{% endif %}"

Attachments (1)

django-multiline-tags-with-no-raw-r8662.diff (2.1 KB ) - added by Michael Manfre <mmanfre@…> 16 years ago.
Patch to add multiline tag support and escape tag syntax

Download all attachments as: .zip

Change History (4)

by Michael Manfre <mmanfre@…>, 16 years ago

Patch to add multiline tag support and escape tag syntax

comment:1 by Jacob, 16 years ago

milestone: 1.0

We're quite a ways past feature freeze for 1.0;.

comment:2 by Chris Beaven, 15 years ago

Triage Stage: UnreviewedDesign decision needed

Multi-line tags have been poo-pooed in the past (#3888) but I can see how it's important for this functionality.

Personally I'm -0 about the need for such a raw escape tag, but I'll pass it through a design decision.

comment:3 by Malcolm Tredinnick, 15 years ago

Resolution: wontfix
Status: newclosed

This looks a lot like two requests in one ticket and we all know how that isn't a good approach.

  1. Multiline template tags aren't going to happen. We've made a decision on that plenty of times.
  2. Adding a whole extra way to write template tags just to support this one particular use-case when you could just as easily write a shorter template tag for your own use is adding a bunch of maintenance overhead to Django for not a lot of gain. We have to keep the code correct, keep the documentation correct, explain it to people, incorporate the testing overhead, etc. Not worth it. If you have a need to do this a lot and don't want to write out "templatetag", write a shorter tag that calls templatetag internally. Or write a pre-processor for your templates. But this isn't worth adding code to Django for.
Note: See TracTickets for help on using tickets.
Back to Top