jekyll-linkpreview 0.6.0.rc1 → 0.6.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: 8c51945d7da1fdd7145948dffd3f991f1675a1c8dc0f64f3a44d19afc700fd3f
4
- data.tar.gz: e18b2a9aa699e6d6208343790cf7e548fee7942f51cb197f87e8db36077b4394
3
+ metadata.gz: dd45369b38e2a2121de3c5a1b4af6c1096fe0649ad5d3e0c06fbc34ceb17634f
4
+ data.tar.gz: 2bfd854068e9ded58f9eb4dfbc22ac714608d99db457d1af78f0c741858f4b27
5
5
  SHA512:
6
- metadata.gz: b73fa9cdc4ef0ef09906df15b56563f7c048af2c5ade7e78a87d1938f4654022f3073d243a32b4d5d11a62ba50622d9914b26a0cabe14a98156e08285452e8ea
7
- data.tar.gz: 654a1d448bc7c74785beba8c6cfb1e2d6303e7e4db63b341955ee029ec10309334cbc03297b93666b55d804d4a8e9540968041437c8825f656e1f60040f0814e
6
+ metadata.gz: 444a4327a8c79d4a5847d74dba86dbda7dae27226e33c5831dda8f73ae4bb495964a8b8c2e0d1080904e0064c2c65483c95b14e746a38a061f7c8aa8df47371c
7
+ data.tar.gz: 9cd54f69288be12b24e395a6fc71b5ba637cca3f937c014e72dbb3f76defef256bc6c7ca167ba7b782a7f795b74f8469bd0373bfd47da5f73d4446fddef458e2
@@ -15,6 +15,9 @@ jobs:
15
15
  uses: actions/checkout@v3
16
16
  with:
17
17
  fetch-depth: 2
18
+ # See https://github.com/actions/runner-images/issues/6775.
19
+ - name: Suppress 'detected dubious ownership' error.
20
+ run: git config --global --add safe.directory /__w/jekyll-linkpreview/jekyll-linkpreview
18
21
  - id: check-release
19
22
  name: Decide whether to release
20
23
  run: |
@@ -34,6 +37,9 @@ jobs:
34
37
  steps:
35
38
  - name: Checkout
36
39
  uses: actions/checkout@v3
40
+ # See https://github.com/actions/runner-images/issues/6775.
41
+ - name: Suppress 'detected dubious ownership' error.
42
+ run: git config --global --add safe.directory /__w/jekyll-linkpreview/jekyll-linkpreview
37
43
  - env:
38
44
  RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
39
45
  name: Set credentials for RubyGems
@@ -1,5 +1,11 @@
1
1
  name: Test
2
- on: [push]
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - master
6
+ push:
7
+ branches:
8
+ - master
3
9
  jobs:
4
10
  test:
5
11
  container:
@@ -31,6 +37,15 @@ jobs:
31
37
  steps:
32
38
  - name: Checkout
33
39
  uses: actions/checkout@v3
40
+ - if: matrix.ruby == '2.7'
41
+ name: Update RubyGems version
42
+ # sass-embedded 1.57.1, which is one of dependencies of jekyll-sass-converter 3.0,
43
+ # requires rubygems version >= 3.3.22
44
+ # (see https://jekyllrb.com/news/2022/12/21/jekyll-sass-converter-3.0-released/
45
+ # for the jekyll-sass-converter 3.0 release).
46
+ # Just running `gem update --system` upgrades rubygems version to '>= 2.4',
47
+ # which appraisal 2.4.1 can't work with.
48
+ run: gem update --system 3.3.22
34
49
  - name: Install dependencies
35
50
  run: bundle install
36
51
  - name: Install dependencies for each appraisal
data/README.md CHANGED
@@ -56,6 +56,7 @@ You can override the default templates used for generating previews, both in cas
56
56
  2. Use built-in variables to extract data which you would like to render. Available variables are:
57
57
  * **link_url** i.e. `{{ link_url }}`
58
58
  * **link_title** i.e. `{{ link_title }}`
59
+ * **link_type** i.e. `{{ link_type }}`
59
60
  * **link_image** i.e. `{{ link_image }}`
60
61
  * **link_description** i.e. `{{ link_description }}`
61
62
  * **link_domain** i.e. `{{ link_domain }}`
@@ -20,10 +20,12 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "jekyll", ">= 3.5", "< 5.0"
22
22
  spec.add_dependency "metainspector", "~> 5.9"
23
- spec.add_development_dependency "bundler", "~> 2.0"
23
+ # appraisal 2.4.1, which is the latest version as of Jan 2023, doesn't work with bundler >= 2.4.
24
+ # See https://github.com/thoughtbot/appraisal/issues/199 for details.
25
+ spec.add_development_dependency "bundler", ">= 2.0", "< 2.4"
24
26
  spec.add_development_dependency "rake", "~> 12.3.3"
25
27
  spec.add_development_dependency "rspec", "~> 3.0"
26
28
  spec.add_development_dependency "rspec-parameterized", "~> 0.5.2"
27
- spec.add_development_dependency "appraisal", "~> 2.2.0"
29
+ spec.add_development_dependency "appraisal", "~> 2.0"
28
30
  spec.add_development_dependency "wwtd", "~> 1.4.1"
29
31
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Linkpreview
3
- VERSION = "0.6.0.rc1"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
@@ -10,8 +10,9 @@ module Jekyll
10
10
  class OpenGraphProperties
