jekyll-poly 0.0.1 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd340be6b6d4a6c074f22a2aec6a160062c4da0a34b4f8f342d315567126f4ec
4
- data.tar.gz: 759fd9aa769ac00e5583c9eb4ca3cef4335ed8db29087f7249bf7d32815c6cad
3
+ metadata.gz: 7851d1abb3cdf9bdc6c4111eaf672f18750bcf3c59222870318e099f3b7cd848
4
+ data.tar.gz: '03292241c3efdcb131572d6048a53821991fe78da0f173f6b5533472fac6236c'
5
5
  SHA512:
6
- metadata.gz: 4c95af32c3e5a2edaddbe4d893ab69495d035e0e40e57ea230193fd01a06f87266d952f99db3eab892c868e5eef23eca790f67316c1e8e17efd6808d58f14ba5
7
- data.tar.gz: 7bc37751fda6e4061874dc82dacb5fd2196e4e8fa3242a8814637f23c09150bab0b0b280bfb7399a89807ab21e753d65b8f9504c30b540745dda1ccdad782551
6
+ metadata.gz: 334d8336e6c27ce4c197fb41cf12eabd1de2b01f8616bc59fbddb1006a8ddab4b7eada88256893caca057cadeedde97c7ef35f8700e685a26979ddc2d357cbb9
7
+ data.tar.gz: b0b8c299845d176098e564b51509204e9f58dc16b99e7b50919c8c1558bf27ba4ce7565efdd1e380f1c153afd6bbfabbc3b7663773446ab9621e15b234de525c
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .DS_Store
11
+ *.gem
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) 2020 Xqua
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/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  This Jekyll plugin provides a liquid tag that needs a Google Poly URL as input and will generates a (responsive) html snippet to embed the video into your site.
4
4
 
5
- # Jekyll Youtube
6
-
5
+ ## To Do
6
+ Add tests to this gem.
7
7
 
8
8
  ## Installation
9
9
 
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'jekyll-poly/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "jekyll-poly"
9
+ spec.version = Jekyll::Poly::VERSION
10
+ spec.authors = ["Leo Blondel", "Lisa Blondel"]
11
+ spec.email = ["leo@jogl.io", "blondel.lisa@gmail.com"]
12
+
13
+ spec.summary = %q{jekyll plugin to generate html snippets for embedding Google Poly Assets}
14
+ spec.description = %q{jekyll plugin to generate html snippets for embedding Google Poly Assets}
15
+ spec.homepage = "https://gitlab.com/xqua/jekyll-poly"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'jekyll'
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
@@ -0,0 +1,42 @@
1
+ require "jekyll"
2
+ require "jekyll-poly/version"
3
+ class PolyEmbed < Liquid::Tag
4
+
5
+ def initialize(tagName, content, tokens)
6
+ super
7
+ @content = content
8
+ end
9
+
10
+ def generate_iframe(poly_id)
11
+ %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 width="100%" height="480px" src="https://poly.google.com/view/#{ poly_id }/embed" frameborder="0" style="border:none;" allowvr="yes" allow="vr; xr; accelerometer; magnetometer; gyroscope; autoplay;" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel="" ></iframe></div>}
12
+ end
13
+
14
+ def generate_from_template(context, tmpl_path, poly_id)
15
+ @poly_id = poly_id
16
+ tmpl = File.read tmpl_path
17
+ site = context.registers[:site]
18
+ tmpl = (Liquid::Template.parse tmpl).render site.site_payload.merge!({"poly_id" => @poly_id})
19
+ end
20
+
21
+ def generate(context, poly_id)
22
+ tmpl_path = File.join Dir.pwd, "_includes", "poly.html"
23
+ if File.exist? tmpl_path
24
+ generate_from_template context, tmpl_path, poly_id
25
+ else
26
+ generate_iframe poly_id
27
+ end
28
+ end
29
+
30
+ def render(context)
31
+ poly_url = "#{context[@content.strip]}"
32
+
33
+ if poly_url[/poly\.google\.com\/view\/([^\?]*)/]
34
+ poly_id = $1
35
+ else
36
+ raise "The URL provided #{ poly_url } does not match a google poly URL"
37
+ end
38
+
39
+ generate(context, poly_id)
40
+ end
41
+ Liquid::Template.register_tag "google_poly", self
42
+ end
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Poly
3
+ VERSION = "0.0.8"
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-poly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo Blondel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-06-01 00:00:00.000000000 Z
12
+ date: 2020-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -61,7 +61,14 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - LICENSE
64
67
  - README.md
68
+ - Rakefile
69
+ - jekyll-poly.gemspec
70
+ - lib/jekyll-poly.rb
71
+ - lib/jekyll-poly/version.rb
65
72
  homepage: https://gitlab.com/xqua/jekyll-poly
66
73
  licenses:
67
74
  - MIT