I'm converting some PHP to TT and am having trouble with the extra
whitespace that's left behind after TT does its processing. This extra
\s+ throws out some HTML renderers like IE.
For example,
<td>
[% IF 1 %]
<img src="foo.jpg">
[% END %]
</td>
the best I can get (with POST_CHOMP and FILTER collapse) is,
<td> <img src="foo.jpg"></td>
That extra space between the td and img can damage the rendering.
Is there a way to have TT remove this extra whitespace?
**
I came up with a solution, but would rather something that's already in
core.
$template->context->define_filter( scrunch => sub {
my $data = $_[0];
s/(?<=[^\w\s])\s+//g, s/\s+(?=[^\w\s])//g for $data;
$data;
});
Is there a way to have TT apply this filter to its whole output?
Paul
--
Paul Makepeace .............................. http://paulm.com/inchoate/
"If you are not you, then you've got a disco on your hands."
-- http://paulm.com/toys/surrealism/
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates