jekyll-hover-popup 0.3.1 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d904538318970368b8ae375e4e1296000b2e9a88a25ccbfd7273846cbc42d21b
4
- data.tar.gz: e212207697ebb5f6f5a2474078276d242a3b3c6902461473ec9e68f6dac4d818
3
+ metadata.gz: bb537e34ef0aa3bb1f5396179b65f549533f3c670cd4dffcd581f3b727c355c2
4
+ data.tar.gz: 552f8704d5da719123714a6f9bb22c8921ec38131a16f3c8d5d36bf5fcbbb8fb
5
5
  SHA512:
6
- metadata.gz: a1006d757734f03fe07bc223c1feb50ce98e4e557a5f5e4a39cfaba9403865bf1218fb99e332bc7e7cb98bad98e1b084d6dd6ceb5b121ecdcc39c1335ae74e6b
7
- data.tar.gz: 8bf2a9bb8af64ababe2c3af6eed644c5ef16a3f2365da453966d0068270cac9c366109c518caad6aedd1b2cddb32671e05c4862e37e81d4ccdf8fe3759fbd83c
6
+ metadata.gz: 03eb03b79e05fa4b829562d5f11ebbf270e2b6e35fb8f61f0f4f45474fd580556795d4eceee5f8e53f5cf62d4f3e496aae0fd5a13b09d6726e1d0602f158bd43
7
+ data.tar.gz: 02e9f34463fdbaf23c1c3b2c231096d3e09d2853ce6b7aeaa27c780a65dd2cb75977b2cb3431cb95d773f2f73ad1b8deb6bbfa5d4a7bb20248de5f8083fd07c5
@@ -8,8 +8,7 @@ module Jekyll
8
8
  next if cfg["enabled"] == false
9
9
  next unless doc.respond_to?(:output_ext) && doc.output_ext == ".html"
10
10
 
11
- assets_path = cfg["assets_path"] || "/assets/jekyll-hover-popup"
12
- assets_path = "/#{assets_path}" unless assets_path.start_with?("/")
11
+ assets_path = resolve_assets_path(site, cfg)
13
12
  hover_delay_ms = cfg["hover_delay_ms"] || 0
14
13
  nav_hover_preview = cfg.fetch("nav_hover_preview", false)
15
14
 
@@ -21,6 +20,21 @@ module Jekyll
21
20
  end
22
21
  end
23
22
 
23
+ # Site-root path (e.g. "/assets/jekyll-hover-popup"), with site.baseurl prepended.
24
+ def self.resolve_assets_path(site, cfg)
25
+ assets_path = cfg["assets_path"] || "/assets/jekyll-hover-popup"
26
+ assets_path = "/#{assets_path}" unless assets_path.start_with?("/")
27
+
28
+ baseurl = site.config["baseurl"].to_s
29
+ baseurl = "" if baseurl == "/"
30
+ baseurl = baseurl.chomp("/")
31
+
32
+ return assets_path if baseurl.empty?
33
+ return assets_path if assets_path == baseurl || assets_path.start_with?("#{baseurl}/")
34
+
35
+ "#{baseurl}#{assets_path}"
36
+ end
37
+
24
38
  def self.inject_assets(html, assets_path:, hover_delay_ms:, nav_hover_preview: false)
25
39
  return html if html.include?('data-hover-popup-root="true"')
26
40
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module HoverPopup
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-hover-popup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - directsun