]> source.dussan.org Git - redmine.git/commitdiff
Merged r17636 from trunk to 3.4-stable (#8395).
authorGo MAEDA <maeda@farend.jp>
Mon, 26 Nov 2018 04:56:19 +0000 (04:56 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 26 Nov 2018 04:56:19 +0000 (04:56 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17637 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/wiki_formatting/textile/redcloth3.rb
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb

index 6d462e9357517fbf9ebad3cfcb7bbb0f4b68c68d..fc71d5929a9072d61531eedca9b459f574c0e7b7 100644 (file)
@@ -1049,7 +1049,7 @@ class RedCloth3 < String
     end
     
     OFFTAGS = /(code|pre|kbd|notextile)/
-    OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\W|\Z)/mi
+    OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }\b>)|(<#{ OFFTAGS }\b[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\b\W|\Z)/mi
     OFFTAG_OPEN = /<#{ OFFTAGS }/
     OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
     HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
index 24098b782809c3c567b3f8e129d74fc75ce7d8a6..08ffba0cee83617161c6965bbe313a21102a0a5d 100644 (file)
@@ -586,6 +586,22 @@ STR
     assert_nothing_raised { to_html(" \v") }
   end
 
+  def test_should_not_handle_as_preformatted_text_tags_that_starts_with_pre
+    text = <<-STR
+<pree>
+  This is some text
+</pree>
+STR
+
+    expected = <<-EXPECTED
+<p>&lt;pree&gt;<br />
+  This is some text<br />
+&lt;/pree&gt;</p>
+EXPECTED
+
+    assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '')
+  end
+
   private
 
   def assert_html_output(to_test, expect_paragraph = true)