jekyll-bookshop 2.6.1 → 3.0.0.pre.beta.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10d3c10fd8d62669f5590934ad3bc7dc6d94d3d652fda6f833dbd3c9ab2b4e01
|
4
|
+
data.tar.gz: 324be137b13530152aca2b61185b3d36eb66183d9db3eefe3b86437788604932
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1c0047a975986839561a2450139abca77ec2f8a13983f23d59144579bf2cdab1aed8a3cf7fe942399b3f63ddd1e4b51c7729f2dca2857b4594a3c2cc40a847e
|
7
|
+
data.tar.gz: 2ef4673878fcb593b077644cd10461ec0698b6a659eb8ebd2fa56ad95063d4b8cf812a58730abbc53b1a6c4f5526e33dad479bd64c81d0f5cb5d738a091b4d5b
|
@@ -37,12 +37,17 @@ module JekyllBookshop
|
|
37
37
|
loop_context = "#{name}[#{index}]"
|
38
38
|
end
|
39
39
|
|
40
|
+
# If this component is not a subcomponent,
|
41
|
+
# we also drop in some site metadata here so that it can be used in the render.
|
42
|
+
meta_comment = context["__bookshop__nested"] ? "" : "<!--bookshop-live meta(version=\"#{JekyllBookshop::VERSION.gsub(".pre.", "-")}\" baseurl=\"#{site.baseurl}\" title=\"#{site.config["title"]&.gsub('"', '\"') || ""}\") -->\n"
|
43
|
+
|
40
44
|
context.stack do
|
41
45
|
context["include"] = parse_params(context) if @params
|
46
|
+
context["__bookshop__nested"] = true
|
42
47
|
begin
|
43
|
-
"<!--bookshop-live name(#{file}) params(#{@params}) context(#{loop_context.gsub(/-/, '=').gsub(/=include\./, '=')}) -->
|
44
|
-
|
45
|
-
|
48
|
+
"#{meta_comment}<!--bookshop-live name(#{file}) params(#{@params}) context(#{loop_context.gsub(/-/, '=').gsub(/=include\./, '=')}) -->
|
49
|
+
#{partial.render!(context)}
|
50
|
+
<!--bookshop-live end-->"
|
46
51
|
rescue Liquid::Error => e
|
47
52
|
e.template_name = path
|
48
53
|
e.markup_context = "included " if e.markup_context.nil?
|
@@ -30,17 +30,11 @@ module JekyllBookshop
|
|
30
30
|
site = context.registers[:site]
|
31
31
|
page = context.registers[:page]
|
32
32
|
|
33
|
-
site.data["_bookshop_data_pages"] ||= []
|
34
|
-
unless site.data["_bookshop_data_pages"].include?(page["url"])
|
35
|
-
site.data["_bookshop_data_pages"].push(page["url"])
|
36
|
-
end
|
37
|
-
|
38
33
|
"<div data-bookshop-browser></div>
|
39
|
-
<script>window.bookshop_browser_site_data = null;</script>
|
40
34
|
<script src=\"#{host}\"></script>
|
41
35
|
<script>
|
42
36
|
window.bookshopBrowser = new window.BookshopBrowser({
|
43
|
-
globals: [
|
37
|
+
globals: []
|
44
38
|
});
|
45
39
|
window.bookshopBrowser.render();
|
46
40
|
</script>"
|
data/lib/jekyll-bookshop.rb
CHANGED
@@ -10,7 +10,6 @@ require_relative "jekyll-bookshop/tags/bookshop-tag"
|
|
10
10
|
require_relative "jekyll-bookshop/tags/browser-tag"
|
11
11
|
require_relative "jekyll-bookshop/tags/style-tag"
|
12
12
|
require_relative "jekyll-bookshop/opener"
|
13
|
-
require_relative "jekyll-bookshop/site-data"
|
14
13
|
|
15
14
|
Liquid::Template.register_tag("bookshop", JekyllBookshop::Tag)
|
16
15
|
Liquid::Template.register_tag("bookshop_include", JekyllBookshop::IncludeTag)
|
@@ -20,7 +19,3 @@ Liquid::Template.register_tag("bookshop_browser", JekyllBookshop::BrowserTag)
|
|
20
19
|
Jekyll::Hooks.register :site, :after_init do |site|
|
21
20
|
JekyllBookshop::Opener.open_bookshop(site)
|
22
21
|
end
|
23
|
-
|
24
|
-
Jekyll::Hooks.register :site, :post_render do |site|
|
25
|
-
JekyllBookshop::SiteData.extract(site)
|
26
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-bookshop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.pre.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CloudCannon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -87,7 +87,6 @@ extra_rdoc_files: []
|
|
87
87
|
files:
|
88
88
|
- lib/jekyll-bookshop.rb
|
89
89
|
- lib/jekyll-bookshop/opener.rb
|
90
|
-
- lib/jekyll-bookshop/site-data.rb
|
91
90
|
- lib/jekyll-bookshop/tags/bookshop-common-tag.rb
|
92
91
|
- lib/jekyll-bookshop/tags/bookshop-include-tag.rb
|
93
92
|
- lib/jekyll-bookshop/tags/bookshop-tag.rb
|
@@ -109,9 +108,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
108
|
version: '0'
|
110
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
110
|
requirements:
|
112
|
-
- - "
|
111
|
+
- - ">"
|
113
112
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
113
|
+
version: 1.3.1
|
115
114
|
requirements: []
|
116
115
|
rubygems_version: 3.0.3
|
117
116
|
signing_key:
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JekyllBookshop
|
4
|
-
class SiteData
|
5
|
-
def self.extract(site)
|
6
|
-
@site = site
|
7
|
-
|
8
|
-
payload = {}
|
9
|
-
@site.collections.each_pair do |collection, items|
|
10
|
-
payload[collection] = items.docs.map do |doc|
|
11
|
-
doc.data.merge(hydrate_document_fields(doc))
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
payload["data"] = {}
|
16
|
-
@site.data.each_pair do |key, value|
|
17
|
-
next if key.to_s.start_with?("_bookshop")
|
18
|
-
|
19
|
-
payload["data"][key] = value
|
20
|
-
end
|
21
|
-
|
22
|
-
payload["baseurl"] = @site.baseurl
|
23
|
-
payload["title"] = @site.config["title"]
|
24
|
-
|
25
|
-
@site.data["_bookshop_site_data"] = { "site" => payload }
|
26
|
-
|
27
|
-
update_browser_pages
|
28
|
-
|
29
|
-
Jekyll.logger.info "Bookshop:",
|
30
|
-
"Bookshop site data generated"
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.hydrate_document_fields(document)
|
34
|
-
keys = %w(content url date relative_path permalink)
|
35
|
-
hydrated_doc = {}
|
36
|
-
keys.each { |key| hydrated_doc[key] = document.send(key) }
|
37
|
-
hydrate_document_excerpt(document, hydrated_doc)
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.hydrate_document_excerpt(document, hydrated_doc)
|
41
|
-
hydrated_doc.merge!({
|
42
|
-
"excerpt" => document.data["excerpt"].output,
|
43
|
-
})
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.update_browser_pages
|
47
|
-
@site.pages.each do |page|
|
48
|
-
next unless @site.data["_bookshop_data_pages"]&.include?(page.url)
|
49
|
-
|
50
|
-
page.output = page.output.gsub(
|
51
|
-
%r!bookshop_browser_site_data = null!,
|
52
|
-
"bookshop_browser_site_data = #{@site.data["_bookshop_site_data"].to_json.gsub(%r!</script!i, "<\\/script")}"
|
53
|
-
)
|
54
|
-
end
|
55
|
-
@site.data["_bookshop_data_pages"] = nil
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|