Skip to content

Instantly share code, notes, and snippets.

@walf443
Created January 10, 2012 05:37
Show Gist options
  • Save walf443/1587228 to your computer and use it in GitHub Desktop.
Save walf443/1587228 to your computer and use it in GitHub Desktop.
xslate not work?
use strict;
use warnings;
use Text::Xslate;
use Data::Section::Simple qw/get_data_section/;
my $xslate = Text::Xslate->new(syntax => 'TTerse');
render('simple_if');
render('declare_if');
render('problem_case');
sub render {
my $section = shift;
warn $section;
warn $xslate->render_string(get_data_section($section));
}
__DATA__
@@ declare_if
[% IF hoge %]
[% ELSE %]
[% IF fuga %]
[% ELSE %]
[% END %]
[% SET hoge = fuga %]
[% END %]
@@ simple_if
%% IF hoge
%% ELSE
%% IF fuga
%% ELSE
%% END
%% END
@@ problem_case
%% IF hoge
%% ELSE
%% IF fuga
%% ELSE
%% END
%% SET hoge = fuga;
%% END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment