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;
}
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 ($$;@) {