]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/template.pm
add plugin safe/rebuild info (part 3 of 3)
[ikiwiki.git] / IkiWiki / Plugin / template.pm
index aa1f57c0703ebcea645bb8818ef779ffaa520d1c..a2859b2a99864ddb0e9d33cea8106b46ffbc8775 100644 (file)
@@ -9,14 +9,23 @@ use HTML::Template;
 use Encode;
 
 sub import { #{{{
 use Encode;
 
 sub import { #{{{
+       hook(type => "getsetup", id => "template", call => \&getsetup);
        hook(type => "preprocess", id => "template", call => \&preprocess);
 } # }}}
 
        hook(type => "preprocess", id => "template", call => \&preprocess);
 } # }}}
 
+sub getsetup () { #{{{
+       return
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+} #}}}
+
 sub preprocess (@) { #{{{
        my %params=@_;
 
        if (! exists $params{id}) {
 sub preprocess (@) { #{{{
        my %params=@_;
 
        if (! exists $params{id}) {
-               return "[[template ".gettext("missing id parameter")."]]";
+               error gettext("missing id parameter")
        }
 
        my $template_page="templates/$params{id}";
        }
 
        my $template_page="templates/$params{id}";
@@ -42,7 +51,7 @@ sub preprocess (@) { #{{{
                );
        };
        if ($@) {
                );
        };
        if ($@) {
-               return "[[template ".gettext("failed to process:")." $@]]";
+               error gettext("failed to process:")." $@"
        }
 
        $params{basename}=IkiWiki::basename($params{page});
        }
 
        $params{basename}=IkiWiki::basename($params{page});