X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/127bceef5b4799e58cb068043e49ed16a3ec840d..febfb1751c2cb3fb0826b76b55d86fb956d62466:/IkiWiki/Plugin/testpagespec.pm diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index f9ec90d87..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 $param parameter is required]]"; + error sprintf(gettext("%s parameter is required"), $param); } } @@ -28,6 +37,6 @@ sub preprocess (@) { #{{{ else { return "no match: $ret"; } -} # }}} +} 1