2 package IkiWiki::Plugin::pagetemplate;
11 hook(type => "preprocess", id => "pagetemplate", call => \&preprocess);
12 hook(type => "templatefile", id => "pagetemplate", call => \&templatefile);
15 sub preprocess (@) { #{{{
18 if (! exists $params{template} ||
19 $params{template} !~ /^[-A-Za-z0-9._+]+$/ ||
20 ! defined IkiWiki::template_file($params{template})) {
21 return "[[pagetemplate ".gettext("bad or missing template")."]]";
24 if ($params{page} eq $params{destpage}) {
25 $templates{$params{page}}=$params{template};
31 sub templatefile (@) { #{{{
34 if (exists $templates{$params{page}}) {
35 return $templates{$params{page}};