You can do

     {{for d in data[:3]:
       = "hi" 
       pass}}

to achieve when you want.

On Tuesday, 10 July 2012 16:08:40 UTC-5, Rob wrote:
>
> Hi,
>
> I'm using the standalone template.py to generate non html files and the 
> excess whitespace is making this somewhat painful.
>
> For example, my view:
> #ifndef __BLAH__
> #define __BLAH__
>     {{for d in data[:3]:}}
>       {{= "hi"}} 
>     {{pass}}
> #endif
>
> outputs:
> #ifndef __BLAH__
> #define __BLAH__
>     
>       hi 
>     
>       hi 
>     
>       hi 
>     
> #endif
>
> I'm sure there are lots of reasons why this can't happen, but I propose 
> that render() simply removes lines that contain nothing but whitespace and 
> logic. For example, given the same view:
> 1 #ifndef __BLAH__
> 2 #define __BLAH__
> 3     {{for d in data[:3]:}}
> 4       {{= "hi"}} 
> 5     {{pass}}
> 6 #endif 
>
> Line number 3 and 6 contain nothing but template logic and whitespace 
> (with excess carriage returns).  Is there a reason why the rendering engine 
> couldn't simply remove this whitespace from the output?  IE: if the line 
> contains pure logic ({{...}}) and whitespace, just remove it.  If the line 
> contains {{=..}} and other whitespace then it stays.
>
> Does this break all sorts of HTML output?
>
> Thanks,
> Rob
>

Reply via email to