Mark Fuller wrote: > On 12/16/07, Brad Baxter <[EMAIL PROTECTED]> wrote: >> A template novice might complain that HTML::Template is adding extra >> line breaks, but of course, they are right there in the template. > > I'm not a template novice and I still complain about the extra line > breaks. I think it's debatable whether "they are right there in the > template." If the lines the <tmpl_*> tags are on are not actually > (template) content, I don't see why the line ends of those lines > should be considered emitable (template) content. The fact that so > many novices find this unintuitive would indicate it's not the correct > behavior.
I agree. For plaintext stuff, you have to jump through hoops sometimes to get it all nicely formatted. I have some hideously long <tmpl_loop><tmpl_if ..> lines just to avoid all those added newlines. There's a conflict between indenting your template for readability, and the amount of whitespace that ends up in the output. Take this simple snippet: --- >8 --- <tmpl_loop foo> <tmpl_if bar> * <tmpl_var baz> </tmpl_if> </tmpl_loop> --- >8 --- I'd really like this to generate: --- >8 --- * item 1 * item 2 * item 3 --- >8 --- Instead, we get --- >8 --- * item 1 * item 2 * item 3 --- >8 --- To get the desired output, you'd have to write your template like this: --- >8 --- <tmpl_loop foo><tmpl_if bar>* <tmpl_var baz> </tmpl_if></tmpl_loop> --- >8 --- This gets painful pretty quickly. > But, if it would burden H:T with cumbersome logic, I've always been in > favor of leaving it alone for the sake of simplicity (which I like > about H:T). While I'm not a TT user, I do like the [% var -%] syntax to suppress the trailing newlines. The main reason why I have never bothered looking into this, is that we use H::T primarily for HTML generation, where the extra whitespace has no significance (in fact, we run it through HTML::Tidy afterwards anyway). rhesa ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users