Fixed pre tags containing "<pre*" (#4125).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3030 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
22d12032e7
commit
1d8b4ee778
@ -1016,7 +1016,7 @@ class RedCloth3 < String
|
|||||||
end
|
end
|
||||||
|
|
||||||
OFFTAGS = /(code|pre|kbd|notextile)/
|
OFFTAGS = /(code|pre|kbd|notextile)/
|
||||||
OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }|\Z)/mi
|
OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\W|\Z)/mi
|
||||||
OFFTAG_OPEN = /<#{ OFFTAGS }/
|
OFFTAG_OPEN = /<#{ OFFTAGS }/
|
||||||
OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
|
OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
|
||||||
HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
|
HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
|
||||||
|
@ -258,6 +258,28 @@ RAW
|
|||||||
to_test.each { |text, result| assert_equal result, textilizable(text) }
|
to_test.each { |text, result| assert_equal result, textilizable(text) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_pre_tags
|
||||||
|
raw = <<-RAW
|
||||||
|
Before
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
<prepared-statement-cache-size>32</prepared-statement-cache-size>
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
After
|
||||||
|
RAW
|
||||||
|
|
||||||
|
expected = <<-EXPECTED
|
||||||
|
<p>Before</p>
|
||||||
|
<pre>
|
||||||
|
<prepared-statement-cache-size>32</prepared-statement-cache-size>
|
||||||
|
</pre>
|
||||||
|
<p>After</p>
|
||||||
|
EXPECTED
|
||||||
|
|
||||||
|
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
|
||||||
|
end
|
||||||
|
|
||||||
def test_syntax_highlight
|
def test_syntax_highlight
|
||||||
raw = <<-RAW
|
raw = <<-RAW
|
||||||
<pre><code class="ruby">
|
<pre><code class="ruby">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user