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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b38b426a93dd2193377a1196182a6b9db1b0c3843824551ab755773e5a1211c5
4
- data.tar.gz: ab4df019c2fac476882a0af1809ebb6fe47f5353ed68df7b91dbd864a5c9c2ee
3
+ metadata.gz: 11c424e65869dbe52d2594d1a29c7ba6a8406a68e5b090a7611295ee340422a8
4
+ data.tar.gz: 9cc797182fa9f50e42879e3f4cfd5fd5d5c39f81611a03b2ca5daf89bb0341d9
5
5
  SHA512:
6
- metadata.gz: 2f2229ad5021026285d8cdee9c08ef94ee90e1d12dab8c90b52503583863b0ef494d2e63f3b5dd8a849f87ab0ba91c9b7fcc6fbd24f43b8f2b72398375b1840d
7
- data.tar.gz: 7f3018012b4fb322db894989058ad13eb5b43404660c5ae697f2941349473eda956b92bcff0e9c79a99021b7c4cf5f9a16edf7cc9c66c2af5295910acdacf3b1
6
+ metadata.gz: 51b8c03283b85aaf959f3cff143a755ecd1e0d16e70495a962d84c27375d599878a4d0efb66dc7a9809e135310c34a23219b1b151e41065aa2713f5fcfb387b1
7
+ data.tar.gz: 4b29b0e38ae93fe7354c16329baf0e7f3098b206151cc71a4d5f274bdb8fba1d5cb0894b1c6e861a369c3d87dd44537bc00849a9104b764ed4d96759d94e2b02
@@ -0,0 +1,11 @@
1
+ _site
2
+ .sass-cache
3
+ .jekyll-metadata
4
+ .vscode
5
+ .img-cache
6
+ .img-assets
7
+ .tweet-cache
8
+ .DS_Store
9
+ Gemfile.lock
10
+ node_modules
11
+
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
@@ -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
@@ -0,0 +1,6 @@
1
+ module Jekyll
2
+ module Xtube
3
+ VERSION = "0.3.0"
4
+ end
5
+ end
6
+
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.2.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
- - lib/gkjekyll-picture-tag.rb
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
@@ -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
-