Jonathon wrote:
> 2x seems like an awful lot, since a newline is only one byte. Are you sure?

The  output typically has multiple leading spaces on those blank
lines, presumably driven by the indenting of the original html.

DenesL wrote:
> Do you want you view or your final output to be legible and
> aesthetically pleasing according to some subjective human standard?.

Absolutely!
For instance,  I'm currently looking for a designer to style my site.
The first thing I do is surf to their home page and look at its source
code!
If I'm evangelizing web2py to colleagues, clean output helps. (makes
me prouder of my work, at least)


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

It failed, generating pages with a single line of html "<function
index at 0x01A04C70>"
  -- but --

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

worked !beautifully!  When I take care to write the template cleanly,
the rendering is also clean.

This makes a distinction between empty lines (with no characters), and
blank lines (containing only whitespace chars).
blank lines are removed, empty lines are not. (whitespace matters!)


It would be nice if web2py could make this its default rendering
behavior.

Are there other issues than <pre> blocks?


Karl



--

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