diff --git a/plugins/image_tag.rb b/plugins/image_tag.rb index 4567000..6fa68dc 100644 --- a/plugins/image_tag.rb +++ b/plugins/image_tag.rb @@ -24,7 +24,7 @@ module Jekyll def initialize(tag_name, markup, tokens) attributes = ['class', 'src', 'width', 'height', 'title'] - if markup =~ /(?\S.*\s+)?(?(?:https?:\/\/|\/|\S+\/)\S+)(?:\s+(?\d+))?(?:\s+(?\d+))?(?\s+.+)?/i + if markup =~ /(?<class>[\S\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 /(?:"|')(?<title>[^"']+)?(?:"|')\s+(?:"|')(?<alt>[^"']+)?(?:"|')/ =~ @img['title'] @img['title'] = title