]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/testpagespec.pm
rename comments_form to editcomment
[ikiwiki.git] / IkiWiki / Plugin / testpagespec.pm
index a0bb2ff3128e4f9a5d3853f5006aa0d76a074004..a6e94dbbb5a2e88867a4ac03d49d65b141949446 100644 (file)
@@ -5,16 +5,25 @@ use warnings;
 use strict;
 use IkiWiki 2.00;
 
-sub import { #{{{
+sub import {
+       hook(type => "getsetup", id => "testpagespec", call => \&getsetup);
        hook(type => "preprocess", id => "testpagespec", call => \&preprocess);
-} # }}}
+}
 
-sub preprocess (@) { #{{{
+sub getsetup () {
+       return
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+}
+
+sub preprocess (@) {
        my %params=@_;
        
        foreach my $param (qw{match pagespec}) {
                if (! exists $params{$param}) {
-                       return "[[testpagespec missing $param parameter]]";
+                       error sprintf(gettext("%s parameter is required"), $param);
                }
        }
 
@@ -25,12 +34,9 @@ sub preprocess (@) { #{{{
        if ($ret) {
                return "match: $ret";
        }
-       elsif (! defined $ret) {
-               return "match failed: $@";
-       }
        else {
                return "no match: $ret";
        }
-} # }}}
+}
 
 1