2007-04-27 09:55:40 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
package IkiWiki::Plugin::testpagespec;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
use IkiWiki 2.00;
|
|
|
|
|
|
|
|
sub import { #{{{
|
|
|
|
hook(type => "preprocess", id => "testpagespec", call => \&preprocess);
|
|
|
|
} # }}}
|
|
|
|
|
|
|
|
sub preprocess (@) { #{{{
|
|
|
|
my %params=@_;
|
|
|
|
|
2007-05-08 23:22:14 +02:00
|
|
|
foreach my $param (qw{match pagespec}) {
|
|
|
|
if (! exists $params{$param}) {
|
2007-05-09 02:31:49 +02:00
|
|
|
return "[[testpagespec $param parameter is required]]";
|
2007-05-08 23:22:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-27 09:55:40 +02:00
|
|
|
add_depends($params{page}, $params{pagespec});
|
|
|
|
|
|
|
|
my $ret=pagespec_match($params{match}, $params{pagespec},
|
|
|
|
location => $params{page});
|
2007-04-27 10:34:09 +02:00
|
|
|
if ($ret) {
|
|
|
|
return "match: $ret";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return "no match: $ret";
|
|
|
|
}
|
2007-04-27 09:55:40 +02:00
|
|
|
} # }}}
|
|
|
|
|
|
|
|
1
|