X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/2e1670a821ac2582ac8c65f3ec39bfa64d27577a..7cd40ea4eb8955765dc3e61dd3edaf08d1bbab48:/IkiWiki/Plugin/postsparkline.pm diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm index 6f7558bc4..9e885741e 100644 --- a/IkiWiki/Plugin/postsparkline.pm +++ b/IkiWiki/Plugin/postsparkline.pm @@ -55,11 +55,20 @@ sub preprocess (@) { #{{{ if ($@) { return "[[postsparkline error $@]]"; } + + if (! @data) { + # generate an empty graph + push @data, 0 foreach 1..($params{max} / 2); + } + + 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 ($@) {