X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/dae0f48e91304afcb6ebe0936360e51b22a56548..cf7d64a69ed81731d148ed237b800fd4dde98027:/IkiWiki/Plugin/pagecount.pm diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm index 7ced15982..e059fa618 100644 --- a/IkiWiki/Plugin/pagecount.pm +++ b/IkiWiki/Plugin/pagecount.pm @@ -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}); + $count++ if pagespec_match($page, $params{pages}, location => $params{page}); } return $count; } # }}}