X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/8fa8bd0adb034f05131648dcb7b14011672649e8..8a6f4a7e50c247c061fd74b535d0f292aca6bda7:/IkiWiki/Plugin/testpagespec.pm diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index 4966f4e10..440fca33b 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -3,15 +3,30 @@ 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}) { + error sprintf(gettext("%s parameter is required"), $param); + } + } + add_depends($params{page}, $params{pagespec}); my $ret=pagespec_match($params{match}, $params{pagespec}, @@ -22,6 +37,6 @@ sub preprocess (@) { #{{{ else { return "no match: $ret"; } -} # }}} +} 1