On Dec 15, 2009, at 5:11 PM, kbochert wrote:

> Amazingly enough, the following snippet appears to filter excess lines
> while leaving <pre> blocks unchanged!!

You might want <pre>.*?</pre>

> 
> import re
> def remove_line(mo):
>    s = mo.group()
>    if s.startswith('<pre>'):     return s
>    return '\n'
> 
> def filter(d):
>    if not isinstance(d,dict):  d = d()
>    pat = re.compile(r'(\n\s\s+\n|(?s)<pre>.*</pre>)')
>    return pat.sub(remove_line,response.render(d))
> 
> response._caller=filter
> 
> ??
> Karl
> 
> On Dec 15, 4:14 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
>> My pre tags are generated by a WYSIWYG editor. It would be highly
>> inconvenient to edit the source it generates, just for pre tags to render
>> correctly....
>> 
>> -Thadeus


--

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