cloudcannon-jekyll 1.5.4 → 1.6.1
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/.gitignore +2 -2
- data/HISTORY.md +22 -0
- data/lib/cloudcannon-jekyll/_cloudcannon/details-2.x.json +1 -1
- data/lib/cloudcannon-jekyll/_cloudcannon/details-3.0-4.x.json +1 -1
- data/lib/cloudcannon-jekyll/_cloudcannon/details.json +1 -1
- data/lib/cloudcannon-jekyll/generator.rb +6 -4
- data/lib/cloudcannon-jekyll/jsonify-filter.rb +21 -7
- data/lib/cloudcannon-jekyll/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a266498a3b883dfc9855310c042b181cef8b0949feab77d8918e345e9c72fe68
|
4
|
+
data.tar.gz: d4884d8ca59e5cddb15e395fc9c058667e28c82fbd25b953b8cae4feaace2b82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43d10a91998d62ff91e67935912d752415212cf3c6162731c761af6fcf1a4af967b51a3f711c815a8b8a3c8a5407818fd927ec7cd6444561a3efa6d2171f5bc9
|
7
|
+
data.tar.gz: 23b4eae55f04f524c949856a264818548159567c3b121f892ee86776fe582cf7d9817e646222ea7a68a6ff2fbd88749435b260951d8cd26bb0384997cdcd5de7
|
data/.gitignore
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# 1.6.1
|
2
|
+
|
3
|
+
* Increase max depth for array structures defined outside of global
|
4
|
+
|
5
|
+
# 1.6.0
|
6
|
+
|
7
|
+
* Add `collections_dir` to details collection item paths
|
8
|
+
|
9
|
+
# 1.5.7
|
10
|
+
|
11
|
+
* Fix pages collection clash with built-in pages
|
12
|
+
* Fixed posts collection config data overwriting drafts data
|
13
|
+
|
14
|
+
# 1.5.6
|
15
|
+
|
16
|
+
* Force generator to run after other lowest priority plugins
|
17
|
+
|
18
|
+
# 1.5.5
|
19
|
+
|
20
|
+
* Re-add id field for documents
|
21
|
+
* Fix for potential nil reference
|
22
|
+
|
1
23
|
# 1.5.4
|
2
24
|
|
3
25
|
* Rework fallback for older versions of Jekyll when reading data, posts and drafts again
|
@@ -23,6 +23,6 @@
|
|
23
23
|
{% for collection in site.collections %}"{{ collection[0] | xml_escape }}": {{ collection[1].docs | cc_jsonify }}{% unless forloop.last %},{% endunless %}
|
24
24
|
{% endfor %}
|
25
25
|
},
|
26
|
-
"pages": {{ site.
|
26
|
+
"pages": {{ site.html_pages | cc_jsonify }},
|
27
27
|
"static-pages": {{ site.static_files | cc_static_files_jsonify }}
|
28
28
|
}
|
@@ -22,6 +22,6 @@
|
|
22
22
|
{% for collection in site.collections %}"{{ collection.label | xml_escape }}": {{ collection.docs | cc_jsonify }}{% unless forloop.last %},{% endunless %}
|
23
23
|
{% endfor %}
|
24
24
|
},
|
25
|
-
"pages": {{ site.
|
25
|
+
"pages": {{ site.html_pages | cc_jsonify }},
|
26
26
|
"static-pages": {{ site.static_files | cc_static_files_jsonify }}
|
27
27
|
}
|
@@ -7,13 +7,17 @@ require_relative "reader"
|
|
7
7
|
module CloudCannonJekyll
|
8
8
|
# Generates JSON files containing build config and build output details
|
9
9
|
class Generator < Jekyll::Generator
|
10
|
+
# Override the Jekyll::Plugin spaceship to push our plugin to the very end
|
10
11
|
priority :lowest
|
12
|
+
def self.<=>(*)
|
13
|
+
1
|
14
|
+
end
|
11
15
|
|
12
16
|
def generate(site)
|
13
17
|
@site = site
|
14
18
|
@reader = Reader.new(@site)
|
15
19
|
|
16
|
-
collections_config = @site.config["collections"]
|
20
|
+
collections_config = @site.config["collections"]&.dup || {}
|
17
21
|
|
18
22
|
# Workaround for empty collection configurations
|
19
23
|
collections_config.each_key do |key|
|
@@ -95,9 +99,7 @@ module CloudCannonJekyll
|
|
95
99
|
collections_config["posts"] = { "output" => true } if Jekyll::VERSION.start_with? "2."
|
96
100
|
drafts = @reader.read_drafts(collections_dir)
|
97
101
|
|
98
|
-
if collections_config.key?("posts")
|
99
|
-
collections_config["drafts"] = collections_config["posts"].dup
|
100
|
-
elsif drafts.any?
|
102
|
+
if (collections_config.key?("posts") && !collections_config.key?("drafts")) || drafts.any?
|
101
103
|
collections_config["drafts"] = {}
|
102
104
|
end
|
103
105
|
|
@@ -63,7 +63,8 @@ module CloudCannonJekyll
|
|
63
63
|
next if prevent.include? key
|
64
64
|
|
65
65
|
prevent.push key
|
66
|
-
|
66
|
+
next_max_depth = key == "_array_structures" ? 20 : max_depth
|
67
|
+
"#{key.to_json}: #{JsonifyFilter.to_json(value, depth, next_max_depth)}"
|
67
68
|
end
|
68
69
|
|
69
70
|
out.compact
|
@@ -106,20 +107,32 @@ module CloudCannonJekyll
|
|
106
107
|
"{#{out.join(",")}}"
|
107
108
|
end
|
108
109
|
|
110
|
+
def self.document_path(input)
|
111
|
+
collections_dir = input.site.config["collections_dir"] || ""
|
112
|
+
if input.collection && !collections_dir.empty?
|
113
|
+
"#{collections_dir}/#{input.relative_path}"
|
114
|
+
else
|
115
|
+
input.relative_path
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
109
119
|
def self.document_to_json(input, depth, max_depth)
|
110
|
-
prevent = %w(dir
|
120
|
+
prevent = %w(dir relative_path url collection)
|
111
121
|
|
112
122
|
out = [
|
113
|
-
"\"path\": #{JsonifyFilter.to_json(input
|
123
|
+
"\"path\": #{JsonifyFilter.to_json(JsonifyFilter.document_path(input), depth, max_depth)}",
|
114
124
|
"\"url\": #{JsonifyFilter.to_json(input.url, depth, max_depth)}",
|
115
125
|
]
|
116
126
|
|
117
|
-
|
118
|
-
|
119
|
-
collection_json = JsonifyFilter.to_json(collection.label, depth, max_depth)
|
127
|
+
unless input.collection.nil?
|
128
|
+
collection_json = JsonifyFilter.to_json(input.collection.label, depth, max_depth)
|
120
129
|
out.push("\"collection\": #{collection_json}")
|
121
130
|
end
|
122
131
|
|
132
|
+
if input.respond_to? :id
|
133
|
+
out.push("\"id\": #{JsonifyFilter.to_json(input.id, depth, max_depth)}")
|
134
|
+
end
|
135
|
+
|
123
136
|
out += JsonifyFilter.document_data_to_a(input.data, prevent, depth, max_depth)
|
124
137
|
"{#{out.join(",")}}"
|
125
138
|
end
|
@@ -134,8 +147,9 @@ module CloudCannonJekyll
|
|
134
147
|
|
135
148
|
def self.hash_to_json(input, depth, max_depth, key_swaps = {})
|
136
149
|
out = input.map do |key, value|
|
150
|
+
next_max_depth = key == "_array_structures" ? 20 : max_depth
|
137
151
|
string_key = (key_swaps[key] || key).to_s.to_json
|
138
|
-
"#{string_key}: #{JsonifyFilter.to_json(value, depth,
|
152
|
+
"#{string_key}: #{JsonifyFilter.to_json(value, depth, next_max_depth, key_swaps)}"
|
139
153
|
end
|
140
154
|
|
141
155
|
"{#{out.join(",")}}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudcannon-jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CloudCannon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|