jekyll-embed-urls 0.5.15 → 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: ec6bd87ed1305e3c6b813f1a17ae6b1f57293f1e53f70052d4a92285f9d10674
4
- data.tar.gz: a26acd7ccac02577798927a11d04bf7a6676da9d7b9efcf62c72d0400f10c949
3
+ metadata.gz: c799fb3a535b9debbe5e89f5e980924932487511d5bd763654869e30b002a212
4
+ data.tar.gz: fb20c78186c0a51ebbb31b243ded2046826a130a141707d6e84cafcb39df7cb0
5
5
  SHA512:
6
- metadata.gz: a197fb8c7458e8e05610a111389d81552371e536ba56ebe7ab94cabc87ffc6c1ad36dfd8448a096cf541dcfe5cb815644503cb82bc1ce0194f9510da60ee752b
7
- data.tar.gz: 55dbfd919087ebc2cda92a72e8cb51dcbcd5edfb40cd0f0f14bf5fb76460d32a1cc91477b0756075bf325a2515c6a6969389930cd081342fffdb52be225f99c2
6
+ metadata.gz: f9de0be82e9c43c8c3527d93858974d6b1e59dcb0860bf0622143a0b9b7d86ba835cc5c28a0479dfac77cf06541cb221ad0a4825d92438631e5eba16ee5c62cc
7
+ data.tar.gz: 4b3632e48613bf7f07e0dcadbbf404ad35b7a98cc64f728d24c4c34908c21ceb0ba057fc3425d0449deb1d5ec37a7c40af6e7cd00f25e4d0da929bb45d586334
@@ -1,17 +1,11 @@
1
1
  {% if page.url contains "//archive.org/" or page.url contains "//www.archive.org/" %}
2
- <iframe src="{{ page.url | replace: "/details/", "/embed/" | uri_escape }}"></iframe>
2
+ <iframe
3
+ class="w-100"
4
+ allow="{{ embed.allow | join: " " }}"
5
+ sandbox="{{ embed.sandbox | join: " " }}"
6
+ loading="{{ embed.loading }}"
7
+ referrerpolicy="{{ embed.referrerpolicy }}"
8
+ src="{{ page.url | replace: "/details/", "/embed/" | uri_escape }}"></iframe>
3
9
  {% else %}
4
- <article class="fallback" lang="{{ page.locale }}">
5
- {%- if page.image -%}
6
- <img src="{{ page.image | uri_escape }}" class="img-fluid" />
7
- {%- endif -%}
8
-
9
- <h1>{{ page.title | escape_once }}</h1>
10
- <p class="lead">{{ page.description | escape_once }}</p>
11
- <p>
12
- <small>
13
- <a href="{{ page.url | uri_escape }}">{{ page.url }}</a>
14
- </small>
15
- </p>
16
- </article>
10
+ {% include ogp.html type="fallback" %}
17
11
  {% endif %}
data/_includes/ogp.html CHANGED
@@ -1,19 +1,41 @@
1
- <article class="ogp" lang="{{ page.locale }}">
1
+ <article class="{{ include.type | default: "ogp" }} card mb-3" lang="{{ page.locale }}">
2
2
  {%- if page.video -%}
3
- <video poster="{{ page.image | uri_escape }}" class="img-fluid" src="{{ page.video | uri_escape }}"/>
3
+ <video
4
+ {% if embed.controls %}controls{% endif %}
5
+ poster="{{ page.image | uri_escape }}"
6
+ preload="none"
7
+ class="img-fluid"
8
+ src="{{ page.video | uri_escape }}"/>
4
9
  {%- elsif page.image -%}
5
- <img src="{{ page.image | uri_escape }}" class="img-fluid" />
10
+ <img
11
+ src="{{ page.image | uri_escape }}"
12
+ class="img-fluid"
13
+ loading="{{ embed.loading }}"
14
+ referrerpolicy="{{ embed.referrerpolicy }}" />
6
15
  {%- endif -%}
7
16
 
8
17
  {%- if page.audio -%}
