summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-11-26 04:56:19 +0000
committerGo MAEDA <maeda@farend.jp>2018-11-26 04:56:19 +0000
commita7f6830a8e374c4419c4754468e0198558209b51 (patch)
treefa97c42aed1c9b581c64d4ee891344dc13b0760a
parentf7c9ba30a801c727279e52f1744d5e98c08e503e (diff)
downloadredmine-a7f6830a8e374c4419c4754468e0198558209b51.tar.gz
redmine-a7f6830a8e374c4419c4754468e0198558209b51.zip
Merged r17636 from trunk to 3.4-stable (#8395).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17637 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/wiki_formatting/textile/redcloth3.rb2
-rw-r--r--test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb16
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index 6d462e935..fc71d5929 100644
--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
@@ -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
diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
index 24098b782..08ffba0ce 100644
--- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
@@ -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)