Opened 9 years ago

Closed 9 years ago

#696 closed enhancement (wontfix)

add newline-suppression to {% and {{

Reported by: hugo Owned by: adrian
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: UI/UX:


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 ;)

Attachments (0)

Change History (4)

comment:1 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to closed

Too Perlish!

comment:2 Changed 9 years ago by Tim Keating

  • Resolution wontfix deleted
  • Status changed from closed to reopened

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 9 years ago by anonymous

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

comment:4 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from reopened to closed

I'm marking this as a wontfix again.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.