]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/pagecount.pm
finalise version 3.00 of the plugin api
[ikiwiki.git] / IkiWiki / Plugin / pagecount.pm
index 313ffdff0d6e9c225957d692fbfdea6a9f3109a3..a143f24d089d3ff0d405fd0c6f1544558375600c 100644 (file)
@@ -3,13 +3,22 @@ package IkiWiki::Plugin::pagecount;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 3.00;
 
-sub import { #{{{
+sub import {
+       hook(type => "getsetup", id => "pagecount", call => \&getsetup);
        hook(type => "preprocess", id => "pagecount", call => \&preprocess);
-} # }}}
+}
 
-sub preprocess (@) { #{{{
+sub getsetup () {
+       return 
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+}
+
+sub preprocess (@) {
        my %params=@_;
        $params{pages}="*" unless defined $params{pages};
        
@@ -21,9 +30,9 @@ 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;
-} # }}}
+}
 
 1