cloudcannon-jekyll 0.3.4 → 0.4.0

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: 29ba7626e36d9eda34cdc67fe54a1961c7fc8ea6af3b61d2bfe8e9f7074483c8
4
- data.tar.gz: 82ea5cfc99366153d6464125652c200ccf0971fca780cf9d5cfbbe5bb70fd9c2
3
+ metadata.gz: 8fb6d69020a149aa142d3e07d56e684c228a66f6b85af4f90ea3b2ec781960a7
4
+ data.tar.gz: 8ab26b830892091e808583431104d5196b606aae6e5f03eb65a85025a4dc93ae
5
5
  SHA512:
6
- metadata.gz: 958d22f6c30642a9ef324aba1938768a8b7337b948f33780f2545a310c12e9535328a52367fa888d267a18b6572d07ef1d7387fdab9956211830c448946b52c2
7
- data.tar.gz: 6c2dee57baf7d6fac11898094e3292c89559ac4d5077b898efdc65c1901df351101d37ef240de02eebd2db2dc2adfc9bd288ca232d7f9b3bd4f9ba8aeb36b177
6
+ metadata.gz: 9569e09b712f5ce8902da2b09ec22ceb7472690a497a03a22187801dc4574425722b5370b49177c4313d466dac8edb57a7624f1e7ca8d5273fc48aee9cd37261
7
+ data.tar.gz: 59cd301082e6169baf3a96df82f0fe7cfc9857475dbc50925e64ad6e5d4ca93aef28961e1bef0766946cf3e1db4cb71c1fee35dc6bcca5de4240498b56736a1f
data/.gitignore CHANGED
@@ -1,7 +1,7 @@
1
1
  Gemfile.lock
2
2
  spec/dest/
3
- spec/fixtures/.jekyll-cache/
4
- spec/fixtures/.jekyll-metadata
3
+ spec/fixtures/**/.jekyll-cache/
4
+ spec/fixtures/**/.jekyll-metadata
5
5
  spec/fixtures/_site/
6
6
  gemfiles/.bundle/
7
7
  gemfiles/*.gemfile.lock
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.pages | cc_jsonify }},
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.pages | cc_jsonify }},
25
+ "pages": {{ site.html_pages | cc_jsonify }},
26
26
  "static-pages": {{ site.static_files | cc_static_files_jsonify }}
27
27
  }
@@ -36,6 +36,6 @@
36
36
  {%- unless forloop.last %},{% endunless %}
37
37
  {%- endfor -%}
38
38
  },
39
- "pages": {{ site.pages | cc_jsonify }},
39
+ "pages": {{ site.html_pages | cc_jsonify }},
40
40
  "static-pages": {{ site.static_files | cc_static_files_jsonify }}
41
41
  }
@@ -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.relative_path, depth, max_depth)}",
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
- collection = input.collection
119
- unless collection.nil?
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloudCannonJekyll
4
- VERSION = "0.3.4"
4
+ VERSION = "0.4.0"
5
5
  end
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.3.4
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: 2020-12-16 00:00:00.000000000 Z
11
+ date: 2021-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll