X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/ee1ad53c4c2710aa7ded61bdc56f3a8cce514f22..c89925048f6c0b149d09b76ff122da2205b6ec86:/IkiWiki/Plugin/pagecount.pm diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm index 2c20ca195..a143f24d0 100644 --- a/IkiWiki/Plugin/pagecount.pm +++ b/IkiWiki/Plugin/pagecount.pm @@ -3,13 +3,22 @@ package IkiWiki::Plugin::pagecount; use warnings; use strict; -use IkiWiki 2.00; +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}; @@ -24,6 +33,6 @@ sub preprocess (@) { #{{{ $count++ if pagespec_match($page, $params{pages}, location => $params{page}); } return $count; -} # }}} +} 1