X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/ab768a62c66335a96a5791c444e54b8ae3b078b1..10dc1fa7b2a88be59fb04a0041636aaf325f6307:/IkiWiki/Plugin/pagestats.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index 460a5969a..304ddd1c8 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -31,6 +31,19 @@ sub getsetup () { }, } +sub linktext ($%) { + # Return the text of the link to a tag, depending on option linktext. + my ($page, %params) = @_; + if (exists $params{show} && + exists $pagestate{$page} && + exists $pagestate{$page}{meta}{$params{show}}) { + return $pagestate{$page}{meta}{$params{show}}; + } + else { + return undef; + } +} + sub preprocess (@) { my %params=@_; $params{pages}="*" unless defined $params{pages}; @@ -73,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}; } @@ -84,10 +97,10 @@ sub preprocess (@) { return "\n". join("\n", map { "" } - sort { $counts{$b} <=> $counts{$a} } keys %counts). + sort { $counts{$b} <=> $counts{$a} || $a cmp $b } keys %counts). "\n
". - htmllink($params{page}, $params{destpage}, $_, noimageinline => 1). + htmllink($params{page}, $params{destpage}, $_, noimageinline => 1, linktext => linktext($_, %params)). "".$counts{$_}."
\n" ; } else { @@ -107,7 +120,7 @@ sub preprocess (@) { $res.="
  • " if $style eq 'list'; $res .= "". - htmllink($params{page}, $params{destpage}, $page). + htmllink($params{page}, $params{destpage}, $page, linktext => linktext($page, %params)). "\n"; $res.="
  • " if $style eq 'list';