Single Letter WikiLinks

Another request from the old (and apparently defunct) Instiki Bug Tracker:
allow single letter WikiLinks, e.g. "[[a]]". Requested by a Japanese user.

Fixed.
This commit is contained in:
Jacques Distler 2008-12-22 23:57:21 -06:00
parent 1192f70f44
commit 1b54b695c3
2 changed files with 5 additions and 1 deletions

View file

@ -104,7 +104,7 @@ module WikiChunk
class Link < WikiLink class Link < WikiLink
unless defined? WIKI_LINK unless defined? WIKI_LINK
WIKI_LINK = /(":)?\[\[\s*([^\]\s][^\]]+?)\s*\]\]/ WIKI_LINK = /(":)?\[\[\s*([^\]\s][^\]]*?)\s*\]\]/
LINK_TYPE_SEPARATION = Regexp.new('^(.+):((file)|(pic))$', 0) LINK_TYPE_SEPARATION = Regexp.new('^(.+):((file)|(pic))$', 0)
ALIAS_SEPARATION = Regexp.new('^(.+)\|(.+)$', 0) ALIAS_SEPARATION = Regexp.new('^(.+)\|(.+)$', 0)
WEB_SEPARATION = Regexp.new('^(.+):(.+)$', 0) WEB_SEPARATION = Regexp.new('^(.+):(.+)$', 0)

View file

@ -22,6 +22,10 @@ class WikiTest < Test::Unit::TestCase
match(WikiChunk::Link, 'This is a [[bracketted link]]', :page_name => 'bracketted link') match(WikiChunk::Link, 'This is a [[bracketted link]]', :page_name => 'bracketted link')
end end
def test_single_letter_brackets
match(WikiChunk::Link, 'This is a [[x]]', :page_name => 'x')
end
def test_void_brackets def test_void_brackets
# double brackets woith only spaces inside are not a WikiLink # double brackets woith only spaces inside are not a WikiLink
no_match(WikiChunk::Link, "This [[ ]] are [[]] no [[ \t ]] links") no_match(WikiChunk::Link, "This [[ ]] are [[]] no [[ \t ]] links")