summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-02-26 11:49:51 -0500
committerJoey Hess <joey@gnu.kitenet.net>2010-02-26 11:49:51 -0500
commitb3c3c42b269c102123dcd80979cb9c49ce13bca7 (patch)
treedcab5238b0fbcbb98e5b63b6f3b22f1dc6ae8fb6
parent068e47aa459028c260880ed5f27da2044cb79998 (diff)
Loosen regexp, to allow empty quoted parameters in directives.
-rw-r--r--IkiWiki.pm6
-rw-r--r--debian/changelog1
-rwxr-xr-xt/preprocess.t12
3 files changed, 15 insertions, 4 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index b9a419d1d..9df6c90d6 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1220,7 +1220,7 @@ sub preprocess ($$$;$$) {
(?:
"""(.*?)""" # 2: triple-quoted value
|
- "([^"]+)" # 3: single-quoted value
+ "([^"]*?)" # 3: single-quoted value
|
(\S+) # 4: unquoted value
)
@@ -1306,7 +1306,7 @@ sub preprocess ($$$;$$) {
(?:
""".*?""" # triple-quoted value
|
- "[^"]+" # single-quoted value
+ "[^"]*?" # single-quoted value
|
[^"\s\]]+ # unquoted value
)
@@ -1329,7 +1329,7 @@ sub preprocess ($$$;$$) {
(?:
""".*?""" # triple-quoted value
|
- "[^"]+" # single-quoted value
+ "[^"]*?" # single-quoted value
|
[^"\s\]]+ # unquoted value
)
diff --git a/debian/changelog b/debian/changelog
index e3ec89eed..1960a1226 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ ikiwiki (3.20100213) UNRELEASED; urgency=low
* comments: Display number of comments in comment action link.
* Rebuild wikis on upgrade to this version to get the comment counts
added to existing pages.
+ * Loosen regexp, to allow empty quoted parameters in directives.
-- Joey Hess <joeyh@debian.org> Sun, 14 Feb 2010 17:02:10 -0500
diff --git a/t/preprocess.t b/t/preprocess.t
index e5026ed64..7bb9878d0 100755
--- a/t/preprocess.t
+++ b/t/preprocess.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 21;
+use Test::More tests => 31;
BEGIN { use_ok("IkiWiki"); }
@@ -26,6 +26,16 @@ is(IkiWiki::preprocess("foo", "foo", "[[foo ]]", 0, 0), "foo()", "simple");
is(IkiWiki::preprocess("foo", "foo", "[[!foo ]]", 0, 0), "foo()", "prefixed");
is(IkiWiki::preprocess("foo", "foo", "[[!foo]]", 0, 0), "[[!foo]]", "prefixed, no space");
is(IkiWiki::preprocess("foo", "foo", "[[foo a=1]]", 0, 0), "foo(a => 1)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a="1"]]}, 0, 0), "foo(a => 1)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a="""1"""]]}, 0, 0), "foo(a => 1)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a=""]]}, 0, 0), "foo(a)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a="" b="1"]]}, 0, 0), "foo(a, b => 1)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a=""""""]]}, 0, 0), "foo(a)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a="""""" b="1"]]}, 0, 0), "foo(a, b => 1)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a="""""" b="""1"""]]}, 0, 0), "foo(a, b => 1)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a="""""" b=""""""]]}, 0, 0), "foo(a, b)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a="" b=""""""]]}, 0, 0), "foo(a, b)");
+is(IkiWiki::preprocess("foo", "foo", q{[[foo a="" b="""1"""]]}, 0, 0), "foo(a, b => 1)");
is(IkiWiki::preprocess("foo", "foo", "[[foo a=\"1 2 3 4\"]]", 0, 0), "foo(a => 1 2 3 4)");
is(IkiWiki::preprocess("foo", "foo", "[[foo ]] then [[foo a=2]]", 0, 0),
"foo() then foo(a => 2)");