X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/bb93fccf0690344aa77f9538a508959a6de09847..ec965fc92cd41f597c6e8e88584b9a688407c8c6:/IkiWiki/Plugin/pagecount.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm index c08ab3931..5a2301af4 100644 --- a/IkiWiki/Plugin/pagecount.pm +++ b/IkiWiki/Plugin/pagecount.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::pagecount; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "pagecount", call => \&getsetup); @@ -26,13 +26,14 @@ sub preprocess (@) { # register a dependency. add_depends($params{page}, $params{pages}); - my @pages=keys %pagesources; - return $#pages+1 if $params{pages} eq "*"; # optimisation - my $count=0; - foreach my $page (@pages) { - $count++ if pagespec_match($page, $params{pages}, location => $params{page}); + my @pages; + if ($params{pages} eq "*") { + @pages=keys %pagesources; } - return $count; + else { + @pages=pagespec_match_list([keys %pagesources], $params{pages}, location => $params{page}); + } + return $#pages+1; } 1