jekyll-embed-urls 0.5.14 → 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: b37dd0e2524605ba192b934e51c69e045cd87f6b98fa77abcc6cb334eccfa9de
4
- data.tar.gz: a279872e004fbd1f211ab1702b1552e3c0b565984f56f20deceb3ca992cb09df
3
+ metadata.gz: c799fb3a535b9debbe5e89f5e980924932487511d5bd763654869e30b002a212
4
+ data.tar.gz: fb20c78186c0a51ebbb31b243ded2046826a130a141707d6e84cafcb39df7cb0
5
5
  SHA512:
6
- metadata.gz: e68304563ce6182e6620fce8513298dc7a5a6878cf069122e002299ee825014d9074a928be4109008a10a2499bb5b7164816b0919c959ec529f2dbddb3023369
7
- data.tar.gz: d8e19c14418c85cd53aa77889aaa6e1acdd0e547d4fdb5943698386d2771f7126134daa94f7a3edc13a972680bab795f55df0c4034885f5f18be168ac3a38d94
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,13 +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 url
21
+ embed = Jekyll::Embed.embed a['href']
22
22
 
23
- next if url == embed
23
+ next if a['href'] == embed
24
24
 
25
25
  a.parent.replace embed
26
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.14
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-04-25 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