summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-09-19 13:09:50 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-09-19 13:09:50 -0400
commit779c5214f330269fa95a5fed5b16fe8d65730102 (patch)
treea649d671b65f0e536c36dca1a81a000792f3b0fd
parentcc3b946c8f31b604774f2bb40a0d24b2c463f62c (diff)
progress: Display an error if the progress cannot be parsed, and allow the percent parameter to only optionally end with "%".
-rw-r--r--IkiWiki/Plugin/progress.pm8
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/No_progress_in_progress_bar.mdwn5
3 files changed, 14 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/progress.pm b/IkiWiki/Plugin/progress.pm
index e459637b8..6cb21a916 100644
--- a/IkiWiki/Plugin/progress.pm
+++ b/IkiWiki/Plugin/progress.pm
@@ -5,7 +5,7 @@ use warnings;
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);
@@ -29,6 +29,12 @@ sub preprocess (@) { #{{{
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});
diff --git a/debian/changelog b/debian/changelog
index bf44d9851..ffa266137 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ ikiwiki (2.65) UNRELEASED; urgency=low
* 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
diff --git a/doc/bugs/No_progress_in_progress_bar.mdwn b/doc/bugs/No_progress_in_progress_bar.mdwn
index 1843bcd1d..0b36b9e49 100644
--- a/doc/bugs/No_progress_in_progress_bar.mdwn
+++ b/doc/bugs/No_progress_in_progress_bar.mdwn
@@ -27,6 +27,11 @@ Anyone can confirm the bug? --[[Paweł|ptecza]]
>> 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]]