jekyll-linkpreview 0.4.0 → 0.5.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: d55e7758cdacbdcbd976a0669efd3f4210a77e02f3ac6fa5e1518d8d1ee863e7
4
- data.tar.gz: 6ca1a338b6bdc68e3a769b5c6c071a91a1dbaa909fdf86f4e1a41707b2edf043
3
+ metadata.gz: 6145c1a65dbaab48f8d1ce4b96e819ab91a1c9ccc17ee677a345c89cf5c3c15a
4
+ data.tar.gz: 0b6dea42bd3b46a9b3a4d5dd0ff5a4a9eac69221bc6f810ebcddedfe80d6d133
5
5
  SHA512:
6
- metadata.gz: 8390070dc663f7f5a07d5e13c8b6e804a6e6649f1de07bf1443f054048858a8ccad6a6eff970a706c87a71baf3e2a9efc57e750bb82d596defaadc310fbd2719
7
- data.tar.gz: ae3b069df61e1b9d151a56d20054ab67b910a3965c76265f7f8f3626e0b7c8a88b91bf56db20cd7d0468a5b46d77c52c28bf51a5860dd2e756355354167f571c
6
+ metadata.gz: 5155c52c70a23ae14be7b650b8bd04b64458c2a2e3ffb076b339701a0f7042ab36452bdc1a68f80bf4b8a116e377c3162522c86a69268ab1afb1a17c68e30265
7
+ data.tar.gz: 4ee825fc487c1b0f98e9f8696210730972918db867b4a5065d533f68ae0b958d81f539e54edb013d7107cd03f788204d360de28450a763916341044bfdaffe25
@@ -0,0 +1,39 @@
1
+ name: Test
2
+ on: [push]
3
+ jobs:
4
+ test:
5
+ container:
6
+ image: ruby:${{ matrix.ruby }}
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: ["2.7", "3.1"]
11
+ appraisal:
12
+ - jekyll-35
13
+ - jekyll-36
14
+ - jekyll-37
15
+ - jekyll-38
16
+ - jekyll-39
17
+ - jekyll-40
18
+ - jekyll-41
19
+ - jekyll-42
20
+ - jekyll-43
21
+ exclude:
22
+ # To prevent 'cannot load such file -- rexml/parsers/baseparser'
23
+ - ruby: "3.1"
24
+ appraisal: jekyll-35
25
+ - ruby: "3.1"
26
+ appraisal: jekyll-36
27
+ - ruby: "3.1"
28
+ appraisal: jekyll-37
29
+ - ruby: "3.1"
30
+ appraisal: jekyll-38
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v3
34
+ - name: Install dependencies
35
+ run: bundle install
36
+ - name: Install dependencies for each appraisal
37
+ run: bundle exec appraisal install
38
+ - name: Run tests
39
+ run: bundle exec appraisal ${{ matrix.appraisal }} rake test
data/Appraisals CHANGED
@@ -1,23 +1,35 @@
1
1
  appraise "jekyll-35" do
2
- gem "jekyll", "3.5.2"
2
+ gem "jekyll", "~> 3.5.2"
3
3
  end
4
4
 
5
5
  appraise "jekyll-36" do
6
- gem "jekyll", "3.6.3"
6
+ gem "jekyll", "~> 3.6.3"
7
7
  end
8
8
 
9
9
  appraise "jekyll-37" do
10
- gem "jekyll", "3.7.4"
10
+ gem "jekyll", "~> 3.7.4"
11
11
  end
12
12
 
13
13
  appraise "jekyll-38" do
14
- gem "jekyll", "3.8.7"
14
+ gem "jekyll", "~> 3.8.7"
15
+ end
16
+
17
+ appraise "jekyll-39" do
18
+ gem "jekyll", "~> 3.9.1"
15
19
  end
16
20
 
17
21
  appraise "jekyll-40" do
18
- gem "jekyll", "4.0.1"
22
+ gem "jekyll", "~> 4.0.1"
19
23
  end
20
24
 
21
25
  appraise "jekyll-41" do
22
- gem "jekyll", "4.1.0"
26
+ gem "jekyll", "~> 4.1.1"
27
+ end
28
+
29
+ appraise "jekyll-42" do
30
+ gem "jekyll", "~> 4.2.2"
31
+ end
32
+
33
+ appraise "jekyll-43" do
34
+ gem "jekyll", "~> 4.3.1"
23
35
  end
data/README.md CHANGED
@@ -34,6 +34,7 @@ See https://jekyllrb.com/docs/plugins/installation/ .
34
34
  ## Usage
35
35
 
36
36
  1. Create `_cache` directory.
37
+ * This directory _must_ exist under your project root even if you've modified the [site source](https://jekyllrb.com/docs/configuration/options/).
37
38
 
38
39
  1. Embed [linkpreview.css](assets/css/linkpreview.css) into your Website.
39
40
 
@@ -49,6 +50,8 @@ You can override the default templates used for generating previews, both in cas
49
50
  ### Template for pages where Open Graph protocol metadata exists
50
51
 
51
52
  1. Place `linkpreview.html` file inside `_includes/` folder of your Jekyll site (`_includes/linkpreview.html`)
