use strict;
use IkiWiki 2.00;
-my $percentage_pattern = qr/[0-9]+\%/; # pattern to validate percentages
+my $percentage_pattern = qr/[0-9]+\%?/; # pattern to validate percentages
sub import { #{{{
hook(type => "getsetup", id => "progress", call => \&getsetup);
if (defined $params{percent}) {
$fill = $params{percent};
($fill) = $fill =~ m/($percentage_pattern)/; # fill is untainted now
+ if (! defined $fill || ! length $fill || $fill > 100 || $fill < 0) {
+ error("illegal percent value $params{percent}");
+ }
+ elsif ($fill !~ /%$/) {
+ $fill.="%";
+ }
}
elsif (defined $params{totalpages} and defined $params{donepages}) {
add_depends($params{page}, $params{totalpages});
* editdiff: Broken since 2.62 due to wrong syntax, now fixed.
* aggregate: Support atom feeds with only a summary element, and no content
elements.
+ * progress: Display an error if the progress cannot be parsed, and allow
+ the percent parameter to only optionally end with "%".
-- Joey Hess <joeyh@debian.org> Wed, 17 Sep 2008 14:26:56 -0400
>> that '%' sign is confusing here and should be dropped. I hope it's clear for all
>> people that "percent" parameter passes values in percentages. --[[Paweł|ptecza]]
+>>> [[fixed|done]] --[[Joey]]
+
>>> I've forgotten to add that now the HTML code is OK, but I can see only
>>> "75%" string on white background wihout any border. I need to look closer
>>> at CSS styles for the progress bar. --[[Paweł|ptecza]]
+
+>>>> You need the `div.progress` and `div.progress-done` from ikiwiki's
+>>>> default `style.css`. --[[Joey]]