##// END OF EJS Templates
Fixed: Wiki section edit escapes pre tags inside pre blocks (#9673)....
Jean-Philippe Lang -
r7856:d66c8faa9bc5
parent child
Show More
@@ -1058,7 +1058,7 class RedCloth3 < String
1058 end
1058 end
1059 end
1059 end
1060
1060
1061 def rip_offtags( text, escape_aftertag=true )
1061 def rip_offtags( text, escape_aftertag=true, escape_line=true )
1062 if text =~ /<.*>/
1062 if text =~ /<.*>/
1063 ## strip and encode <pre> content
1063 ## strip and encode <pre> content
1064 codepre, used_offtags = 0, {}
1064 codepre, used_offtags = 0, {}
@@ -1068,7 +1068,7 class RedCloth3 < String
1068 codepre += 1
1068 codepre += 1
1069 used_offtags[offtag] = true
1069 used_offtags[offtag] = true
1070 if codepre - used_offtags.length > 0
1070 if codepre - used_offtags.length > 0
1071 htmlesc( line, :NoQuotes )
1071 htmlesc( line, :NoQuotes ) if escape_line
1072 @pre_list.last << line
1072 @pre_list.last << line
1073 line = ""
1073 line = ""
1074 else
1074 else
@@ -1086,7 +1086,7 class RedCloth3 < String
1086 end
1086 end
1087 elsif $1 and codepre > 0
1087 elsif $1 and codepre > 0
1088 if codepre - used_offtags.length > 0
1088 if codepre - used_offtags.length > 0
1089 htmlesc( line, :NoQuotes )
1089 htmlesc( line, :NoQuotes ) if escape_line
1090 @pre_list.last << line
1090 @pre_list.last << line
1091 line = ""
1091 line = ""
1092 end
1092 end
@@ -57,7 +57,7 module Redmine
57 def extract_sections(index)
57 def extract_sections(index)
58 @pre_list = []
58 @pre_list = []
59 text = self.dup
59 text = self.dup
60 rip_offtags text, false
60 rip_offtags text, false, false
61 before = ''
61 before = ''
62 s = ''
62 s = ''
63 after = ''
63 after = ''
@@ -284,6 +284,11 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.",
284 end
284 end
285 </code></pre>
285 </code></pre>
286
286
287 <pre><code><pre><code class=\"ruby\">
288 Place your code here.
289 </code></pre>
290 </code></pre>
291
287 Morbi facilisis accumsan orci non pharetra.
292 Morbi facilisis accumsan orci non pharetra.
288
293
289 <pre>
294 <pre>
General Comments 0
You need to be logged in to leave comments. Login now