add paths to plugin files in copyright
[ikiwiki.git] / IkiWiki / Plugin / testpagespec.pm
blob440fca33be02cc6cf91ff9072c725d936571b334
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::testpagespec;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 sub import {
9 hook(type => "getsetup", id => "testpagespec", call => \&getsetup);
10 hook(type => "preprocess", id => "testpagespec", call => \&preprocess);
13 sub getsetup () {
14 return
15 plugin => {
16 safe => 1,
17 rebuild => undef,
21 sub preprocess (@) {
22 my %params=@_;
24 foreach my $param (qw{match pagespec}) {
25 if (! exists $params{$param}) {
26 error sprintf(gettext("%s parameter is required"), $param);
30 add_depends($params{page}, $params{pagespec});
32 my $ret=pagespec_match($params{match}, $params{pagespec},
33 location => $params{page});
34 if ($ret) {
35 return "match: $ret";
37 else {
38 return "no match: $ret";