]> source.dussan.org Git - redmine.git/commitdiff
Remove pre tag attributes.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Oct 2008 19:13:36 +0000 (19:13 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Oct 2008 19:13:36 +0000 (19:13 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1930 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redcloth3.rb
test/unit/helpers/application_helper_test.rb

index cbca2bfd1ac2493f995e9ff8a4a95b3faff9269f..6f4fc9863b9493ce5eec25f6ae665264e141ddbd 100644 (file)
@@ -1051,7 +1051,7 @@ class RedCloth3 < String
                     else
                         htmlesc( aftertag, :NoQuotes ) if aftertag
                         line = "<redpre##{ @pre_list.length }>"
-                        @pre_list << "#{ $3 }#{ aftertag }"
+                        @pre_list << "#{ $3.gsub(/<(#{ OFFTAGS })[^>]*>/, '<\\1>') }#{ aftertag }"
                     end
                 elsif $1 and codepre > 0
                     if codepre - used_offtags.length > 0
index 14ca3cc64cc71e969c54f11f547400e5c45b0d56..cbdba5971bc09163cdb94c2c9064c891a3905fd8 100644 (file)
@@ -181,7 +181,9 @@ class ApplicationHelperTest < HelperTestCase
       "<pre><code>\nline 1\nline2</code></pre>" => "<pre><code>\nline 1\nline2</code></pre>",
       "<pre><div>content</div></pre>" => "<pre>&lt;div&gt;content&lt;/div&gt;</pre>",
       "HTML comment: <!-- no comments -->" => "<p>HTML comment: &lt;!-- no comments --&gt;</p>",
-      "<!-- opening comment" => "<p>&lt;!-- opening comment</p>"
+      "<!-- opening comment" => "<p>&lt;!-- opening comment</p>",
+      # remove attributes
+      "<pre class='foo'>some text</pre>" => "<pre>some text</pre>",
     }
     to_test.each { |text, result| assert_equal result, textilizable(text) }
   end