On Tue, 1 Feb 2011 15:41:58 +0000, Roger Burton West wrote
> On Tue, Feb 01, 2011 at 05:14:36PM +0200, Offer Kaye wrote:
> 
> >Is there any other solution?
> 
> You've covered the two most usual approaches. Anything else will involve
> processing the string you get from the output() function.

$htmltemplatefilters = [
                          # remove any space at the start of a line if it is
immediately before a tmpl tag
                          { sub => sub { my $text_aref = shift; s#^[\t
]+(</?tmpl_[^>]+>)#$1#gi for @{$text_aref} },
                            format => 'array' },
                          # remove any \n and \r following a tmpl tag
                          { sub => sub { my $text_ref = shift; $$text_ref =~
s#(</?tmpl_[^>]+>)[\r\n]+#$1#sgi },
                            format => 'scalar' },
                       ];

      my $template = HTML::Template->new(
                                           filename          =>
get_template('example.tmpl'),
                                           filter            =>
$htmltemplatefilters,
                                        );

thats how we handle it. So our code is readable, but the output result is
formatted correctly.

HTH,
Alex

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to