diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2010-02-26 11:49:51 -0500 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2010-02-26 11:49:51 -0500 |
commit | b3c3c42b269c102123dcd80979cb9c49ce13bca7 (patch) | |
tree | dcab5238b0fbcbb98e5b63b6f3b22f1dc6ae8fb6 | |
parent | 068e47aa459028c260880ed5f27da2044cb79998 (diff) | |
download | ikiwiki-b3c3c42b269c102123dcd80979cb9c49ce13bca7.tar ikiwiki-b3c3c42b269c102123dcd80979cb9c49ce13bca7.tar.gz |
Loosen regexp, to allow empty quoted parameters in directives.
-rw-r--r-- | IkiWiki.pm | 6 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rwxr-xr-x | t/preprocess.t | 12 |
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)"); |