diff options
author | Louis <spalax@web> | 2014-02-22 22:30:09 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2014-09-14 15:49:38 +0100 |
commit | cd5a24d8b405902801ca710cb77d6cc3f802f90f (patch) | |
tree | ea9a1e7f4338a67046e842bfb6cc3070777483db /IkiWiki | |
parent | ab768a62c66335a96a5791c444e54b8ae3b078b1 (diff) | |
download | ikiwiki-cd5a24d8b405902801ca710cb77d6cc3f802f90f.tar ikiwiki-cd5a24d8b405902801ca710cb77d6cc3f802f90f.tar.gz |
pagestats: add disp parameter
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/pagestats.pm | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index 460a5969a..b0ecf7eca 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{disp} && + exists $pagestate{$page} && + exists $pagestate{$page}{meta}{$params{disp}}) { + return $pagestate{$page}{meta}{$params{disp}}; + } + else { + return undef; + } +} + sub preprocess (@) { my %params=@_; $params{pages}="*" unless defined $params{pages}; @@ -84,7 +97,7 @@ sub preprocess (@) { return "<table class='".(exists $params{class} ? $params{class} : "pageStats")."'>\n". join("\n", map { "<tr><td>". - htmllink($params{page}, $params{destpage}, $_, noimageinline => 1). + htmllink($params{page}, $params{destpage}, $_, noimageinline => 1, linktext => linktext($_, %params)). "</td><td>".$counts{$_}."</td></tr>" } sort { $counts{$b} <=> $counts{$a} } keys %counts). @@ -107,7 +120,7 @@ sub preprocess (@) { $res.="<li>" if $style eq 'list'; $res .= "<span class=\"$class\">". - htmllink($params{page}, $params{destpage}, $page). + htmllink($params{page}, $params{destpage}, $page, linktext => linktext($page, %params)). "</span>\n"; $res.="</li>" if $style eq 'list'; |