Skip to content

Instantly share code, notes, and snippets.

@tomyhero
Created December 29, 2010 04:09
Show Gist options
  • Save tomyhero/758156 to your computer and use it in GitHub Desktop.
Save tomyhero/758156 to your computer and use it in GitHub Desktop.
use warnings;
use strict;
use Test::More;
use Data::Section::Simple;
use Text::Xslate;
my $reader = Data::Section::Simple->new(__PACKAGE__);
my $templates = $reader->get_data_section;
my $tx = Text::Xslate->new(
syntax => 'TTerse',
path => [ $templates ]
);
is($tx->render('koreyaritai'), $tx->render('imakousiteru'));
__DATA__
@@ koreyaritai
<html>
<head></head>
<body>
hogehoge
[% WRAPPER 'footer' INTO footer_content %]
<script>alert('hoge');</script>
[% END %]
@@ footer
[% footer_content %]
</body>
</html>
@@ imakousiteru
<html>
<head></head>
<body>
hogehoge
[% MACRO footer_content_block BLOCK %]
<script>alert('hoge');</script>
[% END %]
[% INCLUDE 'footer' WITH
footer_content = footer_content_block()
%]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment