]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/pagecount.pm
add plugin safe/rebuild info (part 2 of 3)
[ikiwiki.git] / IkiWiki / Plugin / pagecount.pm
index 5ba7ee50b0bd61df0f9c75ea44761795cb65749a..e059fa61850c531083a7cfb743597ea2691f3be2 100644 (file)
@@ -1,15 +1,23 @@
 #!/usr/bin/perl
-# Provides [[pagecount ]] to count the number of pages.
 package IkiWiki::Plugin::pagecount;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
+       hook(type => "getsetup", id => "pagecount", call => \&getsetup);
        hook(type => "preprocess", id => "pagecount", call => \&preprocess);
 } # }}}
 
+sub getsetup () { #{{{
+       return 
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+} #}}}
+
 sub preprocess (@) { #{{{
        my %params=@_;
        $params{pages}="*" unless defined $params{pages};
@@ -22,7 +30,7 @@ sub preprocess (@) { #{{{
        return $#pages+1 if $params{pages} eq "*"; # optimisation
        my $count=0;
        foreach my $page (@pages) {
-               $count++ if pagespec_match($page, $params{pages}, $params{page});
+               $count++ if pagespec_match($page, $params{pages}, location => $params{page});
        }
        return $count;
 } # }}}