I think this discussion is focusing on template tags, not template variables. Maybe even a subset of template tags (e.g. block level tagsif, for, block, filter, etc). Template variables and inline tags (e.g. now) shouldn't have white space stripped.
In 100% of cases I can think of I either wouldn't care (in HTML templates) or I would want lines that only contain block level tags and no actual content removed from the rendered output of the template. The only time I would explicitly NOT want this to happen is when I have an existing template where white space matters and it has been carefully crafted to work around Django's white space issues. I think SmileyChris' solution from the ticket is the way to go, but in a backwards compatible way. Make it opt-in with a new template tag, similar to the way auto escaping is handled, and optionally a deprecation path that will make this the default eventually. I don't think anyone has suggested stripping ALL white space around ALL template tags, or even ANY template variables. Cheers. Tai. On Saturday, 25 February 2012 21:04:26 UTC+11, Florian Apolloner wrote: > > Hi, > > On Saturday, February 25, 2012 10:04:21 AM UTC+1, Anssi Kääriäinen wrote: >> >> In most situations white space matters: >> {{ user.lastname }} {{ user.firstname }} >> > > Right, but > """ > {{ user.lastname }} > {{ user.firstname }} > """ > would have produced exactly the same output in HTML, hence my statement > that you usually don't have to care about it that much. Eg, you need to > make sure that there is whitespace but it doesn't matter how much since > it's collapsed anyways (and outside of tags it doesn't matter at all…) > > Cheers, > Florian > On Saturday, 25 February 2012 21:04:26 UTC+11, Florian Apolloner wrote: > > Hi, > > On Saturday, February 25, 2012 10:04:21 AM UTC+1, Anssi Kääriäinen wrote: >> >> In most situations white space matters: >> {{ user.lastname }} {{ user.firstname }} >> > > Right, but > """ > {{ user.lastname }} > {{ user.firstname }} > """ > would have produced exactly the same output in HTML, hence my statement > that you usually don't have to care about it that much. Eg, you need to > make sure that there is whitespace but it doesn't matter how much since > it's collapsed anyways (and outside of tags it doesn't matter at all…) > > Cheers, > Florian > On Saturday, 25 February 2012 21:04:26 UTC+11, Florian Apolloner wrote: > > Hi, > > On Saturday, February 25, 2012 10:04:21 AM UTC+1, Anssi Kääriäinen wrote: >> >> In most situations white space matters: >> {{ user.lastname }} {{ user.firstname }} >> > > Right, but > """ > {{ user.lastname }} > {{ user.firstname }} > """ > would have produced exactly the same output in HTML, hence my statement > that you usually don't have to care about it that much. Eg, you need to > make sure that there is whitespace but it doesn't matter how much since > it's collapsed anyways (and outside of tags it doesn't matter at all…) > > Cheers, > Florian > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/aKbJjYcK4QIJ. 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.