]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/testpagespec.pm
add plugin safe/rebuild info (part 3 of 3)
[ikiwiki.git] / IkiWiki / Plugin / testpagespec.pm
index 4966f4e10b1a01d441cb45a4fb75205edaf4fe74..9f9b50f017bb5cb75a5ed1155984531d082d200d 100644 (file)
@@ -6,12 +6,27 @@ use strict;
 use IkiWiki 2.00;
 
 sub import { #{{{
 use IkiWiki 2.00;
 
 sub import { #{{{
+       hook(type => "getsetup", id => "testpagespec", call => \&getsetup);
        hook(type => "preprocess", id => "testpagespec", call => \&preprocess);
 } # }}}
 
        hook(type => "preprocess", id => "testpagespec", call => \&preprocess);
 } # }}}
 
+sub getsetup () { #{{{
+       return
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+} #}}}
+
 sub preprocess (@) { #{{{
        my %params=@_;
        
 sub preprocess (@) { #{{{
        my %params=@_;
        
+       foreach my $param (qw{match pagespec}) {
+               if (! exists $params{$param}) {
+                       error sprintf(gettext("%s parameter is required"), $param);
+               }
+       }
+
        add_depends($params{page}, $params{pagespec});
        
        my $ret=pagespec_match($params{match}, $params{pagespec}, 
        add_depends($params{page}, $params{pagespec});
        
        my $ret=pagespec_match($params{match}, $params{pagespec},