Re: Strip empty lines in rendered templates?

2009-03-26 Thread darryl.hebbes
Or simply remove the return after the forloop statement. Like so. {% for entry in entries %}{{ entry.title }} {% endfor %} should give you Title 1 Title 1 Title 1 On Mar 15, 9:13 pm, Benjamin Buch wrote: > Hi, > > is there a way to tighten up the output that Django renders? > Especial

Re: Strip empty lines in rendered templates?

2009-03-24 Thread chachra
Would the {% spaceless %} template tag be helpful here ? I posted a similar question, and someone responded saying that may be the way to go. Cheers! Sumit On Mar 16, 9:45 am, Benjamin Buch wrote: > Yes, you're right. > > But as the SpacelessMiddleware uses djangos' strip_spaces_between_tags,

Re: Strip empty lines in rendered templates?

2009-03-16 Thread Benjamin Buch
Yes, you're right. But as the SpacelessMiddleware uses djangos' strip_spaces_between_tags, which strips all whitespace between tags and not just empty lines, I think it would have been fiddly to adapt it without touching django internals. In this case it seemed easier for me to use StripWhitesp

Re: Strip empty lines in rendered templates?

2009-03-16 Thread Dougal Matthews
You could adapt that middlewear to make it only stop blank lines I'm sure. I use it for one website and its only used in the production version, in my settings for the dev version it doesn't include that middlewear so it doesn't effect any front end development. Only thing to be aware of is it mes

Re: Strip empty lines in rendered templates?

2009-03-16 Thread Benjamin Buch
Thank you for your replies! What I essentially want to do is: 1: Keep the template output readable for the frontend coder I'm working with 2: Keep the templates readable for me. @Dougal: I think the solution you suggested is great when someone wants to keep the size of the rendered template

Re: Strip empty lines in rendered templates?

2009-03-15 Thread Tim Chase
> This template code: > > > {% for entry in entries %} > {{ entry.title }} > {% endfor %} > > > looks like this when rendered: > > > > Title 1 > > Title 1 > > Title 1 > > While it goes against my aesthetic tastes for making easy-to-read templates (I much prefer my templates look like

Re: Strip empty lines in rendered templates?

2009-03-15 Thread Dougal Matthews
Something like this might be able to help you? http://www.davidcramer.net/code/369/spaceless-html-in-django.html Dougal --- Dougal Matthews - @d0ugal http://www.dougalmatthews.com/ 2009/3/15 Benjamin Buch > > Hi, > > is there a way to tighten up the output that Django renders? > Especially,

Strip empty lines in rendered templates?

2009-03-15 Thread Benjamin Buch
Hi, is there a way to tighten up the output that Django renders? Especially, remove the empty lines? This template code: {% for entry in entries %} {{ entry.title }} {% endfor %} looks like this when rendered: Title 1 Title 1 Title 1 I stumbled upon this middleware, http://code.djang