cloudcannon-jekyll 2.0.1 → 2.0.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: 53ae411ed9f49f16499909a76dac7d5ed5b2081e5bfe68f689bab9d50579f5f3
4
- data.tar.gz: 8a7706bf17a6f5ccb3b2c7d25d2b13ba32b4e957e2f190cf2cdc889f641cb16e
3
+ metadata.gz: 8ba3dd6e0f966b1e258e25c63e10ca6b38d6b1fa5eef20867e35f4e1d3679584
4
+ data.tar.gz: 6cc8bc3ecc01cabcbce3e9f9691a9acf296a8e703651f1c9e6defd59c9467660
5
5
  SHA512:
6
- metadata.gz: f86f4d41b7ad221de5008fe53d1ff81e0f3d74b2e096d41169db2b311ecbc12d62fe176d285171f2a0a54e4ac33eb3b8a6011296e52c2792b89e11f0fa0d7c56
7
- data.tar.gz: 9b0ff63a9a2753e8195b99c05607c08225f33636898ae31eb082c77ad930c7c6308c4393c019e0a74484eb9acb53c3d12ad50b923da47773e7a6342dc6a32441
6
+ metadata.gz: 0df6f5ab7cef31e3481b85a0485bddebbd088a7211dc5a82bd7487964c5650963ed583feaf8674603c8831fef5f00b5e4376dc6d5377bf05da6c9c0653a0046e
7
+ data.tar.gz: 80ad95aa7b61d49a41f908f834d616b493d027d5f9c2feaf38205db236895a19be9d320c8736f7a8d2ec01909e357d012615d2b09d6f565c5772607ed2c13638
data/HISTORY.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 2.0.2
2
+
3
+ * Add `_enabled_editors` to global scope
4
+ * Increase max jsonify depth
5
+ * Remove unused key swaps
6
+
1
7
  # 2.0.1
2
8
 
3
9
  * Fix potential for null keys in cc_jsonify filter
@@ -17,7 +17,7 @@
17
17
  {% if config.timezone %}
18
18
  "timezone": {{ config.timezone | cc_jsonify }},
19
19
  {% endif %}
20
- "collections-config": {{ collections_config | cc_jsonify: 'collections' }},
20
+ "collections-config": {{ collections_config | cc_jsonify }},
21
21
  "collections": {
22
22
  "drafts": {{ drafts | cc_jsonify }},
23
23
  "posts": {{ site.posts | reverse | cc_jsonify }}{% if site.collections.size > 0 %},{% endif %}
@@ -36,6 +36,9 @@
36
36
  {% if config._comments %}
37
37
  "_comments": {{ config._comments | cc_jsonify }},
38
38
  {% endif %}
39
+ {% if config._enabled_editors %}
40
+ "_enabled_editors": {{ config._enabled_editors | cc_jsonify }},
41
+ {% endif %}
39
42
  {% if config._options %}
40
43
  "_options": {{ config._options | cc_jsonify }},
41
44
  {% endif %}
@@ -63,7 +66,7 @@
63
66
  "layouts": {{ config.layouts_dir | cc_jsonify }}
64
67
  },
65
68
  {% if config._array_structures %}
66
- "_array_structures": {{ config._array_structures | cc_jsonify: nil, 50 }},
69
+ "_array_structures": {{ config._array_structures | cc_jsonify: 50 }},
67
70
  {% endif %}
68
71
  {% assign select_data = config | cc_select_data_jsonify %}
69
72
  {% if select_data %}
@@ -17,7 +17,7 @@
17
17
  {% if config.timezone %}
18
18
  "timezone": {{ config.timezone | cc_jsonify }},
19
19
  {% endif %}
20
- "collections-config": {{ collections_config | cc_jsonify: 'collections' }},
20
+ "collections-config": {{ collections_config | cc_jsonify }},
21
21
  "collections": {
22
22
  "drafts": {{ drafts | cc_jsonify }}{% if site.collections.size > 0 %},{% endif %}
23
23
  {% for collection in site.collections %}"{{ collection.label | xml_escape }}": {{ collection.docs | cc_jsonify }}{% unless forloop.last %},{% endunless %}
@@ -35,6 +35,9 @@
35
35
  {% if config._comments %}
36
36
  "_comments": {{ config._comments | cc_jsonify }},
37
37
  {% endif %}
38
+ {% if config._enabled_editors %}
39
+ "_enabled_editors": {{ config._enabled_editors | cc_jsonify }},
40
+ {% endif %}
38
41
  {% if config._options %}
39
42
  "_options": {{ config._options | cc_jsonify }},
40
43
  {% endif %}
@@ -62,7 +65,7 @@
62
65
  "layouts": {{ config.layouts_dir | cc_jsonify }}
63
66
  },
64
67
  {% if config._array_structures %}
65
- "_array_structures": {{ config._array_structures | cc_jsonify: nil, 50 }},
68
+ "_array_structures": {{ config._array_structures | cc_jsonify: 50 }},
66
69
  {% endif %}
67
70
  {% assign select_data = config | cc_select_data_jsonify %}
68
71
  {% if select_data %}
@@ -17,7 +17,7 @@
17
17
  {% if config.timezone -%}
18
18
  "timezone": {{ config.timezone | cc_jsonify }},
19
19
  {%- endif %}
