refactor to remove template_params

template_file will be kept separate, since it needs to be memoized
master
Joey Hess 2010-04-22 15:58:06 -04:00
parent abd2339312
commit bbd7e73f64
1 changed files with 11 additions and 19 deletions

View File

@ -1664,23 +1664,8 @@ sub template_file ($) {
return; 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 ($;@) { sub template ($;@) {
require HTML::Template; template_depends(shift, undef, @_);
return HTML::Template->new(template_params(
filename => template_file(shift),
@_
));
} }
sub template_depends ($$;@) { sub template_depends ($$;@) {
@ -1693,10 +1678,17 @@ sub template_depends ($$;@) {
my $filename=template_file($name); my $filename=template_file($name);
require HTML::Template; 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, filename => $filename,
@_ @_,
)); no_includes => 1,
);
} }
sub misctemplate ($$;@) { sub misctemplate ($$;@) {