X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/687928ead25cb8f62fdfc58c2e126264e0fb149a..ced9e33776f74d1190a104dcaf839229ba204137:/IkiWiki/Plugin/testpagespec.pm diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index a0bb2ff31..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); } } @@ -25,12 +34,9 @@ sub preprocess (@) { #{{{ if ($ret) { return "match: $ret"; } - elsif (! defined $ret) { - return "match failed: $@"; - } else { return "no match: $ret"; } -} # }}} +} 1