Fixed: Wiki section edit escapes pre tags inside pre blocks (#9673).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7976 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-11-28 22:08:15 +00:00
parent c5cabfe106
commit d66c8faa9b
3 changed files with 9 additions and 4 deletions

View File

@ -1058,7 +1058,7 @@ class RedCloth3 < String
end end
end end
def rip_offtags( text, escape_aftertag=true ) def rip_offtags( text, escape_aftertag=true, escape_line=true )
if text =~ /<.*>/ if text =~ /<.*>/
## strip and encode <pre> content ## strip and encode <pre> content
codepre, used_offtags = 0, {} codepre, used_offtags = 0, {}
@ -1068,7 +1068,7 @@ class RedCloth3 < String
codepre += 1 codepre += 1
used_offtags[offtag] = true used_offtags[offtag] = true
if codepre - used_offtags.length > 0 if codepre - used_offtags.length > 0
htmlesc( line, :NoQuotes ) htmlesc( line, :NoQuotes ) if escape_line
@pre_list.last << line @pre_list.last << line
line = "" line = ""
else else
@ -1086,7 +1086,7 @@ class RedCloth3 < String
end end
elsif $1 and codepre > 0 elsif $1 and codepre > 0
if codepre - used_offtags.length > 0 if codepre - used_offtags.length > 0
htmlesc( line, :NoQuotes ) htmlesc( line, :NoQuotes ) if escape_line
@pre_list.last << line @pre_list.last << line
line = "" line = ""
end end

View File

@ -57,7 +57,7 @@ module Redmine
def extract_sections(index) def extract_sections(index)
@pre_list = [] @pre_list = []
text = self.dup text = self.dup
rip_offtags text, false rip_offtags text, false, false
before = '' before = ''
s = '' s = ''
after = '' after = ''

View File

@ -284,6 +284,11 @@ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.",
end end
</code></pre> </code></pre>
<pre><code><pre><code class=\"ruby\">
Place your code here.
</code></pre>
</code></pre>
Morbi facilisis accumsan orci non pharetra. Morbi facilisis accumsan orci non pharetra.
<pre> <pre>