]> sipb.mit.edu Git - ikiwiki.git/blob - IkiWiki/Plugin/testpagespec.pm
really add
[ikiwiki.git] / IkiWiki / Plugin / testpagespec.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::testpagespec;
3
4 use warnings;
5 use strict;
6 use IkiWiki 2.00;
7
8 sub import { #{{{
9         hook(type => "preprocess", id => "testpagespec", call => \&preprocess);
10 } # }}}
11
12 sub preprocess (@) { #{{{
13         my %params=@_;
14         
15         foreach my $param (qw{match pagespec}) {
16                 if (! exists $params{$param}) {
17                         error sprintf(gettext("%s parameter is required"), $param);
18                 }
19         }
20
21         add_depends($params{page}, $params{pagespec});
22         
23         my $ret=pagespec_match($params{match}, $params{pagespec}, 
24                         location => $params{page});
25         if ($ret) {
26                 return "match: $ret";
27         }
28         else {
29                 return "no match: $ret";
30         }
31 } # }}}
32
33 1