]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/pagestats.pm
Rename show parameter of [[!inline]] and [[!pagestats]] to limit
[git.ikiwiki.info.git] / IkiWiki / Plugin / pagestats.pm
index 48715bd3e18348fa77da30ba05ceaad0b1e3a9ca..460a5969a60e6924af3f637db2c3760e8883e7ae 100644 (file)
@@ -35,7 +35,13 @@ sub preprocess (@) {
        my %params=@_;
        $params{pages}="*" unless defined $params{pages};
        my $style = ($params{style} or 'cloud');
-       
+
+       # Backwards compatibility
+       if (defined $params{show} && $params{show} =~ m/^\d+$/) {
+               $params{limit} = $params{show};
+               delete $params{show};
+       }
+
        my %counts;
        my $max = 0;
        foreach my $page (pagespec_match_list($params{page}, $params{pages},
@@ -64,11 +70,11 @@ sub preprocess (@) {
                $max = $counts{$page} if $counts{$page} > $max;
        }
 
-       if (exists $params{show}) {
+       if (exists $params{limit}) {
                my $i=0;
                my %show;
                foreach my $key (sort { $counts{$b} <=> $counts{$a} } keys %counts) {
-                       last if ++$i > $params{show};
+                       last if ++$i > $params{limit};
                        $show{$key}=$counts{$key};
                }
                %counts=%show;
@@ -107,7 +113,7 @@ sub preprocess (@) {
 
                }
                if ($style eq 'list') {
-                       $res = "</ul>\n";
+                       $res .= "</ul>\n";
                }
                else {
                        $res .= "</div>\n";