53
+ * The folder is the same one you would store files for use with `{% include fragment.html %}` tag.
54
+ Therefore, it *must* be under the [site's source](https://jekyllrb.com/docs/configuration/options/).
52
55
 
53
56
  2. Use built-in variables to extract data which you would like to render. Available variables are:
54
57
  * **link_url** i.e. `{{ link_url }}`
@@ -60,6 +63,8 @@ You can override the default templates used for generating previews, both in cas
60
63
  ### Template for pages where Open Graph protocol metadata does not exist
61
64
 
62
65
  1. Place `linkpreview_nog.html` file inside `_includes/` folder of your Jekyll site (`_includes/linkpreview_nog.html`)
66
+ * The folder is the same one you would store files for use with `{% include fragment.html %}` tag.
67
+ Therefore, it *must* be under the [site's source](https://jekyllrb.com/docs/configuration/options/).
63
68
 
64
69
  2. Use built-in variables to extract data which you would like to render. Available variables are:
65
70
  * **link_url** i.e. `{{ link_url }}`
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 2.0"
24
24
  spec.add_development_dependency "rake", "~> 12.3.3"
25
25
  spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "rspec-parameterized", "~> 0.5.2"
26
27
  spec.add_development_dependency "appraisal", "~> 2.2.0"
27
28
  spec.add_development_dependency "wwtd", "~> 1.4.1"
28
29
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Linkpreview
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
@@ -147,7 +147,7 @@ module Jekyll
147
147
  def render(context)
148
148
  url = get_url_from(context)
149
149
  properties = get_properties(url)
150
- render_linkpreview properties
150
+ render_linkpreview context, properties
151
151
  end
152
152
 
153
153
  def get_properties(url)
@@ -208,8 +208,8 @@ module Jekyll
208
208
  end
209
209
 
210
210
  private
211
- def render_linkpreview(properties)
212
- template_path = get_custom_template_path properties
211
+ def render_linkpreview(context, properties)
212
+ template_path = get_custom_template_path context, properties
213
213
  if File.exist?(template_path)
214
214
  hash = properties.to_hash_for_custom_template
215
215
  gen_custom_template template_path, hash
@@ -219,8 +219,14 @@ module Jekyll
219
219
  end
220
220
 
221
221
  private
222
- def get_custom_template_path(properties)
223
- File.join Dir.pwd, @@template_dir, properties.template_file
222
+ def get_custom_template_path(context, properties)
223
+ source_dir = get_source_dir_from context
224
+ File.join source_dir, @@template_dir, properties.template_file
225
+ end
226
+
227
+ private
228
+ def get_source_dir_from(context)
229
+ File.absolute_path context.registers[:site].config['source'], Dir.pwd
224
230
  end
225
231
 
226
232
  private
@@ -254,7 +260,7 @@ EOS
254
260
  </div>
255
261
  </div>
256
262
  <div class="jekyll-linkpreview-footer">
257
- <a href="#{domain}" target="_blank">#{domain}</a>
263
+ <a href="//#{domain}" target="_blank">#{domain}</a>
258
264
  </div>
259
265
  </div>
260
266
  </div>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-linkpreview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Nishioka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-26 00:00:00.000000000 Z
11
+ date: 2022-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '3.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec-parameterized
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 0.5.2
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: 0.5.2
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: appraisal
91
105
  requirement: !ruby/object:Gem::Requirement
@@ -121,9 +135,9 @@ executables: []
121
135
  extensions: []
122
136
  extra_rdoc_files: []
123
137
  files:
138
+ - ".github/workflows/test.yaml"
124
139
  - ".gitignore"
125
140
  - ".rspec"
126
- - ".travis.yml"
127
141
  - Appraisals
128
142
  - Dockerfile
129
143
  - Gemfile
@@ -133,13 +147,6 @@ files:
133
147
  - assets/css/linkpreview.css
134
148
  - bin/console
135
149
  - bin/setup
136
- - gemfiles/.bundle/config
137
- - gemfiles/jekyll_35.gemfile
138
- - gemfiles/jekyll_36.gemfile
139
- - gemfiles/jekyll_37.gemfile
140
- - gemfiles/jekyll_38.gemfile
141
- - gemfiles/jekyll_40.gemfile
142
- - gemfiles/jekyll_41.gemfile
143
150
  - jekyll-linkpreview.gemspec
144
151
  - lib/jekyll-linkpreview.rb
145
152
  - lib/jekyll-linkpreview/version.rb
@@ -162,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
169
  - !ruby/object:Gem::Version
163
170
  version: '0'
164
171
  requirements: []
165
- rubygems_version: 3.0.3
172
+ rubygems_version: 3.3.26
166
173
  signing_key:
167
174
  specification_version: 4
168
175
  summary: Jekyll tag plugin to generate link preview
data/.travis.yml DELETED
@@ -1,22 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.4.2
7
- - 2.7.0
8
- before_install: gem install bundler -v 2.0.1
9
- gemfile:
10
- - gemfiles/jekyll_35.gemfile
11
- - gemfiles/jekyll_36.gemfile
12
- - gemfiles/jekyll_37.gemfile
13
- - gemfiles/jekyll_38.gemfile
14
- - gemfiles/jekyll_40.gemfile
15
- - gemfiles/jekyll_41.gemfile
16
- script: "bundle exec rake test"
17
- matrix:
18
- exclude:
19
- - rvm: 2.4.2
20
- gemfile: gemfiles/jekyll_40.gemfile
21
- - rvm: 2.4.2
22
- gemfile: gemfiles/jekyll_41.gemfile
@@ -1,2 +0,0 @@
1
- ---
2
- BUNDLE_RETRY: "1"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "3.5.2"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "3.6.3"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "3.7.4"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "3.8.7"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "4.0.1"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "4.1.0"
6
-
7
- gemspec path: "../"