web commit by JoshTriplett: Add another example, and add a description to each test.
[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         add_depends($params{page}, $params{pagespec});
16         
17         my $ret=pagespec_match($params{match}, $params{pagespec}, 
18                         location => $params{page});
19         if ($ret) {
20                 return "match: $ret";
21         }
22         else {
23                 return "no match: $ret";
24         }
25 } # }}}
26
27 1