Fix relative URLs for video tag

Fixes issue #1127. The markup regex only matched URLs beginning with 'http'.
This change adds support for relative URLs beginning with '/'. The regex is
based on the one used in image_tag.rb.
This commit is contained in:
Philippe Lovis 2015-01-11 11:01:04 +01:00
parent c811040d45
commit c72c3cd2a4

View File

@ -22,11 +22,11 @@ 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, $3, $5].compact
@width = $7
@height = $8
@poster = $10
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
super
end