jekyll-poly 0.0.1 → 0.0.2

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: 36a4f4486cf13b79e60e2bc1084d280af0b0abda06178c4ed9c62de86b4f33d0
4
+ data.tar.gz: 2bb22e16ce5dfb2147fa7f99bb1319699179dff1ae59a1ed652f2bfd1c61fe5a
5
5
  SHA512:
6
- metadata.gz: 4c95af32c3e5a2edaddbe4d893ab69495d035e0e40e57ea230193fd01a06f87266d952f99db3eab892c868e5eef23eca790f67316c1e8e17efd6808d58f14ba5
7
- data.tar.gz: 7bc37751fda6e4061874dc82dacb5fd2196e4e8fa3242a8814637f23c09150bab0b0b280bfb7399a89807ab21e753d65b8f9504c30b540745dda1ccdad782551
6
+ metadata.gz: 4b8752910b1afcb3a20d229fcf0ea8214a40c98af1c0bf9065d772cad6c01834d70376f66c629ae86c13d4564c3cb2be089cc71fa908db9e2ce7e1ddec45014a
7
+ data.tar.gz: d647562b3044cd751cf9915e4f6ba0486797bf041c8c8bad15a31bcdb66f253a828ca36f0a4c7a16e7be83c3cf386cf6b290c031b43c0634974cc6b00c761a36
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"
Binary file
@@ -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,58 @@
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>
12
+ .google-poly-embed-container {
13
+ position: relative;
14
+ padding-bottom: 56.25%;
15
+ height: 0;
16
+ overflow: hidden;
17
+ max-width: 100%;
18
+ }
19
+ .google-poly-embed-container iframe,
20
+ .google-poly-embed-container object,
21
+ .google-poly-embed-container embed {
22
+ position: absolute;
23
+ top: 0;
24
+ left: 0;
25
+ width: 100%;
26
+ height: 100%;
27
+ }
28
+ </style>
29
+ <div class='google-poly-embed-container'>
30
+ <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>
31
+ </div>}
32
+ end
33
+
34
+ def generate_from_template(tmpl_path, poly_id)
35
+ @poly_id = poly_id
36
+ tmpl = File.read tmpl_path
37
+ site = context.registers[:site]
38
+ tmpl = (Liquid::Template.parse tmpl).render site.site_payload.merge!({"poly_id" => @poly_id})
39
+ end
40
+
41
+ def render(context)
42
+ poly_url = "#{context[@content.strip]}"
43
+
44
+ if poly_url[/poly\.google\.com\/view\/([^\?]*)/]
45
+ poly_id = $1
46
+ else
47
+ raise "The URL provided #{ poly_url } does not match a google poly URL"
48
+ end
49
+
50
+ tmpl_path = File.join Dir.pwd, "_includes", "poly.html"
51
+ if File.exist? tmpl_path
52
+ generate_from_template tmpl_path, poly_id
53
+ else
54
+ generate_iframe poly_id
55
+ end
56
+ end
57
+
58
+ Liquid::Template.register_tag "google_poly", Jekyll::PolyEmbed
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Poly
3
+ VERSION = "0.0.2"
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo Blondel
@@ -61,7 +61,14 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
+ - Gemfile
65
+ - LICENSE
64
66
  - README.md
67
+ - Rakefile
68
+ - jekyll-poly-0.0.1.gem
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