2 package IkiWiki::Plugin::pagecount;
9 hook(type => "getsetup", id => "pagecount", call => \&getsetup);
10 hook(type => "preprocess", id => "pagecount", call => \&preprocess);
13 sub getsetup () { #{{{
21 sub preprocess (@) { #{{{
23 $params{pages}="*" unless defined $params{pages};
25 # Needs to update count whenever a page is added or removed, so
26 # register a dependency.
27 add_depends($params{page}, $params{pages});
29 my @pages=keys %pagesources;
30 return $#pages+1 if $params{pages} eq "*"; # optimisation
32 foreach my $page (@pages) {
33 $count++ if pagespec_match($page, $params{pages}, location => $params{page});