refactor to remove template_params
template_file will be kept separate, since it needs to be memoizedmaster
parent
abd2339312
commit
bbd7e73f64
30
IkiWiki.pm
30
IkiWiki.pm
|
@ -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 ($$;@) {
|
||||||
|
|
Loading…
Reference in New Issue