diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2010-04-15 14:29:14 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2010-04-15 14:29:14 -0400 |
commit | fe733e2a424f50227e4a501c3efbf1ce43e07352 (patch) | |
tree | 8c21c92b96583c22748df32a4025ac514da0c736 /IkiWiki | |
parent | 3131433f64235ad5425eb93d5773580b607876fb (diff) | |
download | ikiwiki-fe733e2a424f50227e4a501c3efbf1ce43e07352.tar ikiwiki-fe733e2a424f50227e4a501c3efbf1ce43e07352.tar.gz |
enhance pagestats and rework example blog front page
* pagestats: Class parameter can be used to override default class for
custom styling.
* pagestats: Use style=list to get a list of tags, scaled by use like
in a tag cloud. This is useful to put in a sidebar.
* Rework example blog front page.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/pagestats.pm | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index 1c0b46830..48715bd3e 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -75,7 +75,7 @@ sub preprocess (@) { } if ($style eq 'table') { - return "<table class='pageStats'>\n". + return "<table class='".(exists $params{class} ? $params{class} : "pageStats")."'>\n". join("\n", map { "<tr><td>". htmllink($params{page}, $params{destpage}, $_, noimageinline => 1). @@ -87,16 +87,31 @@ sub preprocess (@) { else { # In case of misspelling, default to a page cloud - my $res = "<div class='pagecloud'>\n"; + my $res; + if ($style eq 'list') { + $res = "<ul class='".(exists $params{class} ? $params{class} : "list")."'>\n"; + } + else { + $res = "<div class='".(exists $params{class} ? $params{class} : "pagecloud")."'>\n"; + } foreach my $page (sort keys %counts) { next unless $counts{$page} > 0; my $class = $classes[$counts{$page} * scalar(@classes) / ($max + 1)]; + + $res.="<li>" if $style eq 'list'; $res .= "<span class=\"$class\">". htmllink($params{page}, $params{destpage}, $page). "</span>\n"; + $res.="</li>" if $style eq 'list'; + + } + if ($style eq 'list') { + $res = "</ul>\n"; + } + else { + $res .= "</div>\n"; } - $res .= "</div>\n"; return $res; } |