Re: [htmltmpl] extra whitespace
Brought to you by:
samtregar
From: Mark A. F. <mar...@ea...> - 2006-02-08 23:24:29
|
From: Alex Teslik <al...@ac...> > I am dealing with the formatting of a lot of plain text in <pre> and <p> tags. You can write a regex to remove whitespace only following TMPL_* tags. It doesn't have to remove *just* linefeeds or remove all linefeeds in the file. > I think the additional whitespace is also unexpected behavior. ... Expected behavior is a matter of learning how the tool works. On the one hand I agree with you that it seems intuitive that a TMPL_* tag standing on its own shouldn't leave a residual linefeed. But, what if *I* want it to? Now the solution is to add an attribute to every TMPL_* tag indicating whether it should keep or delete a trailing linefeed? And, what if I prefer using spaces or tabs for readibility? Maybe I don't stack the tags on multiple lines, but use tabs or spaces to indent them? Why shouldn't H::T do the intuitive thing with those too? The bottom line is: 1) *You* added the whitespace. 2) The whitespace doesn't affect the resulting HTML or its rendering. 3) You work with the template, not the resulting HTML. The whitespace in the resulting HTML shouldn't affect anyone. 4) Viewing the resulting HTML is not "rendering." 5) If bandwidth is an issue, stripping *all* whitespace (for H::T tags and HTML tags) using the filter option is better than stripping just a few. That was what was argued to me a year or two ago. I ended up accepting it as the correct way to look at the issue. You can always wait for the Capital One guy (Sam) to come out and say "No." :) (In the US we have a commercial where Dana Carvey plays a credit card helddesk guy who's answer to everything is "No." Every time I see it I think of Sam.). Mark |