Posted on 2009-11-02 08:09:44-08 by eduard
Template::Stash::EscapeHTML with Macro's
Hi, I have been using Template::Stash::EscapeHTML and recetly I tried to make a BLOCK MACRO for some HTML that is used in several places and it turned out the content of the macro gets escaped. This seems strage to me, so my question is: Is this a bug or a feature. In the following example the <b> and </b> tags in the MACRO definition get escaped.
use strict; use warnings; use Template; use Template::Stash::EscapeHTML; my $template = Template->new( STASH => Template::Stash::EscapeHTML->new(), ); my $data = {}; my $contents = <<'END'; [% MACRO hi(t) BLOCK %] xx <b>[% t %]</b> xx [% END %] [% hi('one') %] [% hi('two') %] END print $template->process(\$contents, $data), "\n";
Should I report this as a bug? Kind reguards, Eduard
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.