]> sipb.mit.edu Git - ikiwiki.git/commitdiff
pagestats: Add show parameter. Closes: #562129
authorJoey Hess <joey@gnu.kitenet.net>
Fri, 25 Dec 2009 19:31:51 +0000 (14:31 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Fri, 25 Dec 2009 19:31:51 +0000 (14:31 -0500)
IkiWiki/Plugin/pagestats.pm
debian/changelog
doc/ikiwiki/directive/pagestats.mdwn

index 47638210aeddeff49866ac1e5a6459828556ddd2..4313aa271e2f55259b04df7b7abfbd1a447ba1cb 100644 (file)
@@ -63,6 +63,16 @@ sub preprocess (@) {
                $max = $counts{$page} if $counts{$page} > $max;
        }
 
+       if (exists $params{show}) {
+               my $i=0;
+               my %show;
+               foreach my $key (sort { $counts{$b} <=> $counts{$a} } keys %counts) {
+                       last if ++$i > $params{show};
+                       $show{$key}=$counts{$key};
+               }
+               %counts=%show;
+       }
+
        if ($style eq 'table') {
                return "<table class='pageStats'>\n".
                        join("\n", map {
index 0e76bd727bf5d4d4d059d92321ebc6328ab53f52..e010371716369b036195517e7ee5bf69c9d90464 100644 (file)
@@ -1,3 +1,9 @@
+ikiwiki (3.20091219) UNRELEASED; urgency=low
+
+  * pagestats: Add show parameter. Closes: #562129
+
+ -- Joey Hess <joeyh@debian.org>  Fri, 25 Dec 2009 14:31:22 -0500
+
 ikiwiki (3.20091218) unstable; urgency=low
 
   * Add complete Spanish basewiki translation done by Fernando Gonzalez de
index f14c80b0798d85b6e6279622b1fe6d774b5fdad0..68f4d2734ad06f1be5c2c379a8953a3a7ac0bb51 100644 (file)
@@ -22,4 +22,10 @@ Or to display a cloud of tags related to Linux, you could use:
 
        \[[!pagestats pages="tags/* and not tags/linux" among="tagged(linux)"]]
 
+The optional `show` parameter limits display to the specified number of
+pages. For instance, to show a table of the top ten pages with the most
+links:
+
+       \[[!pagestats style="table" show="10"]]
+
 [[!meta robots="noindex, follow"]]