diff lib/redcloth3.rb @ 511:107d36338b70 live

Merge from branch "cannam"
author Chris Cannam
date Thu, 14 Jul 2011 10:43:07 +0100
parents cbce1fd3b1b7
children cbb26bc654de
line wrap: on
line diff
--- a/lib/redcloth3.rb	Thu Jun 09 16:51:06 2011 +0100
+++ b/lib/redcloth3.rb	Thu Jul 14 10:43:07 2011 +0100
@@ -296,11 +296,11 @@
         rip_offtags text
         no_textile text
         escape_html_tags text
+        # need to do this before #hard_break and #blocks
+        block_textile_quotes text unless @lite_mode
         hard_break text 
         unless @lite_mode
             refs text
-            # need to do this before text is split by #blocks
-            block_textile_quotes text
             blocks text
         end
         inline text
@@ -707,11 +707,13 @@
             atts = pba( atts )
 
             # pass to prefix handler
+            replacement = nil
             if respond_to? "textile_#{ tag }", true
-                text.gsub!( $&, method( "textile_#{ tag }" ).call( tag, atts, cite, content ) )
+              replacement = method( "textile_#{ tag }" ).call( tag, atts, cite, content )
             elsif respond_to? "textile_#{ tagpre }_", true
-                text.gsub!( $&, method( "textile_#{ tagpre }_" ).call( tagpre, num, atts, cite, content ) )
+              replacement = method( "textile_#{ tagpre }_" ).call( tagpre, num, atts, cite, content )  
             end
+            text.gsub!( $& ) { replacement } if replacement
         end
     end
     
@@ -1078,7 +1080,7 @@
                         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