meta: Fix calling of htmlscrubber to pass the page parameter. The change of the htmls...
[ikiwiki] / IkiWiki / Plugin / testpagespec.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::testpagespec;
3
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
7
8 sub import {
9         hook(type => "getsetup", id => "testpagespec", call => \&getsetup);
10         hook(type => "preprocess", id => "testpagespec", call => \&preprocess);
11 }
12
13 sub getsetup () {
14         return
15                 plugin => {
16                         safe => 1,
17                         rebuild => undef,
18                 },
19 }
20
21 sub preprocess (@) {
22         my %params=@_;
23         
24         foreach my $param (qw{match pagespec}) {
25                 if (! exists $params{$param}) {
26                         error sprintf(gettext("%s parameter is required"), $param);
27                 }
28         }
29
30         add_depends($params{page}, $params{pagespec});
31         
32         my $ret=pagespec_match($params{match}, $params{pagespec}, 
33                         location => $params{page});
34         if ($ret) {
35                 return "match: $ret";
36         }
37         else {
38                 return "no match: $ret";
39         }
40 }
41
42 1