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:
parent
1192f70f44
commit
1b54b695c3
|
@ -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)
|
||||||
|
|
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue