From 9f15517095c4877ce5ae798210b8f5204a157ec9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 28 Nov 2011 17:56:50 +0000 Subject: [PATCH] Fixed: Angle brackets within 'pre' blocks are silently replaced by HTML entities during wiki section-edit (#9673). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7969 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/wiki_formatting/textile/formatter.rb | 2 +- .../redmine/wiki_formatting/textile_formatter_test.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index 1beb9563c..0e948cfd5 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -57,7 +57,7 @@ module Redmine def extract_sections(index) @pre_list = [] text = self.dup - rip_offtags text + rip_offtags text, false before = '' s = '' after = '' 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 ec9b883b0..853b0d522 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -286,6 +286,8 @@ Pre Content: h2. Inside pre + inside pre block + Morbi facilisis accumsan orci non pharetra. ", # 2 @@ -300,6 +302,14 @@ Nulla nunc nisi, egestas in ornare vel, posuere ac libero."] assert_section_with_hash STR_WITH_PRE[2], text, 3 end + def test_update_section_should_not_escape_pre_content_outside_section + text = STR_WITH_PRE.join("\n\n") + replacement = "New text" + + assert_equal [STR_WITH_PRE[0..1], "New text"].flatten.join("\n\n"), + @formatter.new(text).update_section(3, replacement) + end + private def assert_html_output(to_test, expect_paragraph = true)