diff --git a/plugins/video_tag.rb b/plugins/video_tag.rb index 2a82b05..0016e10 100644 --- a/plugins/video_tag.rb +++ b/plugins/video_tag.rb @@ -22,33 +22,39 @@ module Jekyll @width = '' def initialize(tag_name, markup, tokens) - if markup =~ /((https?:\/\/|\/)\S+)(\s+((https?:\/\/|\/)\S+))?(\s+((https?:\/\/|\/)\S+))?(\s+(\d+)\s(\d+))?(\s+((https?:\/\/|\/)\S+))?/i - @video = [$1, $4, $7].compact - @width = $10 - @height = $11 - @poster = $13 - end + @videos = markup.scan(/((https?:\/\/|\/)\S+\.(webm|ogv|mp4)\S*)/i).map(&:first).compact + @poster = markup.scan(/((https?:\/\/|\/)\S+\.(png|gif|jpe?g)\S*)/i).map(&:first).compact.first + @sizes = markup.scan(/\s(\d\S+)/i).map(&:first).compact super end def render(context) output = super - type = { - 'mp4' => "type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'", - 'ogv' => "type='video/ogg; codecs=theora, vorbis'", - 'webm' => "type='video/webm; codecs=vp8, vorbis'" + types = { + '.mp4' => "type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'", + '.ogv' => "type='video/ogg; codecs=theora, vorbis'", + '.webm' => "type='video/webm; codecs=vp8, vorbis'" } - if @video.size > 0 - video = "