summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/testpagespec.pm
blob: 4966f4e10b1a01d441cb45a4fb75205edaf4fe74 (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki::Plugin::testpagespec;
  3. use warnings;
  4. use strict;
  5. use IkiWiki 2.00;
  6. sub import { #{{{
  7. hook(type => "preprocess", id => "testpagespec", call => \&preprocess);
  8. } # }}}
  9. sub preprocess (@) { #{{{
  10. my %params=@_;
  11. add_depends($params{page}, $params{pagespec});
  12. my $ret=pagespec_match($params{match}, $params{pagespec},
  13. location => $params{page});
  14. if ($ret) {
  15. return "match: $ret";
  16. }
  17. else {
  18. return "no match: $ret";
  19. }
  20. } # }}}
  21. 1