Escape double-quotes in image titles.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2144 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2008-12-19 10:16:15 +00:00
parent 3ce1be14f7
commit 4ec5b1600a
2 changed files with 7 additions and 1 deletions
+5 -1
View File
@@ -435,12 +435,15 @@ class RedCloth3 < String
#
# Flexible HTML escaping
#
def htmlesc( str, mode )
def htmlesc( str, mode=:Quotes )
if str
str.gsub!( '&', '&amp;' )
str.gsub!( '"', '&quot;' ) if mode != :NoQuotes
str.gsub!( "'", '&#039;' ) if mode == :Quotes
str.gsub!( '<', '&lt;')
str.gsub!( '>', '&gt;')
end
str
end
# Search and replace for Textile glyphs (quotes, dashes, other symbols)
@@ -914,6 +917,7 @@ class RedCloth3 < String
def inline_textile_image( text )
text.gsub!( IMAGE_RE ) do |m|
stln,algn,atts,url,title,href,href_a1,href_a2 = $~[1..8]
htmlesc title
atts = pba( atts )
atts = " src=\"#{ url }\"#{ atts }"
atts << " title=\"#{ title }\"" if title