From: Joey Hess Date: Thu, 22 Apr 2010 19:58:06 +0000 (-0400) Subject: refactor to remove template_params X-Git-Tag: 3.20100427~53 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bbd7e73f64cb5e24965343f7e605870e060c5df1;p=ikiwiki.git refactor to remove template_params template_file will be kept separate, since it needs to be memoized --- diff --git a/IkiWiki.pm b/IkiWiki.pm index 1327e4db5..0aaf60569 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1664,23 +1664,8 @@ sub template_file ($) { return; } -sub template_params (@) { - filter => sub { - my $text_ref = shift; - ${$text_ref} = decode_utf8(${$text_ref}); - }, - loop_context_vars => 1, - die_on_bad_params => 0, - @_, - no_includes => 1, -} - sub template ($;@) { - require HTML::Template; - return HTML::Template->new(template_params( - filename => template_file(shift), - @_ - )); + template_depends(shift, undef, @_); } sub template_depends ($$;@) { @@ -1693,10 +1678,17 @@ sub template_depends ($$;@) { my $filename=template_file($name); require HTML::Template; - return HTML::Template->new(template_params( + return HTML::Template->new( + filter => sub { + my $text_ref = shift; + ${$text_ref} = decode_utf8(${$text_ref}); + }, + loop_context_vars => 1, + die_on_bad_params => 0, filename => $filename, - @_ - )); + @_, + no_includes => 1, + ); } sub misctemplate ($$;@) {