aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/testpagespec.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-05-08 21:22:14 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-05-08 21:22:14 +0000
commit687928ead25cb8f62fdfc58c2e126264e0fb149a (patch)
tree76106dec33e3da63b086eb49c941f1ce84c28d96 /IkiWiki/Plugin/testpagespec.pm
parent0041e9380838a5a8491674585e5dc6067763ebf6 (diff)
downloadikiwiki-687928ead25cb8f62fdfc58c2e126264e0fb149a.tar
ikiwiki-687928ead25cb8f62fdfc58c2e126264e0fb149a.tar.gz
* Make testpagespec more robust, including checking for missing/bad
parameters, and detecting if a pagespec failed to compile.
Diffstat (limited to 'IkiWiki/Plugin/testpagespec.pm')
-rw-r--r--IkiWiki/Plugin/testpagespec.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm
index 4966f4e10..a0bb2ff31 100644
--- a/IkiWiki/Plugin/testpagespec.pm
+++ b/IkiWiki/Plugin/testpagespec.pm
@@ -12,6 +12,12 @@ sub import { #{{{
sub preprocess (@) { #{{{
my %params=@_;
+ foreach my $param (qw{match pagespec}) {
+ if (! exists $params{$param}) {
+ return "[[testpagespec missing $param parameter]]";
+ }
+ }
+
add_depends($params{page}, $params{pagespec});
my $ret=pagespec_match($params{match}, $params{pagespec},
@@ -19,6 +25,9 @@ sub preprocess (@) { #{{{
if ($ret) {
return "match: $ret";
}
+ elsif (! defined $ret) {
+ return "match failed: $@";
+ }
else {
return "no match: $ret";
}