X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/5c6b96967d70f41040e90671cff03e4a11239e63..c4ebdd6f467f3361b1f444d9462e10acdbcf9322:/IkiWiki/Plugin/testpagespec.pm diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index 77fab497e..440fca33b 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -3,18 +3,27 @@ package IkiWiki::Plugin::testpagespec; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.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); } } @@ -28,6 +37,6 @@ sub preprocess (@) { #{{{ else { return "no match: $ret"; } -} # }}} +} 1