X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/77b0454e0c69fa0a3e3855b5f25322ae26b37042..db6f258745639cac9717c831a62003140480b692:/IkiWiki/Plugin/pagestats.pm diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index 47638210a..17b26f7ba 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -27,6 +27,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } @@ -63,8 +64,18 @@ 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 "
".
htmllink($params{page}, $params{destpage}, $_, noimageinline => 1).
@@ -76,16 +87,31 @@ sub preprocess (@) {
else {
# In case of misspelling, default to a page cloud
- my $res = " \n";
+ my $res;
+ if ($style eq 'list') {
+ $res = " \n";
return $res;
}
\n";
+ }
foreach my $page (sort keys %counts) {
next unless $counts{$page} > 0;
my $class = $classes[$counts{$page} * scalar(@classes) / ($max + 1)];
+
+ $res.=" \n";
}
- $res .= " |