On Fri, Feb 24, 2012 at 9:45 AM, Tom Evans <tevans...@googlemail.com> wrote: > In your folder are: > {^ for item in folder ^} > {{ item }}, > {^ endfor ^} > > This would render as "In your folder are: item1,item2,item3," > > Changing some of the carets: > > In your folder are: > {% for item in folder ^} > {{ item }}, > {^ endfor %} > > This would render as "In your folder are:\nitem1,item2,item3,\n"
Fwiw, I had a different solution to this problem once, which I implemented in a project using jinja to generate configuration files: 1. Prior to processing the template, replace all blank lines with a tag (e.g. "BLANKLINE"). 2. After processing the template, remove all blank lines. 3. Remove all instances of BLANKLINE, which restores the blank lines the author intended. This works remarkably well, and the output is easy to predict by the template author. For the case you mentioned above, you would still need to join the lines, though: {% for item in folder %}{{ item }},{% endfor %} Aron -- 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.