]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/pagestats.pm
meta: Error if we can't parse dates because Date::Parse is missing
[git.ikiwiki.info.git] / IkiWiki / Plugin / pagestats.pm
index b0ecf7eca6dc9916d626ee2379d19f6935e2e219..304ddd1c826e95f86d9dbfe139626852149e482c 100644 (file)
@@ -34,14 +34,14 @@ sub getsetup () {
 sub linktext ($%) {
        # Return the text of the link to a tag, depending on option linktext.
        my ($page, %params) = @_;
-  if (exists $params{disp} && 
-      exists $pagestate{$page} &&
-      exists $pagestate{$page}{meta}{$params{disp}}) {
-    return $pagestate{$page}{meta}{$params{disp}};
-  }
-  else {
-    return undef;
-  }
+       if (exists $params{show} &&
+               exists $pagestate{$page} &&
+               exists $pagestate{$page}{meta}{$params{show}}) {
+               return $pagestate{$page}{meta}{$params{show}};
+       }
+       else {
+               return undef;
+       }
 }
 
 sub preprocess (@) {
@@ -86,7 +86,7 @@ sub preprocess (@) {
        if (exists $params{limit}) {
                my $i=0;
                my %show;
-               foreach my $key (sort { $counts{$b} <=> $counts{$a} } keys %counts) {
+               foreach my $key (sort { $counts{$b} <=> $counts{$a} || $a cmp $b } keys %counts) {
                        last if ++$i > $params{limit};
                        $show{$key}=$counts{$key};
                }
@@ -100,7 +100,7 @@ sub preprocess (@) {
                                htmllink($params{page}, $params{destpage}, $_, noimageinline => 1, linktext => linktext($_, %params)).
                                "</td><td>".$counts{$_}."</td></tr>"
                        }
-                       sort { $counts{$b} <=> $counts{$a} } keys %counts).
+                       sort { $counts{$b} <=> $counts{$a} || $a cmp $b } keys %counts).
                        "\n</table>\n" ;
        }
        else {