##// END OF EJS Templates
Fixed: text formatting breaks when using parenthesis inside bold tags (#1334)....
Jean-Philippe Lang -
r3449:24b4c5f48dc0
parent child
Show More
@@ -380,14 +380,12 class RedCloth3 < String
380 380 re =
381 381 case rtype
382 382 when :limit
383 /(^|[>\s\(])
384 (#{QTAGS_JOIN}|)
385 (#{rcq})
386 (#{C})
387 (?::(\S+?))?
388 (\w|[^\s].*?[^\s])
383 /(^|[>\s\(]) # sta
384 (#{QTAGS_JOIN}|) # oqs
385 (#{rcq}) # qtag
386 (\w|[^\s].*?[^\s]) # content
389 387 #{rcq}
390 (#{QTAGS_JOIN}|)
388 (#{QTAGS_JOIN}|) # oqa
391 389 (?=[[:punct:]]|\s|\)|$)/x
392 390 else
393 391 /(#{rcq})
@@ -772,13 +770,16 class RedCloth3 < String
772 770
773 771 case rtype
774 772 when :limit
775 sta,oqs,qtag,atts,cite,content,oqa = $~[1..7]
773 sta,oqs,qtag,content,oqa = $~[1..6]
774 atts = nil
775 if content =~ /^(#{C})(.+)$/
776 atts, content = $~[1..2]
777 end
776 778 else
777 779 qtag,atts,cite,content = $~[1..4]
778 780 sta = ''
779 781 end
780 782 atts = pba( atts )
781 atts << " cite=\"#{ cite }\"" if cite
782 783 atts = shelve( atts ) if atts
783 784
784 785 "#{ sta }#{ oqs }<#{ ht }#{ atts }>#{ content }</#{ ht }>#{ oqa }"
@@ -32,6 +32,24 class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
32 32 "~" => 'sub' # subscript
33 33 }
34 34
35 def test_modifiers
36 to_test = {
37 '*bold*' => '<strong>bold</strong>',
38 'before *bold*' => 'before <strong>bold</strong>',
39 '*bold* after' => '<strong>bold</strong> after',
40 '*two words*' => '<strong>two words</strong>',
41 '*two*words*' => '<strong>two*words</strong>',
42 '*two * words*' => '<strong>two * words</strong>',
43 '*two* *words*' => '<strong>two</strong> <strong>words</strong>',
44 '*(two)* *(words)*' => '<strong>(two)</strong> <strong>(words)</strong>',
45 # with class
46 '*(foo)two words*' => '<strong class="foo">two words</strong>',
47 }
48 to_test.each do |text, expected|
49 assert_equal "<p>#{expected}</p>", @formatter.new(text).to_html
50 end
51 end
52
35 53 def test_modifiers_combination
36 54 MODIFIERS.each do |m1, tag1|
37 55 MODIFIERS.each do |m2, tag2|
General Comments 0
You need to be logged in to leave comments. Login now