HTML-Template-Compiled-Plugin-VBEscape
view release on metacpan or search on metacpan
example/01_escape.pl view on Meta::CPAN
our $VERSION = 0;
use HTML::Template::Compiled;
my $htc = HTML::Template::Compiled->new(
plugin => [qw(HTML::Template::Compiled::Plugin::VBEscape)],
tagstyle => [qw(-classic -comment +asp)],
scalarref => \<<'EOVB');
<script language="VBScript"><!--
string1 = "<%= attribute ESCAPE=VB%>"
string2 = "<%= cdata ESCAPE=VB%>"
'--></script>
EOVB
$htc->param(
attribute => 'foo "bar"',
cdata => 'text "with" double quotes',
);
() = print $htc->output();
# $Id$
__END__
Output:
<script language="VBScript"><!--
example/02_default_escape.pl view on Meta::CPAN
use HTML::Template::Compiled;
my $htc = HTML::Template::Compiled->new(
plugin => [qw(HTML::Template::Compiled::Plugin::VBEscape)],
tagstyle => [qw(-classic -comment +asp)],
default_escape => 'VB',
scalarref => \<<'EOVB');
<script language="VBScript"><!--
string1 = "<%= attribute%>"
string2 = "<%= cdata%>"
'--></script>
EOVB
$htc->param(
attribute => 'foo "bar"',
cdata => 'text "with" double quotes',
);
() = print $htc->output();
# $Id$
__END__
Output:
<script language="VBScript"><!--
lib/HTML/Template/Compiled/Plugin/VBEscape.pm view on Meta::CPAN
use HTML::Template::Compiled::Plugin::VBEscape;
my $htc = HTML::Template::Compiled->new(
plugin => [qw(HTML::Template::Compiled::Plugin::VBEscape)],
tagstyle => [qw(-classic -comment +asp)],
scalarref => \<<'EOVB');
);
<script language="VBScript"><!--
string1 = "<%= attribute ESCAPE=VB%>"
string2 = "<%= cdata ESCAPE=VB%>"
'--></script>
EOVB
$htc->param(
attribute => 'foo "bar"',
cdata => 'text "with" double quotes',
);
print $htc->output();
Output:
<script language="VBScript"><!--
string1 = "foo ""bar"""
string2 = "text ""with"" double quotes"
'--></script>
t/01_escape.t view on Meta::CPAN
use_ok('HTML::Template::Compiled');
use_ok('HTML::Template::Compiled::Plugin::VBEscape');
}
my $htc = HTML::Template::Compiled->new(
tagstyle => [qw(-classic -comment +asp)],
plugin => [qw(HTML::Template::Compiled::Plugin::VBEscape)],
scalarref => \<<'EOT');
<script language="VBScript"><!--
string1 = "<%= attribute%>"
string2 = "<%= cdata ESCAPE=VB%>"
string3 = "<%= undef ESCAPE=VB%>"
'--></script>
EOT
$htc->param(
attribute => 'foo "bar"',
cdata => 'text "with" double quotes',
undef => undef,
);
is $htc->output(), <<'EOT', 'escape VB script';
<script language="VBScript"><!--
string1 = "foo "bar""
string2 = "text ""with"" double quotes"
string3 = ""
'--></script>
EOT
;
t/02_default_escape.t view on Meta::CPAN
use_ok('HTML::Template::Compiled::Plugin::VBEscape');
}
my $htc = HTML::Template::Compiled->new(
tagstyle => [qw(-classic -comment +asp)],
plugin => [qw(HTML::Template::Compiled::Plugin::VBEscape)],
default_escape => 'VB',
scalarref => \<<'EOT');
<script language="VBScript"><!--
string1 = "<%= attribute ESCAPE=0%>"
string2 = "<%= cdata%>"
string3 = "<%= undef%>"
'--></script>
EOT
$htc->param(
attribute => 'foo "bar"',
cdata => 'text "with" double quotes',
undef => undef,
);
is $htc->output(), <<'EOT', 'escape VB script';
<script language="VBScript"><!--
string1 = "foo "bar""
string2 = "text ""with"" double quotes"
string3 = ""
'--></script>
EOT
;
( run in 0.608 second using v1.01-cache-2.11-cpan-454fe037f31 )