11
11
  @@template_file = 'linkpreview.html'
12
12
 
13
- def initialize(title, url, image, description, domain)
13
+ def initialize(title, type, url, image, description, domain)
14
14
  @title = title
15
+ @type = type
15
16
  @url = url
16
17
  @image = image
17
18
  @description = description
@@ -21,6 +22,7 @@ module Jekyll
21
22
  def to_hash()
22
23
  {
23
24
  'title' => @title,
25
+ 'type' => @type,
24
26
  'url' => @url,
25
27
  'image' => @image,
26
28
  'description' => @description,
@@ -31,6 +33,7 @@ module Jekyll
31
33
  def to_hash_for_custom_template()
32
34
  {
33
35
  'link_title' => @title,
36
+ 'link_type' => @type,
34
37
  'link_url' => @url,
35
38
  'link_image' => @image,
36
39
  'link_description' => @description,
@@ -48,16 +51,17 @@ module Jekyll
48
51
  og_properties = page.meta_tags['property']
49
52
  image_url = get_og_property(og_properties, 'og:image')
50
53
  title = get_og_property(og_properties, 'og:title')
54
+ type = get_og_property(og_properties, 'og:type')
51
55
  url = get_og_property(og_properties, 'og:url')
52
56
  image = convert_to_absolute_url(image_url, page.root_url)
53
57
  description = get_og_property(og_properties, 'og:description')
54
58
  domain = page.host
55
- OpenGraphProperties.new(title, url, image, description, domain)
59
+ OpenGraphProperties.new(title, type, url, image, description, domain)
56
60
  end
57
61
 
58
62
  def from_hash(hash)
59
63
  OpenGraphProperties.new(
60
- hash['title'], hash['url'], hash['image'], hash['description'], hash['domain'])
64
+ hash['title'], hash['type'], hash['url'], hash['image'], hash['description'], hash['domain'])
61
65
  end
62
66
 
63
67
  private
@@ -116,8 +120,7 @@ module Jekyll
116
120
 
117
121
  class NonOpenGraphPropertiesFactory
118
122
  def from_page(page)
119
- NonOpenGraphProperties.new(
120
- page.title, page.url, get_description(page), page.host)
123
+ NonOpenGraphProperties.new(page.best_title, page.url, get_description(page), page.host)
121
124
  end
122
125
 
123
126
  def from_hash(hash)
@@ -189,7 +192,9 @@ module Jekyll
189
192
 
190
193
  private
191
194
  def create_properties_from_page(page)
192
- if page.meta_tags['property'].empty? then
195
+ if !%w[og:title og:type og:url og:image].all? { |required_tag|
196
+ page.meta_tags['property'].include?(required_tag)
197
+ }
193
198
  factory = NonOpenGraphPropertiesFactory.new
194
199
  else
195
200
  factory = OpenGraphPropertiesFactory.new
@@ -239,16 +244,15 @@ module Jekyll
239
244
  image_html = ""
240
245
  if image then
241
246
  image_html = <<-EOS
242
- <div class="jekyll-linkpreview-image">
243
- <a href="#{url}" target="_blank">
244
- <img src="#{image}" />
245
- </a>
246
- </div>
247
+ <div class="jekyll-linkpreview-image">
248
+ <a href="#{url}" target="_blank">
249
+ <img src="#{image}" />
250
+ </a>
251
+ </div>
247
252
  EOS
248
253
  end
249
254
  html = <<-EOS
250
255
  <div class="jekyll-linkpreview-wrapper">
251
- <p><a href="#{url}" target="_blank">#{url}</a></p>
252
256
  <div class="jekyll-linkpreview-wrapper-inner">
253
257
  <div class="jekyll-linkpreview-content">
254
258
  #{image_html}
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.6.0.rc1
4
+ version: 0.6.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: 2022-12-09 00:00:00.000000000 Z
11
+ date: 2023-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -48,16 +48,22 @@ dependencies:
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '2.0'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '2.4'
54
57
  type: :development
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
57
60
  requirements:
58
- - - "~>"
61
+ - - ">="
59
62
  - !ruby/object:Gem::Version
60
63
  version: '2.0'
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.4'
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: rake
63
69
  requirement: !ruby/object:Gem::Requirement
@@ -106,14 +112,14 @@ dependencies:
106
112
  requirements:
107
113
  - - "~>"
108
114
  - !ruby/object:Gem::Version
109
- version: 2.2.0
115
+ version: '2.0'
110
116
  type: :development
111
117
  prerelease: false
112
118
  version_requirements: !ruby/object:Gem::Requirement
113
119
  requirements:
114
120
  - - "~>"
115
121
  - !ruby/object:Gem::Version
116
- version: 2.2.0
122
+ version: '2.0'
117
123
  - !ruby/object:Gem::Dependency
118
124
  name: wwtd
119
125
  requirement: !ruby/object:Gem::Requirement
@@ -166,9 +172,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
172
  version: '0'
167
173
  required_rubygems_version: !ruby/object:Gem::Requirement
168
174
  requirements:
169
- - - ">"
175
+ - - ">="
170
176
  - !ruby/object:Gem::Version
171
- version: 1.3.1
177
+ version: '0'
172
178
  requirements: []
173
179
  rubygems_version: 3.3.26
174
180
  signing_key: