aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Hemberger <mail@frederic-hemberger.de>2011-09-26 11:54:45 +0200
committerFrederic Hemberger <mail@frederic-hemberger.de>2011-09-26 11:55:43 +0200
commit19a646b5e9e5f294896afc7552a4941933b8fb22 (patch)
treed1bebb2ab87c078c0c2b733724f397aba845fc7e
parent9bd572ffdc907301691e5ff5a62d68ecfa883229 (diff)
downloadmy_new_personal_website-19a646b5e9e5f294896afc7552a4941933b8fb22.tar.xz
my_new_personal_website-19a646b5e9e5f294896afc7552a4941933b8fb22.zip
Escapes double quotes in img tag
-rw-r--r--plugins/image_tag.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/image_tag.rb b/plugins/image_tag.rb
index 92e21765..20595cb9 100644
--- a/plugins/image_tag.rb
+++ b/plugins/image_tag.rb
@@ -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