9
- <audio class="img-fluid" src="{{ page.audio | uri_escape }}"/>
18
+ <audio
19
+ {% if embed.controls %}controls{% endif %}
20
+ class="w-100"
21
+ src="{{ page.audio | uri_escape }}"/>
10
22
  {%- endif -%}
11
23
 
12
- <h1>{{ page.title | escape_once }}</h1>
13
- <p class="lead">{{ page.description | escape_once }}</p>
14
- <p>
15
- <small>
16
- <a href="{{ page.url | uri_escape }}">{{ page.url }}</a>
17
- </small>
18
- </p>
24
+ <header class="card-body">
25
+ <h1>{{ page.title | escape_once }}</h1>
26
+ {% if page.description %}
27
+ <p class="lead">
28
+ {{- page.description | escape_once -}}
29
+ </p>
30
+ {% endif %}
31
+
32
+ <a
33
+ class="card-link"
34
+ rel="{{ embed.rel | join: " "}}"
35
+ target="{{ embed.target }}"
36
+ referrerpolicy="{{ embed.referrerpolicy }}"
37
+ href="{{ page.url | uri_escape }}">
38
+ {{- page.url -}}
39
+ </a>
40
+ </header>
19
41
  </article>
@@ -14,16 +14,13 @@ module Jekyll
14
14
  # @return [String]
15
15
  def embed(content)
16
16
  Nokogiri::HTML5.fragment(content).tap do |html|
17
- html.css('p > a:first-of-type').each do |a|
18
- next unless a.parent.children.last == a
17
+ html.css('p > a').each do |a|
18
+ next unless a.parent.children.size == 1
19
+ next unless a['href'] == a.text.strip
19
20
 
20
- url = a['href']
21
+ embed = Jekyll::Embed.embed a['href']
21
22
 
22
- next unless url == a.text.strip
23
-
24
- embed = Jekyll::Embed.embed url
25
-
26
- next if url == embed
23
+ next if a['href'] == embed
27
24
 
28
25
  a.parent.replace embed
29
26
  end
data/lib/jekyll/embed.rb CHANGED
@@ -62,8 +62,8 @@ module Jekyll
62
62
  encrypted-media execution-while-not-rendered execution-while-out-of-viewport fullscreen gamepad geolocation gyroscope layout-animations legacy-image-formats magnetometer microphone midi navigation-override oversized-images payment picture-in-picture publickey-credentials-get speaker-selection sync-xhr usb screen-wake-lock web-share xr-spatial-tracking].freeze
63
63
 
64
64
  # Templates
65
- INCLUDE_OGP = '{% include ogp.html site=site page=page %}'
66
- INCLUDE_FALLBACK = '{% include fallback.html site=site page=page %}'
65
+ INCLUDE_OGP = '{% include ogp.html %}'
66
+ INCLUDE_FALLBACK = '{% include fallback.html %}'
67
67
 
68
68
  # The default referrer policy only sends the origin URL (not the
69
69
  # full URL, only the protocol/scheme and domain part) if the remote
@@ -79,7 +79,7 @@ module Jekyll
79
79
  'scrub' => %w[form input textarea button fieldset select option optgroup canvas area map],
80
80
  'attributes' => {
81
81
  'referrerpolicy' => 'strict-origin-when-cross-origin',
82
- 'sandbox' => %w[allow-scripts allow-popups],
82
+ 'sandbox' => %w[allow-scripts allow-popups allow-popups-to-escape-sandbox],
83
83
  'allow' => %w[fullscreen; gyroscope; picture-in-picture; clipboard-write;],
84
84
  'loading' => 'lazy',
85
85
  'controls' => true,
@@ -226,7 +226,7 @@ module Jekyll
226
226
  rescue ArgumentError
227
227
  Jekyll.logger.warn 'Invalid contents (OGP):', url
228
228
  nil
229
- rescue OGP::MalformedSourceError, OGP::MissingAttributeError, Faraday::Error
229
+ rescue LL::ParserError, OGP::MalformedSourceError, OGP::MissingAttributeError, Faraday::Error
230
230
  nil
231
231
  end
232
232
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-embed-urls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.15
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-21 00:00:00.000000000 Z
11
+ date: 2024-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll