X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/1d61c4d4d690624f6d6fb34b6decd5507a003298..2863b45b5f93de8708ea20cf3db15ca610a467d7:/IkiWiki/Plugin/pagetemplate.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/pagetemplate.pm b/IkiWiki/Plugin/pagetemplate.pm index 69a2433a8..99a66ee96 100644 --- a/IkiWiki/Plugin/pagetemplate.pm +++ b/IkiWiki/Plugin/pagetemplate.pm @@ -8,17 +8,26 @@ use IkiWiki 2.00; my %templates; sub import { #{{{ + hook(type => "getsetup", id => "pagetemplate", call => \&getsetup); hook(type => "preprocess", id => "pagetemplate", call => \&preprocess); hook(type => "templatefile", id => "pagetemplate", call => \&templatefile); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub preprocess (@) { #{{{ my %params=@_; if (! exists $params{template} || $params{template} !~ /^[-A-Za-z0-9._+]+$/ || ! defined IkiWiki::template_file($params{template})) { - return "[[pagetemplate ".gettext("bad or missing template")."]]"; + error gettext("bad or missing template") } if ($params{page} eq $params{destpage}) {