From a9b7f01ec816944d5517bf6a800bd0b4bb07937a Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 20 Aug 2007 18:57:21 +0000 Subject: [PATCH] * Add color parameter to postsparkline. Closes: #438900 --- IkiWiki/Plugin/postsparkline.pm | 6 +++++- debian/changelog | 3 ++- doc/plugins/postsparkline.mdwn | 7 +++++-- po/ikiwiki.pot | 24 ++++++++++++------------ 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm index 6f7558bc4..ac7ad9d73 100644 --- a/IkiWiki/Plugin/postsparkline.pm +++ b/IkiWiki/Plugin/postsparkline.pm @@ -55,11 +55,15 @@ sub preprocess (@) { #{{{ if ($@) { return "[[postsparkline error $@]]"; } + + my $color=exists $params{color} ? "($params{color})" : ""; + delete $params{pages}; delete $params{formula}; delete $params{ftime}; + delete $params{color}; return IkiWiki::Plugin::sparkline::preprocess(%params, - map { $_ => "" } reverse @data); + map { $_.$color => "" } reverse @data); } # }}} sub perfoo ($@) { diff --git a/debian/changelog b/debian/changelog index cca99ecf1..9dc028615 100644 --- a/debian/changelog +++ b/debian/changelog @@ -42,8 +42,9 @@ ikiwiki (2.6) UNRELEASED; urgency=low (This was needed for compatability with a bug in CGI::FormBuilder 3.0401, but ikiwiki already needs a newer version.) * Pass buttons to all other formbuilder_setup hooks too. + * Add color parameter to postsparkline. Closes: #438900 - -- Joey Hess Fri, 17 Aug 2007 01:19:44 -0400 + -- Joey Hess Mon, 20 Aug 2007 14:56:51 -0400 ikiwiki (2.5) unstable; urgency=low diff --git a/doc/plugins/postsparkline.mdwn b/doc/plugins/postsparkline.mdwn index da2e6830e..d799f0a0c 100644 --- a/doc/plugins/postsparkline.mdwn +++ b/doc/plugins/postsparkline.mdwn @@ -16,8 +16,8 @@ statistics about a set of pages, such as posts to a blog. # usage -All options aside fron the `pages`, `max`, `formula`, and `time` options -are passed on to the sparkline plugin. +All options aside fron the `pages`, `max`, `formula`, `time`, and `color` +options are passed on to the sparkline plugin. You don't need to specify any data points (though you can if you want to). Instead, data points are automatically generated based on the creation @@ -40,6 +40,9 @@ The `time` parameter has a default value of "ctime", since forumae use the creation times of pages by default. If you instead want them to use the modification times of pages, set it to "mtime". +To change the color used to draw the sparkline, use the `color` parameter. +For example, "color=red". + # adding formulae Additional formulae can be added without modifying this plugin by writing diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 929ff3da4..9d6882764 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-08-15 04:07-0400\n" +"POT-Creation-Date: 2007-08-17 15:44-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,50 +20,50 @@ msgstr "" msgid "You need to log in first." msgstr "" -#: ../IkiWiki/CGI.pm:223 +#: ../IkiWiki/CGI.pm:224 msgid "Login" msgstr "" -#: ../IkiWiki/CGI.pm:224 +#: ../IkiWiki/CGI.pm:225 msgid "Preferences" msgstr "" -#: ../IkiWiki/CGI.pm:225 +#: ../IkiWiki/CGI.pm:226 msgid "Admin" msgstr "" -#: ../IkiWiki/CGI.pm:282 +#: ../IkiWiki/CGI.pm:284 msgid "Preferences saved." msgstr "" -#: ../IkiWiki/CGI.pm:348 +#: ../IkiWiki/CGI.pm:352 #, perl-format msgid "%s is not an editable page" msgstr "" -#: ../IkiWiki/CGI.pm:427 ../IkiWiki/Plugin/brokenlinks.pm:24 +#: ../IkiWiki/CGI.pm:431 ../IkiWiki/Plugin/brokenlinks.pm:24 #: ../IkiWiki/Plugin/inline.pm:208 ../IkiWiki/Plugin/opendiscussion.pm:17 #: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:99 #: ../IkiWiki/Render.pm:179 msgid "discussion" msgstr "" -#: ../IkiWiki/CGI.pm:473 +#: ../IkiWiki/CGI.pm:477 #, perl-format msgid "creating %s" msgstr "" -#: ../IkiWiki/CGI.pm:491 ../IkiWiki/CGI.pm:510 ../IkiWiki/CGI.pm:521 -#: ../IkiWiki/CGI.pm:548 ../IkiWiki/CGI.pm:593 +#: ../IkiWiki/CGI.pm:495 ../IkiWiki/CGI.pm:514 ../IkiWiki/CGI.pm:525 +#: ../IkiWiki/CGI.pm:552 ../IkiWiki/CGI.pm:597 #, perl-format msgid "editing %s" msgstr "" -#: ../IkiWiki/CGI.pm:688 +#: ../IkiWiki/CGI.pm:692 msgid "You are banned." msgstr "" -#: ../IkiWiki/CGI.pm:708 +#: ../IkiWiki/CGI.pm:712 msgid "login failed, perhaps you need to turn on cookies?" msgstr "" -- 2.26.2