jekyll-embeds 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c46c92a5d87c9cfcc38eef6e29c074326797500bdf4204c0dd5a1b06221f7801
4
+ data.tar.gz: ab10e1daf85e63d2529526e72ca0c423e9ef78c306436e7310e410a7119a0d37
5
+ SHA512:
6
+ metadata.gz: 214d187c821676eaf22288421cbf5e6280f06c3b10db97540b7e4124130abe480adf25aa3ce9395b3dad06a8d009e30733a61a50ca5be921c2a5231550e1090e
7
+ data.tar.gz: 4b02cbeba82108dd94c9641a184ee409843032e956403d9b86659f6f6632de5cd9f2606e3227456e03861ea4817b6a561cc679e0d9d579bdcee6d15466bc025e
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jekyllcontentful.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 SEBAS204
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "jekyll-embeds"
7
+ spec.version = "0.0.4"
8
+ spec.authors = ["SEBAS204"]
9
+
10
+ spec.summary = %q{jekyll plugin to generate html snippets for embedding Youtube videos, twitch, etc}
11
+ spec.description = %q{jekyll plugin to generate html snippets for embedding Youtube videos, twitch, etc}
12
+ spec.homepage = "https://github.com/ZEBAS204/Jekyll-Embeds"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = ["Gemfile","jekyll-embeds.gemspec","Rakefile","LICENSE","lib/jekyll-embeds.rb"]
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.metadata = { "documentation_uri" => "https://github.com/ZEBAS204/Jekyll-Embeds/blob/master/README.md#usage" }
19
+
20
+ spec.add_dependency 'jekyll'
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,85 @@
1
+ require "jekyll"
2
+
3
+ class YouTubeEmbed < Liquid::Tag
4
+
5
+ def initialize(tagName, content, tokens)
6
+ super
7
+ @content = content
8
+ end
9
+
10
+ def render(context)
11
+ youtube_url = "#{context[@content.strip]}"
12
+ if youtube_url[/youtu\.be\/([^\?]*)/]
13
+ @youtube_id = $1
14
+ else
15
+ youtube_url[/^.*((v\/)|(embed\/)|(watch\?))\??v?=?([^\&\?]*).*/]
16
+ @youtube_id = $5
17
+ end
18
+
19
+ tmpl_path = File.join Dir.pwd, "_includes", "youtube.html"
20
+ if File.exist?(tmpl_path)
21
+ tmpl = File.read tmpl_path
22
+ site = context.registers[:site]
23
+ tmpl = (Liquid::Template.parse tmpl).render site.site_payload.merge!({"youtube_id" => @youtube_id})
24
+ else
25
+ %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>}
26
+ end
27
+ end
28
+
29
+ Liquid::Template.register_tag "youtube", self
30
+ end
31
+
32
+
33
+ class TwitchEmbed < Liquid::Tag
34
+
35
+ def initialize(tagName, content, tokens)
36
+ super
37
+ @content = content
38
+ end
39
+
40
+ def render(context)
41
+ twitch_url = "#{context[@content.strip]}"
42
+ if twitch_url[/twitch\.tv\/([^\?]*)/]
43
+ @twitch_id = $1
44
+ end
45
+
46
+ tmpl_path = File.join Dir.pwd, "_includes", "twitch.html"
47
+ if File.exist?(tmpl_path)
48
+ tmpl = File.read tmpl_path
49
+ site = context.registers[:site]
50
+ tmpl = (Liquid::Template.parse tmpl).render site.site_payload.merge!({"twitch_id" => @twitch_id})
51
+ else
52
+ %Q{<div class='embed-container'><iframe src="https://player.twitch.tv/?channel=#{ @twitch_id }" frameborder="0" allowfullscreen="true" scrolling="no" autoplay="false" height="390" width="640"></iframe></div>}
53
+ end
54
+ end
55
+
56
+ Liquid::Template.register_tag "twitch", self
57
+ end
58
+
59
+ class VimeoEmbed < Liquid::Tag
60
+
61
+ def initialize(tagName, content, tokens)
62
+ super
63
+ @content = content
64
+ end
65
+
66
+ def render(context)
67
+ vimeo_url = "#{context[@content.strip]}"
68
+ if vimeo_url[/vimeo\.com\/([^\?]*)/]
69
+ @vimeo_id = $1
70
+ end
71
+
72
+ tmpl_path = File.join Dir.pwd, "_includes", "vimeo.html"
73
+ if File.exist?(tmpl_path)
74
+ tmpl = File.read tmpl_path
75
+ site = context.registers[:site]
76
+ tmpl = (Liquid::Template.parse tmpl).render site.site_payload.merge!({"vimeo_id" => @vimeo_id})
77
+ else
78
+ %Q{<div class='embed-container'><iframe src="https://player.vimeo.com/video/#{ @vimeo_id }" frameborder="0" allowfullscreen="true" scrolling="no" height="390" width="640"></iframe></div>}
79
+ end
80
+ end
81
+
82
+ Liquid::Template.register_tag "vimeo", self
83
+ end
84
+
85
+ #! Google Drive & Twitch Clips embeds soon... (maybe).
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-embeds
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - SEBAS204
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-05-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: jekyll plugin to generate html snippets for embedding Youtube videos,
56
+ twitch, etc
57
+ email:
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - Gemfile
63
+ - LICENSE
64
+ - Rakefile
65
+ - jekyll-embeds.gemspec
66
+ - lib/jekyll-embeds.rb
67
+ homepage: https://github.com/ZEBAS204/Jekyll-Embeds
68
+ licenses:
69
+ - MIT
70
+ metadata:
71
+ documentation_uri: https://github.com/ZEBAS204/Jekyll-Embeds/blob/master/README.md#usage
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubygems_version: 3.0.1
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: jekyll plugin to generate html snippets for embedding Youtube videos, twitch,
91
+ etc
92
+ test_files: []