From 9ae6e60c260e8d695034244eb890fc77c60f54f6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 8 Nov 2008 15:18:02 +0000 Subject: [PATCH] Fixes syntax highlighting broken by r1930 (#2143). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1993 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redcloth3.rb | 6 +++++- test/unit/helpers/application_helper_test.rb | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb index 638ef6d97..220617f14 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 cbf5a54bc..b3ff974e9 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 -->

", "