Le 04/02/2012 21:48, Cosmia Luna a écrit :
It's very difficult to manage the whitespaces in template by '-' mark,
and usually makes the template difficult to read when try to output
indented HTML. It's of little use in production environment, but very
useful in development environment. I tried pytidylib but tidy can only
filter XHTML and HTML4 or before, it replaced my '<!DOCTYPE html>'
(html5) with its one and CORRECT something but valid.
How can I just re-indent the HTML without the correction? The input HTML
is guaranteed valid.
Hi,
I tried quite a few thing to do that, from careful usage of '-' as you
say, to Jinja2 macros that re-indented stuff. I eventually gave up.
In production, the only concern is file size but if you use gzip the
difference is negligible. (Or not worth the complexity, IMO.) In
development, I find that I use Firebug much more than view source. In
other words, I care about the parsed DOM, not the HTML.
So the only remaining thing to optimize for is source (template)
readability. I try to generally indent both Jinja blocks and HTML elements.
Regards,
--
Simon Sapin
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en.