]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
bugfixes
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 26 Nov 2006 20:50:46 +0000 (20:50 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 26 Nov 2006 20:50:46 +0000 (20:50 +0000)
IkiWiki/Plugin/poll.pm
doc/news/openid.mdwn

index e92d0292f317d90eee975bcdb6d5aaf995632934..bca8f5d547e23552b1eb7338495754b9541c0eef 100644 (file)
@@ -94,6 +94,7 @@ sub cgi ($) { #{{{
                if (defined $oldchoice && $oldchoice eq $choice) {
                        # Same vote; no-op.
                        IkiWiki::redirect($cgi, "$config{url}/".htmlpage($page));
+                       exit;
                }
 
                my $content=readfile(srcfile($pagesources{$page}));
@@ -104,28 +105,13 @@ sub cgi ($) { #{{{
                        my $escape=shift;
                        my $params=shift;
                        return "\\[[poll $params]]" if $escape;
-                       return $params unless --$num == 0;
-                       my @bits=split(' ', $params);
-                       my @ret;
-                       while (@bits) {
-                               my $n=shift @bits;
-                               if ($n=~/=/) {
-                                       # val=param setting
-                                       push @ret, $n;
-                                       next;
+                       if (--$num == 0) {
+                               $params=~s/(^|\s+)(\d+)\s+"?\Q$choice\E"?(\s+|$)/$1.($2+1)." \"$choice\"".$3/se;
+                               if (defined $oldchoice) {
+                                       $params=~s/(^|\s+)(\d+)\s+"?\Q$oldchoice\E"?(\s+|$)/$1.($2-1)." \"$oldchoice\"".$3/se;
                                }
-                               my $c=shift @bits;
-                               $c=~s/^"(.*)"/$1/g;
-                               next unless defined $n && defined $c;
-                               if ($c eq $choice) {
-                                       $n++;
-                               }
-                               if (defined $oldchoice && $c eq $oldchoice) {
-                                       $n--;
-                               }
-                               push @ret, $n, "\"$c\"";
                        }
-                       return "[[poll ".join(" ", @ret)."]]";
+                       return "[[poll $params]]";
                };
                $content =~ s{(\\?)\[\[poll\s+([^]]+)\s*\]\]}{$edit->($1, $2)}seg;
 
index 1c20ae89a784a8e4f21abc899a35f5e345a0d35c..f657718f79f74094bfc75780333aabec8c9a3f29 100644 (file)
@@ -10,6 +10,6 @@ log back in, try out the OpenID signup process if you don't already have an
 OpenID, and see how OpenID works for you. And let me know your feelings about
 making such a switch.
 
-[[poll 0 ""Accept" only "OpenID" for "logins"" 0 ""Accept" only "password" logins" "0" "Accept "both""]]
+[[poll 0 "Accept only OpenID for logins" 0 "Accept only password logins" 0 "Accept both"]]
 
 --[[Joey]]