20
- "collections-config": {{ collections_config | cc_jsonify: 'collections' }},
20
+ "collections-config": {{ collections_config | cc_jsonify }},
21
21
  "collections": {
22
22
  "drafts": {{ drafts | cc_jsonify }}{% if site.collections.size > 0 %},{% endif %}
23
23
  {%- for collection in site.collections -%}
@@ -48,6 +48,9 @@
48
48
  {% if config._comments -%}
49
49
  "_comments": {{ config._comments | cc_jsonify }},
50
50
  {%- endif %}
51
+ {% if config._enabled_editors -%}
52
+ "_enabled_editors": {{ config._enabled_editors | cc_jsonify }},
53
+ {%- endif %}
51
54
  {% if config._options -%}
52
55
  "_options": {{ config._options | cc_jsonify }},
53
56
  {%- endif %}
@@ -75,7 +78,7 @@
75
78
  "layouts": {{ config.layouts_dir | cc_jsonify }}
76
79
  },
77
80
  {% if config._array_structures -%}
78
- "_array_structures": {{ config._array_structures | cc_jsonify: nil, 50 }},
81
+ "_array_structures": {{ config._array_structures | cc_jsonify: 50 }},
79
82
  {%- endif %}
80
83
  {% assign select_data = config | cc_select_data_jsonify -%}
81
84
  {% if select_data -%}
@@ -7,19 +7,6 @@ module CloudCannonJekyll
7
7
  module JsonifyFilter
8
8
  STATIC_EXTENSIONS = [".html", ".htm"].freeze
9
9
 
10
- CC_JSONIFY_KEY_SWAPS = {
11
- "collections" => {
12
- "_sort_key" => "_sort-key",
13
- "_subtext_key" => "_subtext-key",
14
- "_image_key" => "_image-key",
15
- "_image_size" => "_image-size",
16
- "_singular_name" => "_singular-name",
17
- "_singular_key" => "_singular-key",
18
- "_disable_add" => "_disable-add",
19
- "_add_options" => "_add-options",
20
- },
21
- }.freeze
22
-
23
10
  @simple_types = [
24
11
  String,
25
12
  Numeric,
@@ -137,19 +124,19 @@ module CloudCannonJekyll
137
124
  "{#{out.join(",")}}"
138
125
  end
139
126
 
140
- def self.array_to_json(input, depth, max_depth, key_swaps = {})
127
+ def self.array_to_json(input, depth, max_depth)
141
128
  array = input.map do |value|
142
- JsonifyFilter.to_json(value, depth, max_depth, key_swaps)
129
+ JsonifyFilter.to_json(value, depth, max_depth)
143
130
  end
144
131
 
145
132
  "[#{array.join(",")}]"
146
133
  end
147
134
 
148
- def self.hash_to_json(input, depth, max_depth, key_swaps = {})
135
+ def self.hash_to_json(input, depth, max_depth)
149
136
  out = input.map do |key, value|
150
137
  next_max_depth = key == "_array_structures" ? 20 : max_depth
151
- string_key = (key_swaps[key] || key).to_s.to_json
152
- "#{string_key}: #{JsonifyFilter.to_json(value, depth, next_max_depth, key_swaps)}"
138
+ string_key = key.to_s.to_json
139
+ "#{string_key}: #{JsonifyFilter.to_json(value, depth, next_max_depth)}"
153
140
  end
154
141
 
155
142
  "{#{out.join(",")}}"
@@ -163,7 +150,7 @@ module CloudCannonJekyll
163
150
  baseurl show_dir_listing permalink paginate_path timezone quiet verbose defaults
164
151
  liquid kramdown title url description uploads_dir _comments _options _editor
165
152
  _explore _source_editor _array_structures maruku redcloth rdiscount redcarpet
166
- gems plugins cloudcannon _collection_groups)
153
+ gems plugins cloudcannon _collection_groups _enabled_editors)
167
154
 
168
155
  out = input.map do |key, value|
169
156
  next unless value.is_a?(Array) || value.is_a?(Hash)
@@ -178,7 +165,7 @@ module CloudCannonJekyll
178
165
  "{#{out.join(",")}}" if out.any?
179
166
  end
180
167
 
181
- def self.to_json(input, depth, max_depth = 9, key_swaps = {})
168
+ def self.to_json(input, depth, max_depth = 12)
182
169
  depth += 1
183
170
 
184
171
  if depth > max_depth || (depth > 3 && JsonifyFilter.document_type?(input))
@@ -194,9 +181,9 @@ module CloudCannonJekyll
194
181
  elsif input.is_a?(Jekyll::Document)
195
182
  JsonifyFilter.document_to_json(input, depth, max_depth)
196
183
  elsif input.is_a?(Array)
197
- JsonifyFilter.array_to_json(input, depth, max_depth, key_swaps)
184
+ JsonifyFilter.array_to_json(input, depth, max_depth)
198
185
  elsif input.is_a?(Hash)
199
- JsonifyFilter.hash_to_json(input, depth, max_depth, key_swaps)
186
+ JsonifyFilter.hash_to_json(input, depth, max_depth)
200
187
  else
201
188
  input.class.to_s.prepend("UNSUPPORTED:").to_json
202
189
  end
@@ -220,12 +207,8 @@ module CloudCannonJekyll
220
207
  end
221
208
  end
222
209
 
223
- def cc_jsonify(input, key_swaps_key = nil, max_depth = 8)
224
- if CC_JSONIFY_KEY_SWAPS.key? key_swaps_key
225
- JsonifyFilter.to_json(input, 0, max_depth, CC_JSONIFY_KEY_SWAPS[key_swaps_key])
226
- else
227
- JsonifyFilter.to_json(input, 0, max_depth)
228
- end
210
+ def cc_jsonify(input, max_depth = 12)
211
+ JsonifyFilter.to_json(input, 0, max_depth)
229
212
  end
230
213
  end
231
214
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloudCannonJekyll
4
- VERSION = "2.0.1"
4
+ VERSION = "2.0.2"
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: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - CloudCannon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-21 00:00:00.000000000 Z
11
+ date: 2021-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll