Skip to content

Instantly share code, notes, and snippets.

@ryochin
Created November 17, 2011 09:33
Show Gist options
  • Save ryochin/1372787 to your computer and use it in GitHub Desktop.
Save ryochin/1372787 to your computer and use it in GitHub Desktop.
number str is treated as int with Xslate
#!/usr/bin/perl --
use strict;
use Text::Xslate;
my $xs = Text::Xslate->new(
syntax => 'TTerse',
);
my $template = <<'END';
[%- MACRO foo(n) BLOCK -%]
<li>n is [% n %]</li>
[%- END # macro -%]
<ul>
[% foo("01") %]
[% foo("02") %]
[% foo("03") %]
</ul>
END
print $xs->render_string( $template, {} );
__END__
<ul>
<li>n is 1</li>
<li>n is 2</li>
<li>n is 3</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment