Permalink
Browse files

switch from MENTA::Template to Text::MicroTemplate

git-svn-id: http://svn.coderepos.org/share/lang/perl/NanoA/trunk@27214 d0d07461-0603-4401-acd4-de1884942a52
  • Loading branch information...
1 parent dabaafd commit 8f95c4f9f7c522447672281cc4e83fb902605efb kazuho committed Dec 22, 2008
Showing with 8 additions and 7 deletions.
  1. +3 −3 lib/NanoA.pm
  2. +1 −1 lib/NanoA/Dispatch.pm
  3. +4 −3 lib/NanoA/TemplateLoader.pm
View
@@ -151,7 +151,7 @@ sub package_to_path {
sub escape_html {
my $str = shift;
return $$str
- if ref $str eq 'MENTA::Template::raw_string';
+ if ref $str eq 'Text::MicroTemplate::EncodedString';
$str =~ s/&/&/g;
$str =~ s/>/>/g;
$str =~ s/</&lt;/g;
@@ -163,9 +163,9 @@ sub escape_html {
# create raw string (that does not need to be escaped)
sub raw_string {
my $s = shift;
- ref $s eq 'MENTA::Template::RawString'
+ ref $s eq 'Text::MicroTemplate::EncodedString'
? $s
- : bless \$s, 'MENTA::Template::RawString';
+ : bless \$s, 'Text::MicroTemplate::EncodedString';
}
sub uri_escape {
View
@@ -35,7 +35,7 @@ sub dispatch {
$handler->run_hooks('prerun');
my $body = $handler->run();
$body = $$body
- if ref $body eq 'MENTA::Template::RawString';
+ if ref $body eq 'Text::MicroTemplate::EncodedString';
$handler->run_hooks('postrun', \$body);
$handler->print_header();
@@ -26,10 +26,11 @@ sub __load {
sub __compile {
my ($path, $module) = @_;
- NanoA::require_once('MENTA/Template.pm');
- my $t = MENTA::Template->new;
+ NanoA::require_once('Text/MicroTemplate.pm');
+ my $t = Text::MicroTemplate->new(
+ escape_func => 'NanoA::escape_html',
+ );
$t->parse(NanoA::read_file($path));
- $t->build();
my $code = $t->code();
my $global = ''; # for now $t->global();
#intentially adds space before 'use', so that it would not be erased by tools/concat.pl

0 comments on commit 8f95c4f

Please sign in to comment.