diff --git a/Makefile.PL b/Makefile.PL
index 15cae6d..c4ef2bb 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -18,6 +18,8 @@ requires 'Template';
requires 'Template::Stash::EscapeHTML';
requires 'Scalar::Util';
requires 'FormValidator::Lite';
+requires 'JSON::XS';
+requires 'Text::MicroTemplate::Extended';
test_requires 'Test::More';
test_requires 'Test::Exception';
diff --git a/lib/Kamui/Manual/JA/Tutorial.pod b/lib/Kamui/Manual/JA/Tutorial.pod
index 9025d0f..20d831b 100644
--- a/lib/Kamui/Manual/JA/Tutorial.pod
+++ b/lib/Kamui/Manual/JA/Tutorial.pod
@@ -31,7 +31,9 @@ Kamui::Manual::JA::Tutorial - Kamui 日本語チュートリアル
| |-- script
| | `-- Hello.psgi
| `-- tmpl
- | |-- base.html
+ | `-- common
+ | `-- header.html
+ | `-- footer.html
| `-- root
| `-- index.html
|-- config.pl
diff --git a/script/kamui.pl b/script/kamui.pl
index f148d34..b07718b 100755
--- a/script/kamui.pl
+++ b/script/kamui.pl
@@ -14,28 +14,28 @@
my $confsrc = <<'...';
-- lib/$path.pm
-package [%= $module %];
+package <%= $module %>;
1;
--- lib/$path/Web.pm
-package [%= $module %]::Web;
+-- lib/$path/Web/Handler.pm
+package <%= $module %>::Web::Handler;
use Kamui;
-use base 'Kamui::Web';
+use base 'Kamui::Web::Handler';
-use [%= $module %]::Web::Context;
-sub context {'[%= $module %]::Web::Context'}
+use <%= $module %>::Web::Context;
+sub context {'<%= $module %>::Web::Context'}
-use [%= $module %]::Web::Dispatcher;
-sub dispatcher {'[%= $module %]::Web::Dispatcher'}
+use <%= $module %>::Web::Dispatcher;
+sub dispatcher {'<%= $module %>::Web::Dispatcher'}
sub view {'Kamui::View::TT'}
sub plugins {['Encode']}
-use [%= $module %]::Container -no_export;
-sub container { [%= $module %]::Container->instance }
+use <%= $module %>::Container -no_export;
+sub container { <%= $module %>::Container->instance }
1;
-- lib/$path/Web/Dispatcher.pm
-package [%= $module %]::Web::Dispatcher;
+package <%= $module %>::Web::Dispatcher;
use Kamui::Web::Dispatcher;
on '/' => run {
@@ -44,12 +44,12 @@ package [%= $module %]::Web::Dispatcher;
1;
-- lib/$path/Web/Context.pm
-package [%= $module %]::Web::Context;
+package <%= $module %>::Web::Context;
use Kamui;
use base 'Kamui::Web::Context';
1;
-- lib/$path/Web/Controller/Root.pm
-package [%= $module %]::Web::Controller::Root;
+package <%= $module %>::Web::Controller::Root;
use Kamui::Web::Controller -base;
__PACKAGE__->add_trigger(
@@ -60,11 +60,13 @@ package [%= $module %]::Web::Controller::Root;
sub do_index {
my ($class, $c, $args) = @_;
+ $c->stash->{title} = 'kamui page';
+ $c->stash->{content} = 'hello, Kamui world!';
}
1;
-- lib/$path/Container.pm
-package [%= $module %]::Container;
+package <%= $module %>::Container;
use Kamui::Container -base;
register foo => sub {
@@ -72,39 +74,38 @@ package [%= $module %]::Container;
};
1;
--- assets/tmpl/root/index.html
-? extends 'base.html';
-? block title => 'kamui page';
-? block content => sub { 'hello, Kamui world!' };
--- assets/tmpl/base.html
+-- assets/tmpl/common/header.html
- block title => 'Kamui' ?>
+ [% title | html %]
+-- assets/tmpl/root/index.html
+[% INCLUDE common/header.html %]
- block content => 'body here' ?>
+ [% content | html %]
+[% INCLUDE common/footer.html %]
+-- assets/tmpl/common/footer.html
-- assets/script/$dist.psgi
-use [%= $module %]::Web::Handler;
-use [%= $module %]::Container;
+use <%= $module %>::Web::Handler;
+use <%= $module %>::Container;
use Plack::Builder;
-my $app = [%= $module %]::Web::Handler->new;
-$app->setup;
+my $app = <%= $module %>::Web::Handler->new;
my $home = container('home');
builder {
@@ -116,14 +117,14 @@ package [%= $module %]::Container;
};
-- config.pl
use Kamui;
-use [%= $module %]::Container;
+use <%= $module %>::Container;
use Path::Class;
my $home = container('home');
return +{
view => {
- mt => +{
+ tt => +{
path => $home->file('assets/tmpl')->stringify,
},
},
@@ -167,6 +168,7 @@ sub main {
_mkpath "assets/htdocs/css/";
_mkpath "assets/htdocs/img/";
_mkpath "assets/tmpl/root/";
+ _mkpath "assets/tmpl/common/";
_mkpath "assets/script/";
_mkpath "t/";
@@ -174,8 +176,8 @@ sub main {
while (my ($file, $tmpl) = each %$conf) {
$file =~ s/(\$\w+)/$1/gee;
my $code = Text::MicroTemplate->new(
- tag_start => '[%',
- tag_end => '%]',
+ tag_start => '<%',
+ tag_end => '%>',
line_start => '%',
template => $tmpl,
)->code;
diff --git a/t/030_plugin/mobile/agent.t b/t/030_plugin/mobile/agent.t
index e420648..c6b9448 100644
--- a/t/030_plugin/mobile/agent.t
+++ b/t/030_plugin/mobile/agent.t
@@ -5,7 +5,7 @@ use Mock::Web::Handler;
BEGIN {
eval "use HTTP::MobileAgent";
- plan skip_all => 'needs HTP::MobileAgent for testing' if $@;
+ plan skip_all => 'needs HTTP::MobileAgent for testing' if $@;
};
my $plugins = [qw/Mobile::Agent/];
diff --git a/t/030_plugin/mobile/css_filter.t b/t/030_plugin/mobile/css_filter.t
index 66ffac5..4119e49 100644
--- a/t/030_plugin/mobile/css_filter.t
+++ b/t/030_plugin/mobile/css_filter.t
@@ -6,7 +6,7 @@ use Mock::Container;
BEGIN {
eval "use HTTP::MobileAgent";
- plan skip_all => 'needs HTP::MobileAgent for testing' if $@;
+ plan skip_all => 'needs HTTP::MobileAgent for testing' if $@;
eval "use HTML::MobileJpCSS";
plan skip_all => 'needs HTML::MobileJpCSS for testing' if $@;
};
diff --git a/t/030_plugin/mobile/docomo_guid_filter.t b/t/030_plugin/mobile/docomo_guid_filter.t
index 7d19d0d..6d621e3 100644
--- a/t/030_plugin/mobile/docomo_guid_filter.t
+++ b/t/030_plugin/mobile/docomo_guid_filter.t
@@ -5,7 +5,7 @@ use Mock::Web::Handler;
BEGIN {
eval "use HTTP::MobileAgent";
- plan skip_all => 'needs HTP::MobileAgent for testing' if $@;
+ plan skip_all => 'needs HTTP::MobileAgent for testing' if $@;
eval "use HTML::StickyQuery::DoCoMoGUID";
plan skip_all => 'needs HTML::StickyQuery::DoCoMoGUID for testing' if $@;
};
diff --git a/t/030_plugin/mobile/emoji_filter.t b/t/030_plugin/mobile/emoji_filter.t
index d718559..b38d390 100644
--- a/t/030_plugin/mobile/emoji_filter.t
+++ b/t/030_plugin/mobile/emoji_filter.t
@@ -5,7 +5,7 @@ use Mock::Web::Handler;
BEGIN {
eval "use HTTP::MobileAgent";
- plan skip_all => 'needs HTP::MobileAgent for testing' if $@;
+ plan skip_all => 'needs HTTP::MobileAgent for testing' if $@;
};
my $plugins = [qw/Encode Mobile::EmojiFilter/];