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.
> 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.
On Sun, Feb 5, 2012 at 5:42 PM, Cosmia Luna <cosm...@gmail.com> wrote: > Sure it's of little use in production environment, but useful > in development environment to debug the final html and find what's broken if > there is.