Escapes double quotes in img tag
This commit is contained in:
parent
9bd572ffdc
commit
19a646b5e9
@ -26,11 +26,11 @@ module Jekyll
|
|||||||
|
|
||||||
if markup =~ /(?<class>\S.*\s+)?(?<src>(?:https?:\/\/|\/|\S+\/)\S+)(?:\s+(?<width>\d+))?(?:\s+(?<height>\d+))?(?<title>\s+.+)?/i
|
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 }
|
@img = attributes.reduce({}) { |img, attr| img[attr] = $~[attr].strip if $~[attr]; img }
|
||||||
if @img['title'] =~ /(?:"|')([^"']+)?(?:"|')\s+(?:"|')([^"']+)?(?:"|')/
|
if /(?:"|')(?<title>[^"']+)?(?:"|')\s+(?:"|')(?<alt>[^"']+)?(?:"|')/ =~ @img['title']
|
||||||
@img['title'] = $1
|
@img['title'] = title
|
||||||
@img['alt'] = $2
|
@img['alt'] = alt
|
||||||
else
|
else
|
||||||
@img['alt'] = @img['title'].gsub!(/"/, '')
|
@img['alt'] = @img['title'].gsub!(/"/, '"')
|
||||||
end
|
end
|
||||||
@img['class'].gsub!(/"/, '')
|
@img['class'].gsub!(/"/, '')
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user