diff lib/redcloth3.rb @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents cbce1fd3b1b7
children 433d4f72a19b
line wrap: on
line diff
--- a/lib/redcloth3.rb	Fri Feb 24 18:36:29 2012 +0000
+++ b/lib/redcloth3.rb	Fri Feb 24 19:09:32 2012 +0000
@@ -340,9 +340,9 @@
     #
     A_HLGN = /(?:(?:<>|<|>|\=|[()]+)+)/
     A_VLGN = /[\-^~]/
-    C_CLAS = '(?:\([^)]+\))'
-    C_LNGE = '(?:\[[^\[\]]+\])'
-    C_STYL = '(?:\{[^}]+\})'
+    C_CLAS = '(?:\([^")]+\))'
+    C_LNGE = '(?:\[[^"\[\]]+\])'
+    C_STYL = '(?:\{[^"}]+\})'
     S_CSPN = '(?:\\\\\d+)'
     S_RSPN = '(?:/\d+)'
     A = "(?:#{A_HLGN}?#{A_VLGN}?|#{A_VLGN}?#{A_HLGN}?)"
@@ -938,7 +938,7 @@
             stln,algn,atts,url,title,href,href_a1,href_a2 = $~[1..8]
             htmlesc title
             atts = pba( atts )
-            atts = " src=\"#{ url }\"#{ atts }"
+            atts = " src=\"#{ htmlesc url.dup }\"#{ atts }"
             atts << " title=\"#{ title }\"" if title
             atts << " alt=\"#{ title }\"" 
             # size = @getimagesize($url);
@@ -1058,7 +1058,7 @@
         end
     end
 
-    def rip_offtags( text, escape_aftertag=true )
+    def rip_offtags( text, escape_aftertag=true, escape_line=true )
         if text =~ /<.*>/
             ## strip and encode <pre> content
             codepre, used_offtags = 0, {}
@@ -1068,7 +1068,7 @@
                     codepre += 1
                     used_offtags[offtag] = true
                     if codepre - used_offtags.length > 0
-                        htmlesc( line, :NoQuotes )
+                        htmlesc( line, :NoQuotes ) if escape_line
                         @pre_list.last << line
                         line = ""
                     else
@@ -1086,7 +1086,7 @@
                     end
                 elsif $1 and codepre > 0
                     if codepre - used_offtags.length > 0
-                        htmlesc( line, :NoQuotes )
+                        htmlesc( line, :NoQuotes ) if escape_line
                         @pre_list.last << line
                         line = ""
                     end