For the love of god, why did it take me 3 months to find a command to chomp white space? You're sick unto death of having to view the source of your html after a template has produced it and it's full of blank lines? Follow the link. All you need to do is add a "-" to your template toolkit markup.
[% some command here %]
becomes
[% some command here -%]
I suppose the overarching meta point here? Read documentation even when you don't think you need it directly for the task at hand. You'll find all sorts of goodies in there.
Subscribe to:
Post Comments (Atom)
If you have control over the bit of code which creates the Template processor object itself, you can pass new() a parameter that chomps whitespace:
ReplyDeleteTemplate->new( POST_CHOMP => 1, .... )
(Found this in the source of CGI::Prototype::Hidden)
Which means you can keep writing
[% foo %]
Instead of
[% foo -%]