Opened 14 years ago

Closed 14 years ago

#696 closed enhancement (wontfix)

add newline-suppression to {% and {{

Reported by: hugo Owned by: Adrian Holovaty
Component: Template system Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Both {{ and {% could be closeable with -}} and -%} to suppress a newline if the ending is at the end of the line, too. This would help to make more readable templates for formats that are whitespace-sensitive - currently you would have to write all template code in one line if the output should be just one line. With newline suppression, one could break long lines and still only get one line output.

And yes, I know that it is shamelessly stolen from the ERb definition ;)

Change History (4)

comment:1 Changed 14 years ago by Adrian Holovaty

Resolution: wontfix
Status: newclosed

Too Perlish!

comment:2 Changed 14 years ago by Tim Keating

Resolution: wontfix
Status: closedreopened

I agree with the sentiment about the syntax, but like hugo I find the blank lines in my (otherwise pristine) outputted HTML really annoying. It seems to me this is would be solved by stripping any whitespace up to and including the newline following any {% end %} tag (doesn't address the issue of having to do {{}} inline, but that's not as troublesome, in my experience).

The possiblity exists that this might make output too squished, but it's easy enough to add extra newlines. I don't have a way to address the present situation short of writing my own middleware, which seems excessive . . .

comment:3 Changed 14 years ago by anonymous

Sorry, that should say "any {% %} tag"

comment:4 Changed 14 years ago by Adrian Holovaty

Resolution: wontfix
Status: reopenedclosed

I'm marking this as a wontfix again.

Note: See TracTickets for help on using tickets.
Back to Top