Jinja implements whitespace control by putting a minus sign after/before the % in a tag - http://jinja.pocoo.org/docs/templates/#whitespace-control - I haven't tried it myself, but it looks like {% tag -%} is equivalent to your {% tag %}{# .
On 24 February 2012 17:37, Tobia <tobia.confo...@gruppo4.eu> wrote: > Tai Lee wrote: > > I don't think adding {# to the end of lines is easy to understand at a > > glance, it doesn't even convey a hint of meaning like "dnl" does > > I beg to differ. {# is already recognized by template authors as > meaning "start of comment", and they know (or should know) that it > cannot extend through more than one line. Therefore I'd think it > intuitive that it will "eat" till the end of the line and not beyond. > > Look: > > Here are your subscriptions: > {% for thing in things %}{# > - {{ thing.name }} > You added it on {{ thing.date }} > {% endfor %}{# > you can manage your subscriptions... > > Tom Evans wrote: > > I'd be strongly -1 on anything that makes template language look more > > like m4! > > I'll tell you, m4 can be quite addictive once you grasp the basics! :) > > > This could be addressed by having a different open/close tag for tags > > which chomp the preceeding/next character if it is a newline. Eg: > > {^ for item in folder ^} > > I don't think adding new reserved characters would make the language > simpler for template authors, nor for the the template parser, nor for > the sake of backwards compatibility. {# is already part of it. > > But I can see the need to chomp whitespace before a template tag, as > well as the newline after it. > > Martin J. Laubach wrote: > > For this (avoiding newlines) the currently discussed multiline tags > > would work pretty well too without adding more cruft to the template > >language: > > > > foo bar {# > > #}baz > > If this can be accomplished without massive performance penalties, I > agree with you. > > Maybe {# #} could be made multiline at first, with special code, while > waiting for a proper implementation of generic multiline tags. This > would certainly be more forward-compatible than my proposal above > and it would solve more whitespace problems, if not all. > > Tobia > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.