I am open tu suggestions. Right now web2py does not introduce any
additional \n. Any new line is already in the original template.

You can do something like this in your controller

def filter(d):
    import re
    if isinstance(d,dict):
         return re.compile('\n\n').sub('\n',response.render(d))
    return d
response._caller=filter

I would not automate it since it is not obvious to me one wants to do
this all the time.

Massimo

On Dec 14, 6:06 pm, kbochert <kboch...@copper.net> wrote:
> In a view, I have a paginator with code that looks like:
>
>    <div id='paginator'>
>       {{if ARGS.currentpage == 1:}}
>          <span class="pagerdisabled">----</span>
>       {{else:}}
>          <a href="./{{=ARGS.currentpage - 1}}">Prev</a>
>       {{pass}}
>
>       {{for i in range(1,ARGS.pagecnt+1):}}
>          {{if i == ARGS.currentpage:}}
>             <li class='pagersel'><a href="./{{=i}}">{{=i}}</a></li>
>          {{else:}}
>             <li><a href="./{{=i}}">{{=i}}</a></li>
>          {{pass}}
>       {{pass}}
>       {{if ARGS.currentpage == ARGS.pagecnt:}}
>          <span class="pagerdisabled">Next</span>
>       {{else:}}
>          <a href="./{{=ARGS.currentpage+1}}">Next</
> a>
>       {{pass}}
>    </div>
>
> Works great, but the generated html looks like:
>
>   <div id='paginator'>
>
>          <a href="./2">Prev</a>
>
>             <li><a href="./1">1</a></li>
>
>             <li><a href="./2">2</a></li>
>
>             <li class='pagersel'><a href="./3">3</a></li>
>
>             <li><a href="./4">4</a></li>
>
>             <li><a href="./5">5</a></li>
>
>             <li><a href="./6">6</a></li>
>
>          <a href="./4">Next</a>
>
>    </div>
>
> Is there something that can be done to reduce all those empty lines?
> Most of them also start with multiple spaces.
>
> It looks like every '{{...}} construct results in a blank line being
> generated, with its leading spaces. Is it possible that the template
> language processor could be a little smarter about filtering them
> out??

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to