]> source.dussan.org Git - redmine.git/commitdiff
Fixed: class attribute with spaces on pre tags truncated (#7033).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 5 Dec 2010 10:09:18 +0000 (10:09 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 5 Dec 2010 10:09:18 +0000 (10:09 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4468 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index d720af9d8cf0008e4fc8408452b52b857b912219..7c9df0727b3ee143899eac60231100989768f3c5 100644 (file)
@@ -1078,7 +1078,7 @@ class RedCloth3 < String
                         line = "<redpre##{ @pre_list.length }>"
                         first.match(/<#{ OFFTAGS }([^>]*)>/)
                         tag = $1
-                        $2.to_s.match(/(class\=\S+)/i)
+                        $2.to_s.match(/(class\=("[^"]+"|'[^']+'))/i)
                         tag << " #{$1}" if $1
                         @pre_list << "<#{ tag }>#{ aftertag }"
                     end
index 02b15fbf5833582c04869caaef98dd4f7b1f88a9..6327442c6c2dfe017e19ea8bb125e2a4740d935b 100644 (file)
@@ -275,6 +275,9 @@ RAW
       "<!-- opening comment" => "<p>&lt;!-- opening comment</p>",
       # remove attributes except class
       "<pre class='foo'>some text</pre>" => "<pre class='foo'>some text</pre>",
+      '<pre class="foo">some text</pre>' => '<pre class="foo">some text</pre>',
+      "<pre class='foo bar'>some text</pre>" => "<pre class='foo bar'>some text</pre>",
+      '<pre class="foo bar">some text</pre>' => '<pre class="foo bar">some text</pre>',
       "<pre onmouseover='alert(1)'>some text</pre>" => "<pre>some text</pre>",
     }
     to_test.each { |text, result| assert_equal result, textilizable(text) }