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 +4 -4
- data/lib/jekyll/hover_popup/hooks.rb +16 -2
- data/lib/jekyll/hover_popup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb537e34ef0aa3bb1f5396179b65f549533f3c670cd4dffcd581f3b727c355c2
|
|
4
|
+
data.tar.gz: 552f8704d5da719123714a6f9bb22c8921ec38131a16f3c8d5d36bf5fcbbb8fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
|