@@ -380,14 +380,12 class RedCloth3 < String | |||||
380 | re = |
|
380 | re = | |
381 | case rtype |
|
381 | case rtype | |
382 | when :limit |
|
382 | when :limit | |
383 | /(^|[>\s\(]) |
|
383 | /(^|[>\s\(]) # sta | |
384 | (#{QTAGS_JOIN}|) |
|
384 | (#{QTAGS_JOIN}|) # oqs | |
385 | (#{rcq}) |
|
385 | (#{rcq}) # qtag | |
386 | (#{C}) |
|
386 | (\w|[^\s].*?[^\s]) # content | |
387 | (?::(\S+?))? |
|
|||
388 | (\w|[^\s].*?[^\s]) |
|
|||
389 | #{rcq} |
|
387 | #{rcq} | |
390 | (#{QTAGS_JOIN}|) |
|
388 | (#{QTAGS_JOIN}|) # oqa | |
391 | (?=[[:punct:]]|\s|\)|$)/x |
|
389 | (?=[[:punct:]]|\s|\)|$)/x | |
392 | else |
|
390 | else | |
393 | /(#{rcq}) |
|
391 | /(#{rcq}) | |
@@ -772,13 +770,16 class RedCloth3 < String | |||||
772 |
|
770 | |||
773 | case rtype |
|
771 | case rtype | |
774 | when :limit |
|
772 | when :limit | |
775 |
sta,oqs,qtag |
|
773 | sta,oqs,qtag,content,oqa = $~[1..6] | |
|
774 | atts = nil | |||
|
775 | if content =~ /^(#{C})(.+)$/ | |||
|
776 | atts, content = $~[1..2] | |||
|
777 | end | |||
776 | else |
|
778 | else | |
777 | qtag,atts,cite,content = $~[1..4] |
|
779 | qtag,atts,cite,content = $~[1..4] | |
778 | sta = '' |
|
780 | sta = '' | |
779 | end |
|
781 | end | |
780 | atts = pba( atts ) |
|
782 | atts = pba( atts ) | |
781 | atts << " cite=\"#{ cite }\"" if cite |
|
|||
782 | atts = shelve( atts ) if atts |
|
783 | atts = shelve( atts ) if atts | |
783 |
|
784 | |||
784 | "#{ sta }#{ oqs }<#{ ht }#{ atts }>#{ content }</#{ ht }>#{ oqa }" |
|
785 | "#{ sta }#{ oqs }<#{ ht }#{ atts }>#{ content }</#{ ht }>#{ oqa }" |
@@ -32,6 +32,24 class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase | |||||
32 | "~" => 'sub' # subscript |
|
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 | def test_modifiers_combination |
|
53 | def test_modifiers_combination | |
36 | MODIFIERS.each do |m1, tag1| |
|
54 | MODIFIERS.each do |m1, tag1| | |
37 | MODIFIERS.each do |m2, tag2| |
|
55 | MODIFIERS.each do |m2, tag2| |
General Comments 0
You need to be logged in to leave comments.
Login now