]> source.dussan.org Git - redmine.git/commitdiff
Tags start with 'pre' are handled as 'pre' tag in Textile (#8395).
authorGo MAEDA <maeda@farend.jp>
Mon, 26 Nov 2018 04:40:09 +0000 (04:40 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 26 Nov 2018 04:40:09 +0000 (04:40 +0000)
Patch by Takenori TAKAKI and Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@17636 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 6ffd7c78c4f099701dc8120e87c3355752b351c8..01f1bd458de287c3edf6c46b786197fcb525755c 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 a4c8167d1de7ecd760f0603193c751bf7f5cc224..4bbef9996b70cf2293cfc50e7941d62dc81efd32 100644 (file)
@@ -605,6 +605,22 @@ EXPECTED
     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)