jekyll-embeds 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/jekyll-embeds.gemspec +2 -2
- data/lib/jekyll-embeds.rb +42 -28
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c943b31803d9024efed4ca59394ff1c80a4cdd600898397d7fd2b29ab9d5198c
|
4
|
+
data.tar.gz: 3f5bb583bfc775502782b329d3c5b0c299b343398471f9953c57e5712b0b1d10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8512b5f1a52df67ea31e7d8c364dc3c614899ad68af0e45ca6787b924f43ffa6bb10e6a03e0b0478415b753fbf7555c3706db8f83a3ef65b81a22c102914c276
|
7
|
+
data.tar.gz: 6bec222152af851b6963899674340b63c27af84228dcc4733234e1a0a58577e7a56bef28399adef0ef3cb064fa732797d119dbba0bdc9ec07633b311b0d78c47
|
data/Gemfile
CHANGED
data/jekyll-embeds.gemspec
CHANGED
@@ -4,11 +4,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "jekyll-embeds"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.6"
|
8
8
|
spec.authors = ["SEBAS204"]
|
9
9
|
|
10
10
|
spec.summary = %q{Jekyll plugin for embedding diferent media elements.}
|
11
|
-
spec.description = %q{Jekyll plugin to generate html snippets for embedding Youtube
|
11
|
+
spec.description = %q{Jekyll plugin to generate html snippets for embedding Youtube; VIMEO; Twitch channels, videos & clips; SoundCloud.}
|
12
12
|
spec.homepage = "https://github.com/ZEBAS204/Jekyll-Embeds"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
data/lib/jekyll-embeds.rb
CHANGED
@@ -3,28 +3,22 @@ require 'shellwords'
|
|
3
3
|
|
4
4
|
class YouTubeEmbed < Liquid::Tag
|
5
5
|
|
6
|
-
def initialize(
|
6
|
+
def initialize(tag_name, markup, tokens)
|
7
7
|
super
|
8
|
-
|
8
|
+
params = Shellwords.shellwords markup
|
9
|
+
@items = { :url => params[0] }
|
9
10
|
end
|
10
11
|
|
11
12
|
def render(context)
|
12
|
-
youtube_url = "#{
|
13
|
+
youtube_url = "#{@items[:url].strip}"
|
13
14
|
if youtube_url[/youtu\.be\/([^\?]*)/]
|
14
15
|
@youtube_id = $1
|
15
16
|
else
|
16
17
|
youtube_url[/^.*((v\/)|(embed\/)|(watch\?))\??v?=?([^\&\?]*).*/]
|
17
18
|
@youtube_id = $5
|
18
19
|
end
|
19
|
-
|
20
|
-
|
21
|
-
if File.exist?(tmpl_path)
|
22
|
-
tmpl = File.read tmpl_path
|
23
|
-
site = context.registers[:site]
|
24
|
-
tmpl = (Liquid::Template.parse tmpl).render site.site_payload.merge!({"youtube_id" => @youtube_id})
|
25
|
-
else
|
26
|
-
%Q{<div class='embed-container'><iframe title="YouTube video player" width="640" height="390" src="//www.youtube.com/embed/#{ @youtube_id }" frameborder="0" allowfullscreen></iframe></div>}
|
27
|
-
end
|
20
|
+
|
21
|
+
%Q{<div class='embed-container'><iframe width="640" height="390" src="//www.youtube.com/embed/#{@youtube_id}" frameborder="0" allowfullscreen></iframe></div>}
|
28
22
|
end
|
29
23
|
|
30
24
|
Liquid::Template.register_tag "youtube", self
|
@@ -33,25 +27,45 @@ end
|
|
33
27
|
|
34
28
|
class TwitchEmbed < Liquid::Tag
|
35
29
|
|
36
|
-
def initialize(
|
30
|
+
def initialize(tag_name, markup, tokens)
|
37
31
|
super
|
38
|
-
|
32
|
+
params = Shellwords.shellwords markup
|
33
|
+
@items = { :url => params[0], :type => params[1] || "channel", :aplay => params[2] || false }
|
39
34
|
end
|
40
35
|
|
41
36
|
def render(context)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
37
|
+
tstr = "#{@items[:url].strip}"
|
38
|
+
|
39
|
+
case @items[:type]
|
40
|
+
when "channel" || "0"
|
41
|
+
if tstr[/twitch\.tv\/([^\?]*)/]
|
42
|
+
@twitch_url = $1
|
43
|
+
else
|
44
|
+
@twitch_url = "#{@items[:url]}"
|
45
|
+
end
|
46
|
+
%Q{<div class='embed-container'><iframe src="https://player.twitch.tv/?channel=#{@twitch_url}" frameborder="0" allowfullscreen="true" scrolling="no" autoplay="#{@items[:aplay]}" height="390" width="640"></iframe></div>}
|
47
|
+
|
48
|
+
when "video" || "1"
|
49
|
+
if tstr[/twitch\.tv\/videos\/([^\?]*)/]
|
50
|
+
@twitch_url = $1
|
51
|
+
else
|
52
|
+
@twitch_url = "#{@items[:url]}"
|
53
|
+
end
|
54
|
+
%Q{<div class='embed-container'><iframe src="https://player.twitch.tv/?video=#{@twitch_url}&autoplay=#{@items[:aplay]}" frameborder="0" allowfullscreen="true" scrolling="no" autoplay="#{@items[:aplay]}" height="390" width="640"></iframe></div>}
|
55
|
+
|
56
|
+
when "clip" || "2"
|
57
|
+
if tstr[/clips\.twitch\.tv\/([^\?]*)/]
|
58
|
+
@twitch_url = $1
|
59
|
+
elsif tstr[/twitch\.tv\/([^\?]*)\/clip\/([^\?]*)\?/]
|
60
|
+
@twitch_url = $2
|
61
|
+
else
|
62
|
+
@twitch_url = "#{@items[:url]}"
|
63
|
+
end
|
64
|
+
%Q{<div class='embed-container'><iframe src="https://clips.twitch.tv/embed?clip=#{@twitch_url}&autoplay=#{@items[:aplay]}" frameborder="0" allowfullscreen="true" scrolling="no" autoplay="#{@items[:aplay]}" height="390" width="640"></iframe></div>}
|
65
|
+
|
66
|
+
else
|
67
|
+
""
|
68
|
+
end
|
55
69
|
end
|
56
70
|
|
57
71
|
Liquid::Template.register_tag "twitch", self
|
@@ -90,7 +104,7 @@ class SoundCloudEmbed < Liquid::Tag
|
|
90
104
|
def initialize(tag_name, markup, tokens)
|
91
105
|
super
|
92
106
|
params = Shellwords.shellwords markup
|
93
|
-
@items = { :id => params[0], :color => params[1] || "ff7700", :aplay => params[2] ||
|
107
|
+
@items = { :id => params[0], :color => params[1] || "ff7700", :aplay => params[2] || false }
|
94
108
|
end
|
95
109
|
|
96
110
|
def render(context)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-embeds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SEBAS204
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -52,8 +52,8 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
-
description: Jekyll plugin to generate html snippets for embedding Youtube
|
56
|
-
Twitch channels
|
55
|
+
description: Jekyll plugin to generate html snippets for embedding Youtube; VIMEO;
|
56
|
+
Twitch channels, videos & clips; SoundCloud.
|
57
57
|
email:
|
58
58
|
executables: []
|
59
59
|
extensions: []
|