jekyll-polylist 0.0.1
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 +7 -0
- data/Gemfile +5 -0
- data/README.md +93 -0
- data/Rakefile +1 -0
- data/jekyll-polylist.gemspec +26 -0
- data/lib/jekyll-polylist.rb +55 -0
- data/lib/jekyll-polylist/version.rb +5 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 87ca955efebc6563bd8c9b22443714ead851db104ceb3f66d61ef074d4ff7cc5
|
4
|
+
data.tar.gz: 8221145fc1184daf22aaaad2f184ac84db70c14bb8b73ad05cfc771642e00c2e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 231a4723e5b3875f6130e76db2b220bdc07ba7af619dfa27f3e6d6624f2037342c8c1128acd974cabd9cd1586270cc38db1d1e517c0726a3c501d5a89cf436e0
|
7
|
+
data.tar.gz: 95d580325dc175a5524e2f206cd7ab4b3a4caf10a72068c95fdfc54a508e5812e9d210b0a30b69da570eb48d2cdbb9c22c113743ad4bba8fa8a6cd6a7a732641
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# jekyll-poly
|
2
|
+
|
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
|
+
|
5
|
+
## To Do
|
6
|
+
Add tests to this gem.
|
7
|
+
|
8
|
+
## Requirements
|
9
|
+
You will need to have a **Google Poly API key** created and have activated the Google Poly API on your google account.
|
10
|
+
|
11
|
+
Visit the https://developers.google.com/poly/develop/api and activate your Google Poly API (Not the Oauth section !) following the button Get API Key.
|
12
|
+
|
13
|
+
You will need to add this API key to your _config.yml file:
|
14
|
+
|
15
|
+
```
|
16
|
+
google_poly:
|
17
|
+
API_key: YOUR_API_KEY
|
18
|
+
```
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Add this line to your Gemfile:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
group :jekyll_plugins do
|
26
|
+
gem "jekyll-polylist"
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
And then execute:
|
31
|
+
|
32
|
+
$ bundle
|
33
|
+
|
34
|
+
Alternatively install the gem yourself as:
|
35
|
+
|
36
|
+
$ gem install jekyll-polylist
|
37
|
+
|
38
|
+
and put this in your ``_config.yml``
|
39
|
+
|
40
|
+
```yaml
|
41
|
+
plugins: [jekyll-polylist]
|
42
|
+
# This will require each of these gems automatically.
|
43
|
+
```
|
44
|
+
|
45
|
+
## Usage
|
46
|
+
|
47
|
+
### To get the Poly assets you created and made public
|
48
|
+
```
|
49
|
+
{% google_poly_list %}
|
50
|
+
```
|
51
|
+
|
52
|
+
### To get Poly assets that follow a keyword query
|
53
|
+
|
54
|
+
```
|
55
|
+
{% google_poly_list "keyword" %}
|
56
|
+
```
|
57
|
+
|
58
|
+
## Result
|
59
|
+
|
60
|
+
By default the plugin will output the following code
|
61
|
+
|
62
|
+
|
63
|
+
```markup
|
64
|
+
<style>
|
65
|
+
.google-poly-embed-container {
|
66
|
+
position: relative;
|
67
|
+
padding-bottom: 56.25%;
|
68
|
+
height: 0;
|
69
|
+
overflow: hidden;
|
70
|
+
max-width: 100%;
|
71
|
+
}
|
72
|
+
.google-poly-embed-container iframe,
|
73
|
+
.google-poly-embed-container object,
|
74
|
+
.google-poly-embed-container embed {
|
75
|
+
position: absolute;
|
76
|
+
top: 0;
|
77
|
+
left: 0;
|
78
|
+
width: 100%;
|
79
|
+
height: 100%;
|
80
|
+
}
|
81
|
+
</style>
|
82
|
+
<ul>
|
83
|
+
<li>
|
84
|
+
<div class='google-poly-embed-container'>
|
85
|
+
<iframe width="100%" height="480px" src="https://poly.google.com/view/7aCY_MMZWm8/embed" frameborder="0" style="border:none;" allowvr="yes" allow="vr; xr; accelerometer; magnetometer; gyroscope; autoplay;" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel="" ></iframe>
|
86
|
+
</div>
|
87
|
+
</li>
|
88
|
+
<li>
|
89
|
+
....
|
90
|
+
</ul>
|
91
|
+
```
|
92
|
+
|
93
|
+
You can specify your own snippet by creating a partial ``_includes/poly.html``. Inside that partial the Google Poly ID is available as ``{{ poly_id }}``.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,26 @@
|
|
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-polylist/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "jekyll-polylist"
|
9
|
+
spec.version = Jekyll::Polylist::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 from a keyword search}
|
14
|
+
spec.description = %q{jekyll plugin to generate html snippets for embedding Google Poly Assets from a keyword search}
|
15
|
+
spec.homepage = "https://gitlab.com/xqua/jekyll-polylist"
|
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_dependency 'jekyll-poly'
|
23
|
+
spec.add_dependency 'faraday'
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "jekyll"
|
2
|
+
require "jekyll-polylist/version"
|
3
|
+
require "jekyll-poly"
|
4
|
+
require 'faraday'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
class PolyListEmbed < Liquid::Tag
|
8
|
+
|
9
|
+
def initialize(tagName, content, tokens)
|
10
|
+
super
|
11
|
+
@content = content
|
12
|
+
@renderer = Jekyll::PolyEmbed.new()
|
13
|
+
@apikey = Jekyll.configuration({})['google_poly']['API_key']
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_assets(nextPageToken = "")
|
17
|
+
unless nextPageToken.nil?
|
18
|
+
pageToken = "&pageToken=#{ nextPageToken }"
|
19
|
+
else
|
20
|
+
pageToken = ""
|
21
|
+
end
|
22
|
+
url = "https://poly.googleapis.com/v1/assets?key=#{ @apikey }&keywords=#{ @keyword }&pageSize=100" + pageToken
|
23
|
+
response = Faraday.new(url).get
|
24
|
+
if response.status == 200:
|
25
|
+
body = JSON.parse(response.body)
|
26
|
+
body["assets"].each do |asset|
|
27
|
+
@assets << asset
|
28
|
+
end
|
29
|
+
unless body["nextPageToken"].nil?
|
30
|
+
get_assets(nextPageToken = body["nextPageToken"])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def render(context)
|
36
|
+
@keyword = "#{context[@content.strip]}"
|
37
|
+
get_assets()
|
38
|
+
output = "<div>\n"
|
39
|
+
@assets.each do |asset|
|
40
|
+
if asset["name"][/assets\/([^\?]*)/]
|
41
|
+
poly_id = $1
|
42
|
+
iframe = @renderer.generate(poly_id)
|
43
|
+
output += %Q{
|
44
|
+
<div class="poly-asset-container">
|
45
|
+
<h3 class="poly-asset-title">#{ asset["displayName"] }</h3>
|
46
|
+
<div class="poly-asset-iframe">
|
47
|
+
#{iframe}
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
Liquid::Template.register_tag "google_poly_list", Jekyll::PolyListEmbed
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-polylist
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Leo Blondel
|
8
|
+
- Lisa Blondel
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jekyll
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: jekyll-poly
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: faraday
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: bundler
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.10'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.10'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '10.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '10.0'
|
84
|
+
description: jekyll plugin to generate html snippets for embedding Google Poly Assets
|
85
|
+
from a keyword search
|
86
|
+
email:
|
87
|
+
- leo@jogl.io
|
88
|
+
- blondel.lisa@gmail.com
|
89
|
+
executables: []
|
90
|
+
extensions: []
|
91
|
+
extra_rdoc_files: []
|
92
|
+
files:
|
93
|
+
- Gemfile
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- jekyll-polylist.gemspec
|
97
|
+
- lib/jekyll-polylist.rb
|
98
|
+
- lib/jekyll-polylist/version.rb
|
99
|
+
homepage: https://gitlab.com/xqua/jekyll-polylist
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubygems_version: 3.0.3
|
119
|
+
signing_key:
|
120
|
+
specification_version: 4
|
121
|
+
summary: jekyll plugin to generate html snippets for embedding Google Poly Assets
|
122
|
+
from a keyword search
|
123
|
+
test_files: []
|