]> source.dussan.org Git - redmine.git/commitdiff
Fixed: Wiki section edit escapes pre tags inside pre blocks (#9673).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 28 Nov 2011 22:08:15 +0000 (22:08 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 28 Nov 2011 22:08:15 +0000 (22:08 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7976 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 8a33943dc01b5bcccdfbe415d91c63722ac83768..d09804f41653f13464341012938e09dc8909a601 100644 (file)
@@ -1058,7 +1058,7 @@ class RedCloth3 < String
         end
     end
 
-    def rip_offtags( text, escape_aftertag=true )
+    def rip_offtags( text, escape_aftertag=true, escape_line=true )
         if text =~ /<.*>/
             ## strip and encode <pre> content
             codepre, used_offtags = 0, {}
@@ -1068,7 +1068,7 @@ class RedCloth3 < String
                     codepre += 1
                     used_offtags[offtag] = true
                     if codepre - used_offtags.length > 0
-                        htmlesc( line, :NoQuotes )
+                        htmlesc( line, :NoQuotes ) if escape_line
                         @pre_list.last << line
                         line = ""
                     else
@@ -1086,7 +1086,7 @@ class RedCloth3 < String
                     end
                 elsif $1 and codepre > 0
                     if codepre - used_offtags.length > 0
-                        htmlesc( line, :NoQuotes )
+                        htmlesc( line, :NoQuotes ) if escape_line
                         @pre_list.last << line
                         line = ""
                     end
index 1122883eb0d6aa68a55f9ff9b198b3b310b22e39..22cd5cbf9bbd607495cab3be32807005f978df76 100644 (file)
@@ -57,7 +57,7 @@ module Redmine
         def extract_sections(index)
           @pre_list = []
           text = self.dup
-          rip_offtags text, false
+          rip_offtags text, false, false
           before = ''
           s = ''
           after = ''
index 8d33db1b42ec3b1e56a7e553818c47d76d4d0996..26250997eea938a90576a2e312d73ddbebe980d3 100644 (file)
@@ -284,6 +284,11 @@ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.",
   end
 </code></pre>
 
+<pre><code><pre><code class=\"ruby\">
+  Place your code here.
+</code></pre>
+</code></pre>
+
 Morbi facilisis accumsan orci non pharetra.
 
 <pre>