diff options
author | Joey Hess <joey@kitenet.net> | 2010-04-22 15:58:06 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-04-22 15:58:06 -0400 |
commit | bbd7e73f64cb5e24965343f7e605870e060c5df1 (patch) | |
tree | 05bbe5d7040a3e0af8cc9e24b9f8f901248d6a9b | |
parent | abd233931247ef38f1b084afd5906619f02c13b6 (diff) |
refactor to remove template_params
template_file will be kept separate, since it needs to be memoized
-rw-r--r-- | IkiWiki.pm | 30 |
1 files changed, 11 insertions, 19 deletions
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 ($$;@) { |