Escapes double quotes in img tag

This commit is contained in:
Frederic Hemberger 2011-09-26 11:54:45 +02:00
parent 9bd572ffdc
commit 19a646b5e9

View File

@ -26,11 +26,11 @@ module Jekyll
if markup =~ /(?<class>\S.*\s+)?(?<src>(?:https?:\/\/|\/|\S+\/)\S+)(?:\s+(?<width>\d+))?(?:\s+(?<height>\d+))?(?<title>\s+.+)?/i
@img = attributes.reduce({}) { |img, attr| img[attr] = $~[attr].strip if $~[attr]; img }
if @img['title'] =~ /(?:"|')([^"']+)?(?:"|')\s+(?:"|')([^"']+)?(?:"|')/
@img['title'] = $1
@img['alt'] = $2
if /(?:"|')(?<title>[^"']+)?(?:"|')\s+(?:"|')(?<alt>[^"']+)?(?:"|')/ =~ @img['title']
@img['title'] = title
@img['alt'] = alt
else
@img['alt'] = @img['title'].gsub!(/"/, '')
@img['alt'] = @img['title'].gsub!(/"/, '&#34;')
end
@img['class'].gsub!(/"/, '')
end