diff options
-rw-r--r-- | lib/redcloth3.rb | 2 | ||||
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb index cbca2bfd1..6f4fc9863 100644 --- a/lib/redcloth3.rb +++ b/lib/redcloth3.rb @@ -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 diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 14ca3cc64..cbdba5971 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -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><div>content</div></pre>", "HTML comment: <!-- no comments -->" => "<p>HTML comment: <!-- no comments --></p>", - "<!-- opening comment" => "<p><!-- opening comment</p>" + "<!-- opening comment" => "<p><!-- 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 |