diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb index 638ef6d9..220617f1 100644 --- a/lib/redcloth3.rb +++ b/lib/redcloth3.rb @@ -1051,7 +1051,11 @@ class RedCloth3 < String else htmlesc( aftertag, :NoQuotes ) if aftertag line = "" - @pre_list << "#{ $3.gsub(/<(#{ OFFTAGS })[^>]*>/, '<\\1>') }#{ aftertag }" + $3.match(/<#{ OFFTAGS }([^>]*)>/) + tag = $1 + $2.to_s.match(/(class\=\S+)/i) + tag << " #{$1}" if $1 + @pre_list << "<#{ tag }>#{ 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 cbf5a54b..b3ff974e 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -192,8 +192,9 @@ class ApplicationHelperTest < HelperTestCase "
content
" => "
<div>content</div>
", "HTML comment: " => "

HTML comment: <!-- no comments -->

", "