X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/17b2afe721d5b8fd2468fca56e91fe83bf49be64..6ead2573e91405c268ddd4e4072b3a7b30b6b461:/IkiWiki/Plugin/pagecount.pm diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm index a143f24d0..5a2301af4 100644 --- a/IkiWiki/Plugin/pagecount.pm +++ b/IkiWiki/Plugin/pagecount.pm @@ -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