]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/pagetemplate.pm
not quite there yet
[ikiwiki.git] / IkiWiki / Plugin / pagetemplate.pm
index b5ebf623d19a08d94e669ce1940534141e46e0e1..99a66ee96964f9750ab3d2d41a6ec87755cd31a0 100644 (file)
@@ -8,23 +8,33 @@ 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}) {
                $templates{$params{page}}=$params{template};
        }
 
+       return "";
 } # }}}
 
 sub templatefile (@) { #{{{