Text-TagTemplate
view release on metacpan or search on metacpan
return $params{ P };
} );
my $string = qq{W: <#W P="Space: Tab:\tCR:\nLT:<GT:>Equals:=Amp:&Quote:"">};
$expected = qq{W: Space: Tab:\tCR:\nLT:<GT:>Equals:=Amp:&Quote:"};
is($t->parse($string),
$expected,
"Parameters with whitespace and interesting characters are handled right.");
$t->add_tag( EMBEDTEST => sub {
my %params = %{ $_[ 0 ] };
my $result;
foreach my $attr (sort keys %params) {
$result .= qq{$attr="$params{$attr}"};
}
return $result;
} );
$t->add_tag( EMBED_1 => sub {
my %params = %{ $_[ 0 ] };
return $params{ATTR_1};
} );
$string = qq{EMBEDDED TAG: <#EMBEDTEST name="<#EMBED_1 ATTR_1="hello">">};
$expected = q{EMBEDDED TAG: NAME="hello"} ;
is($t->parse($string),$expected,"Tags embedded in tags are handled correctly.");
$string = qq{EMBEDDED TAG: <#EMBEDTEST name="<#EMBED_1 ATTR_1="hello=world">">};
$expected = q{EMBEDDED TAG: NAME="hello=world"};
is($t->parse($string),$expected,"Are attribute values containing '=' in embedded tags are handled correctly?");
$expected = 'Zero: 0';
$t->add_tag( ZERO => sub { 0; } );
is($t->parse('Zero: <#ZERO>'),$expected,"Is 0 (zero) handled properly as a replacement value?");
my $tag_start = '&start;';
my $tag_content = '[^&]*';
my $tag_end = '&end;';
( run in 0.474 second using v1.01-cache-2.11-cpan-71847e10f99 )