Skip to content

Commit

Permalink
Fix relative URLs for video tag
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rumdidumdum committed Jan 11, 2015
1 parent c811040 commit c72c3cd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins/video_tag.rb
Expand Up @@ -22,11 +22,11 @@ class VideoTag < Liquid::Tag
@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
Expand Down

0 comments on commit c72c3cd

Please sign in to comment.