cloudcannon-jekyll 0.3.4 → 0.4.0
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 +7 -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 +5 -3
- data/lib/cloudcannon-jekyll/jsonify-filter.rb +12 -4
- 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: 8fb6d69020a149aa142d3e07d56e684c228a66f6b85af4f90ea3b2ec781960a7
|
4
|
+
data.tar.gz: 8ab26b830892091e808583431104d5196b606aae6e5f03eb65a85025a4dc93ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9569e09b712f5ce8902da2b09ec22ceb7472690a497a03a22187801dc4574425722b5370b49177c4313d466dac8edb57a7624f1e7ca8d5273fc48aee9cd37261
|
7
|
+
data.tar.gz: 59cd301082e6169baf3a96df82f0fe7cfc9857475dbc50925e64ad6e5d4ca93aef28961e1bef0766946cf3e1db4cb71c1fee35dc6bcca5de4240498b56736a1f
|
data/.gitignore
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 0.4.0
|
2
|
+
|
3
|
+
* Add `collections_dir` to details collection item paths
|
4
|
+
* Fix pages collection clash with built-in pages
|
5
|
+
* Fixed posts collection config data overwriting drafts data
|
6
|
+
* Force generator to run after other lowest priority plugins
|
7
|
+
|
1
8
|
# 0.3.4
|
2
9
|
|
3
10
|
* Re-add id field for documents
|
@@ -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,7 +7,11 @@ 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
|
@@ -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
|
|
@@ -107,17 +107,25 @@ module CloudCannonJekyll
|
|
107
107
|
"{#{out.join(",")}}"
|
108
108
|
end
|
109
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
|
+
|
110
119
|
def self.document_to_json(input, depth, max_depth)
|
111
120
|
prevent = %w(dir relative_path url collection)
|
112
121
|
|
113
122
|
out = [
|
114
|
-
"\"path\": #{JsonifyFilter.to_json(input
|
123
|
+
"\"path\": #{JsonifyFilter.to_json(JsonifyFilter.document_path(input), depth, max_depth)}",
|
115
124
|
"\"url\": #{JsonifyFilter.to_json(input.url, depth, max_depth)}",
|
116
125
|
]
|
117
126
|
|
118
|
-
|
119
|
-
|
120
|
-
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)
|
121
129
|
out.push("\"collection\": #{collection_json}")
|
122
130
|
end
|
123
131
|
|
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: 0.
|
4
|
+
version: 0.4.0
|
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-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|