diff --git a/lib/chunks/wiki.rb b/lib/chunks/wiki.rb index a57fc5a0..7df6f3f0 100644 --- a/lib/chunks/wiki.rb +++ b/lib/chunks/wiki.rb @@ -104,7 +104,7 @@ module WikiChunk class Link < WikiLink unless defined? WIKI_LINK - WIKI_LINK = /(":)?\[\[\s*([^\]\s][^\]]+?)\s*\]\]/ + WIKI_LINK = /(":)?\[\[\s*([^\]\s][^\]]*?)\s*\]\]/ LINK_TYPE_SEPARATION = Regexp.new('^(.+):((file)|(pic))$', 0) ALIAS_SEPARATION = Regexp.new('^(.+)\|(.+)$', 0) WEB_SEPARATION = Regexp.new('^(.+):(.+)$', 0) diff --git a/test/unit/chunks/wiki_test.rb b/test/unit/chunks/wiki_test.rb index 019b8d4b..093740b5 100755 --- a/test/unit/chunks/wiki_test.rb +++ b/test/unit/chunks/wiki_test.rb @@ -22,6 +22,10 @@ class WikiTest < Test::Unit::TestCase match(WikiChunk::Link, 'This is a [[bracketted link]]', :page_name => 'bracketted link') end + def test_single_letter_brackets + match(WikiChunk::Link, 'This is a [[x]]', :page_name => 'x') + end + def test_void_brackets # double brackets woith only spaces inside are not a WikiLink no_match(WikiChunk::Link, "This [[ ]] are [[]] no [[ \t ]] links")