jekyll-plugin-gkpicturetag 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +11 -0
- data/Gemfile +2 -0
- data/Rakefile +1 -0
- data/jekyll-plugin-gkpicturetag.gemspec +25 -0
- data/lib/jekyll-plugin-gkpicturetag.rb +31 -0
- data/lib/jekyll-plugin-gkpicturetag/version.rb +6 -0
- data/screenshot.png +0 -0
- metadata +8 -2
- data/lib/gkjekyll-picture-tag.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11c424e65869dbe52d2594d1a29c7ba6a8406a68e5b090a7611295ee340422a8
|
4
|
+
data.tar.gz: 9cc797182fa9f50e42879e3f4cfd5fd5d5c39f81611a03b2ca5daf89bb0341d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51b8c03283b85aaf959f3cff143a755ecd1e0d16e70495a962d84c27375d599878a4d0efb66dc7a9809e135310c34a23219b1b151e41065aa2713f5fcfb387b1
|
7
|
+
data.tar.gz: 4b29b0e38ae93fe7354c16329baf0e7f3098b206151cc71a4d5f274bdb8fba1d5cb0894b1c6e861a369c3d87dd44537bc00849a9104b764ed4d96759d94e2b02
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll-plugin-gkpicturetag/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jekyll-plugin-gkpicturetag"
|
8
|
+
spec.version = Jekyll::Xtube::VERSION
|
9
|
+
spec.authors = ["@glueckkanja"]
|
10
|
+
spec.email = ["info@glueckkanja.com"]
|
11
|
+
|
12
|
+
spec.summary = "GK Jekyll Picture Tag"
|
13
|
+
spec.homepage = "https://glueckkanja.com"
|
14
|
+
spec.license = "Nonstandard"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_dependency 'jekyll', '~> 3.7'
|
20
|
+
spec.add_dependency 'fastimage', '~> 1.6'
|
21
|
+
spec.add_dependency 'mini_magick', '~> 3.8'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "jekyll"
|
2
|
+
require "jekyll-plugin-gkpicturetag/version"
|
3
|
+
class XTubeEmbed < 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
|
+
# Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367
|
16
|
+
youtube_url[/^.*((v\/)|(embed\/)|(watch\?))\??v?=?([^\&\?]*).*/]
|
17
|
+
@youtube_id = $5
|
18
|
+
end
|
19
|
+
|
20
|
+
tmpl_path = File.join Dir.pwd, "_includes", "youtube.html"
|
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{<style>.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><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
|
28
|
+
end
|
29
|
+
|
30
|
+
Liquid::Template.register_tag "xtube", self
|
31
|
+
end
|
data/screenshot.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-plugin-gkpicturetag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "@glueckkanja"
|
@@ -87,9 +87,15 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
90
92
|
- LICENSE.txt
|
91
93
|
- README.md
|
92
|
-
-
|
94
|
+
- Rakefile
|
95
|
+
- jekyll-plugin-gkpicturetag.gemspec
|
96
|
+
- lib/jekyll-plugin-gkpicturetag.rb
|
97
|
+
- lib/jekyll-plugin-gkpicturetag/version.rb
|
98
|
+
- screenshot.png
|
93
99
|
homepage: https://glueckkanja.com
|
94
100
|
licenses:
|
95
101
|
- Nonstandard
|
data/lib/gkjekyll-picture-tag.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
class YouTube < Liquid::Tag
|
2
|
-
Syntax = /^\s*([^\s]+)(\s+(\d+)\s+(\d+)\s*)?/
|
3
|
-
|
4
|
-
def initialize(tagName, markup, tokens)
|
5
|
-
super
|
6
|
-
|
7
|
-
if markup =~ Syntax then
|
8
|
-
@id = $1
|
9
|
-
|
10
|
-
if $2.nil? then
|
11
|
-
@width = 560
|
12
|
-
@height = 420
|
13
|
-
else
|
14
|
-
@width = $2.to_i
|
15
|
-
@height = $3.to_i
|
16
|
-
end
|
17
|
-
else
|
18
|
-
raise "No YouTube ID provided in the \"youtube\" tag"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def render(context)
|
23
|
-
# "<iframe width=\"#{@width}\" height=\"#{@height}\" src=\"https://www.youtube.com/embed/#{@id}\" frameborder=\"0\"allowfullscreen></iframe>"
|
24
|
-
"<iframe width=\"#{@width}\" height=\"#{@height}\" src=\"https://www.youtube.com/embed/#{@id}?color=white&theme=light\"></iframe>"
|
25
|
-
end
|
26
|
-
|
27
|
-
Liquid::Template.register_tag "xtube", self
|
28
|
-
end
|
29
|
-
|