]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
pagestats: add disp parameter
authorLouis <spalax@web>
Sat, 22 Feb 2014 22:30:09 +0000 (22:30 +0000)
committerSimon McVittie <smcv@debian.org>
Sun, 14 Sep 2014 14:49:38 +0000 (15:49 +0100)
IkiWiki/Plugin/pagestats.pm

index 460a5969a60e6924af3f637db2c3760e8883e7ae..b0ecf7eca6dc9916d626ee2379d19f6935e2e219 100644 (file)
@@ -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';