Fixed: text formatting breaks when using parenthesis inside bold tags (#1334).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3563 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
6ea1ef77e5
commit
24b4c5f48d
|
@ -380,14 +380,12 @@ class RedCloth3 < String
|
||||||
re =
|
re =
|
||||||
case rtype
|
case rtype
|
||||||
when :limit
|
when :limit
|
||||||
/(^|[>\s\(])
|
/(^|[>\s\(]) # sta
|
||||||
(#{QTAGS_JOIN}|)
|
(#{QTAGS_JOIN}|) # oqs
|
||||||
(#{rcq})
|
(#{rcq}) # qtag
|
||||||
(#{C})
|
(\w|[^\s].*?[^\s]) # content
|
||||||
(?::(\S+?))?
|
|
||||||
(\w|[^\s].*?[^\s])
|
|
||||||
#{rcq}
|
#{rcq}
|
||||||
(#{QTAGS_JOIN}|)
|
(#{QTAGS_JOIN}|) # oqa
|
||||||
(?=[[:punct:]]|\s|\)|$)/x
|
(?=[[:punct:]]|\s|\)|$)/x
|
||||||
else
|
else
|
||||||
/(#{rcq})
|
/(#{rcq})
|
||||||
|
@ -772,13 +770,16 @@ class RedCloth3 < String
|
||||||
|
|
||||||
case rtype
|
case rtype
|
||||||
when :limit
|
when :limit
|
||||||
sta,oqs,qtag,atts,cite,content,oqa = $~[1..7]
|
sta,oqs,qtag,content,oqa = $~[1..6]
|
||||||
|
atts = nil
|
||||||
|
if content =~ /^(#{C})(.+)$/
|
||||||
|
atts, content = $~[1..2]
|
||||||
|
end
|
||||||
else
|
else
|
||||||
qtag,atts,cite,content = $~[1..4]
|
qtag,atts,cite,content = $~[1..4]
|
||||||
sta = ''
|
sta = ''
|
||||||
end
|
end
|
||||||
atts = pba( atts )
|
atts = pba( atts )
|
||||||
atts << " cite=\"#{ cite }\"" if cite
|
|
||||||
atts = shelve( atts ) if atts
|
atts = shelve( atts ) if atts
|
||||||
|
|
||||||
"#{ sta }#{ oqs }<#{ ht }#{ atts }>#{ content }</#{ ht }>#{ oqa }"
|
"#{ sta }#{ oqs }<#{ ht }#{ atts }>#{ content }</#{ ht }>#{ oqa }"
|
||||||
|
|
|
@ -32,6 +32,24 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
|
||||||
"~" => 'sub' # subscript
|
"~" => 'sub' # subscript
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def test_modifiers
|
||||||
|
to_test = {
|
||||||
|
'*bold*' => '<strong>bold</strong>',
|
||||||
|
'before *bold*' => 'before <strong>bold</strong>',
|
||||||
|
'*bold* after' => '<strong>bold</strong> after',
|
||||||
|
'*two words*' => '<strong>two words</strong>',
|
||||||
|
'*two*words*' => '<strong>two*words</strong>',
|
||||||
|
'*two * words*' => '<strong>two * words</strong>',
|
||||||
|
'*two* *words*' => '<strong>two</strong> <strong>words</strong>',
|
||||||
|
'*(two)* *(words)*' => '<strong>(two)</strong> <strong>(words)</strong>',
|
||||||
|
# with class
|
||||||
|
'*(foo)two words*' => '<strong class="foo">two words</strong>',
|
||||||
|
}
|
||||||
|
to_test.each do |text, expected|
|
||||||
|
assert_equal "<p>#{expected}</p>", @formatter.new(text).to_html
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_modifiers_combination
|
def test_modifiers_combination
|
||||||
MODIFIERS.each do |m1, tag1|
|
MODIFIERS.each do |m1, tag1|
|
||||||
MODIFIERS.each do |m2, tag2|
|
MODIFIERS.each do |m2, tag2|
|
||||||
|
|
Loading…
Reference in New Issue