cloudcannon-jekyll 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/HISTORY.md +4 -0
- data/cloudcannon-jekyll.gemspec +1 -0
- data/lib/cloudcannon-jekyll/_cloudcannon/config-2.x.json +43 -0
- data/lib/cloudcannon-jekyll/_cloudcannon/config-3.0-4.x.json +43 -0
- data/lib/cloudcannon-jekyll/_cloudcannon/config.json +61 -0
- data/lib/cloudcannon-jekyll/_cloudcannon/{details-3.0.x.json → details-3.0-4.x.json} +0 -0
- data/lib/cloudcannon-jekyll/generator.rb +32 -16
- data/lib/cloudcannon-jekyll/safe-jsonify-filter.rb +48 -8
- data/lib/cloudcannon-jekyll/version.rb +1 -1
- metadata +24 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e230ce5d0532e009909dda54ffd7c0c5b25f0813d812e82c451f7e40e92419f
|
4
|
+
data.tar.gz: ecc06259f731e6bc706823f5b7127bf8e7df0fbc8e126a4354cdfe186abceedf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ddbd00faaa307f6564b5c12ea06885b39bb4808154c6a28b0ef157fe88bff85e4965d43655b32b151c96b410c7c0af64ac9167fe5ec6469ea663fcd9432a860
|
7
|
+
data.tar.gz: 3d283321203ee14bc9df0ad6d7243410e2c709086153f467642fa5c85eb8585ab547d449a9e310d3833137c471f034646b3325d503ff7532659621b4e8e4d8bd
|
data/.gitignore
CHANGED
data/HISTORY.md
CHANGED
data/cloudcannon-jekyll.gemspec
CHANGED
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "rspec", "~> 3.9"
|
28
28
|
spec.add_development_dependency "rubocop", "~> 0.80"
|
29
29
|
spec.add_development_dependency "rubocop-jekyll", "~> 0.11"
|
30
|
+
spec.add_development_dependency "json_schemer", "~> 0.2.13"
|
30
31
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
{% if site.timezone %}"timezone": {{ site.timezone | jsonify }},{% endif %}
|
3
|
+
"include": {{ site.include | jsonify }},
|
4
|
+
"exclude": {{ site.exclude | jsonify }},
|
5
|
+
{% if site.baseurl %}"base-url": {{ site.baseurl | jsonify }},{% endif %}
|
6
|
+
"collections": {
|
7
|
+
{% for collection in site.collections %}
|
8
|
+
"{{ collection[0] | xml_escape }}": {
|
9
|
+
"output": {{ collection[1].output | jsonify }},
|
10
|
+
"_sort-key": {{ collection[1]._sort_key | jsonify }},
|
11
|
+
"_subtext-key": {{ collection[1]._subtext_key | jsonify }},
|
12
|
+
"_image-key": {{ collection[1]._image_key | jsonify }},
|
13
|
+
"_image-size": {{ collection[1]._image_size | jsonify }},
|
14
|
+
"_singular-name": {{ collection[1]._singular_name | jsonify }},
|
15
|
+
"_singular-key": {{ collection[1]._singular_key | jsonify }},
|
16
|
+
"_disable-add": {{ collection[1]._disable_add | jsonify }},
|
17
|
+
"_icon": {{ collection[1]._icon | jsonify }},
|
18
|
+
"_add-options": {{ collection[1]._add_options | cc_safe_jsonify }}
|
19
|
+
}{% unless forloop.last %},{% endunless %}
|
20
|
+
{% endfor %}
|
21
|
+
},
|
22
|
+
{% if site._comments %}"comments": {{ site._comments | cc_safe_jsonify }},{% endif %}
|
23
|
+
{% if site._editor %}"editor": {
|
24
|
+
"default-path": {{ site._editor.default_path | jsonify }}
|
25
|
+
},{% endif %}
|
26
|
+
{% if site._source_editor %}"source-editor": {
|
27
|
+
"tab-size": {{ site._source_editor.tab_size | jsonify }},
|
28
|
+
"show-gutter": {{ site._source_editor.show_gutter | jsonify }},
|
29
|
+
"theme": {{ site._source_editor.theme | jsonify }}
|
30
|
+
},{% endif %}
|
31
|
+
{% if site._explore %}"explore": {{ site._explore | cc_safe_jsonify }},{% endif %}
|
32
|
+
"paths": {
|
33
|
+
"uploads": {{ site.uploads_dir | jsonify }},
|
34
|
+
"plugins": {{ site.plugins_dir | jsonify }},
|
35
|
+
"data": {{ site.data_dir | jsonify }},
|
36
|
+
"collections": {{ site.collections_dir | jsonify }},
|
37
|
+
"includes": {{ site.includes_dir | jsonify }},
|
38
|
+
"layouts": {{ site.layouts_dir | jsonify }}
|
39
|
+
},
|
40
|
+
{% if site._array_structures %}"array-structures": {{ site._array_structures | cc_safe_jsonify }},{% endif %}
|
41
|
+
{% assign select_data = site | cc_site_select_data_jsonify %}{% if select_data %}"select-data": {{ select_data }},{% endif %}
|
42
|
+
"source": {{ site.source | jsonify }}
|
43
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
{% if site.timezone %}"timezone": {{ site.timezone | jsonify }},{% endif %}
|
3
|
+
"include": {{ site.include | jsonify }},
|
4
|
+
"exclude": {{ site.exclude | jsonify }},
|
5
|
+
{% if site.baseurl %}"base-url": {{ site.baseurl | jsonify }},{% endif %}
|
6
|
+
"collections": {
|
7
|
+
{% for collection in site.collections %}
|
8
|
+
"{{ collection.label | xml_escape }}": {
|
9
|
+
"output": {{ collection.output | jsonify }},
|
10
|
+
"_sort-key": {{ collection._sort_key | jsonify }},
|
11
|
+
"_subtext-key": {{ collection._subtext_key | jsonify }},
|
12
|
+
"_image-key": {{ collection._image_key | jsonify }},
|
13
|
+
"_image-size": {{ collection._image_size | jsonify }},
|
14
|
+
"_singular-name": {{ collection._singular_name | jsonify }},
|
15
|
+
"_singular-key": {{ collection._singular_key | jsonify }},
|
16
|
+
"_disable-add": {{ collection._disable_add | jsonify }},
|
17
|
+
"_icon": {{ collection._icon | jsonify }},
|
18
|
+
"_add-options": {{ collection._add_options | cc_safe_jsonify }}
|
19
|
+
}{% unless forloop.last %},{% endunless %}
|
20
|
+
{% endfor %}
|
21
|
+
},
|
22
|
+
{% if site._comments %}"comments": {{ site._comments | cc_safe_jsonify }},{% endif %}
|
23
|
+
{% if site._editor %}"editor": {
|
24
|
+
"default-path": {{ site._editor.default_path | jsonify }}
|
25
|
+
},{% endif %}
|
26
|
+
{% if site._source_editor %}"source-editor": {
|
27
|
+
"tab-size": {{ site._source_editor.tab_size | jsonify }},
|
28
|
+
"show-gutter": {{ site._source_editor.show_gutter | jsonify }},
|
29
|
+
"theme": {{ site._source_editor.theme | jsonify }}
|
30
|
+
},{% endif %}
|
31
|
+
{% if site._explore %}"explore": {{ site._explore | cc_safe_jsonify }},{% endif %}
|
32
|
+
"paths": {
|
33
|
+
"uploads": {{ site.uploads_dir | jsonify }},
|
34
|
+
"plugins": {{ site.plugins_dir | jsonify }},
|
35
|
+
"data": {{ site.data_dir | jsonify }},
|
36
|
+
"collections": {{ site.collections_dir | jsonify }},
|
37
|
+
"includes": {{ site.includes_dir | jsonify }},
|
38
|
+
"layouts": {{ site.layouts_dir | jsonify }}
|
39
|
+
},
|
40
|
+
{% if site._array_structures %}"array-structures": {{ site._array_structures | cc_safe_jsonify }},{% endif %}
|
41
|
+
{% assign select_data = site | cc_site_select_data_jsonify %}{% if select_data %}"select-data": {{ select_data }},{% endif %}
|
42
|
+
"source": {{ site.source | jsonify }}
|
43
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
{
|
2
|
+
{% if site.timezone -%}
|
3
|
+
"timezone": {{ site.timezone | jsonify }},
|
4
|
+
{%- endif %}
|
5
|
+
"include": {{ site.include | jsonify }},
|
6
|
+
"exclude": {{ site.exclude | jsonify }},
|
7
|
+
{% if site.baseurl -%}
|
8
|
+
"base-url": {{ site.baseurl | jsonify }},
|
9
|
+
{%- endif %}
|
10
|
+
"collections": {
|
11
|
+
{%- for collection in site.collections -%}
|
12
|
+
"{{ collection.label | xml_escape }}": {
|
13
|
+
"output": {{ collection.output | jsonify }},
|
14
|
+
"_sort-key": {{ collection._sort_key | jsonify }},
|
15
|
+
"_subtext-key": {{ collection._subtext_key | jsonify }},
|
16
|
+
"_image-key": {{ collection._image_key | jsonify }},
|
17
|
+
"_image-size": {{ collection._image_size | jsonify }},
|
18
|
+
"_singular-name": {{ collection._singular_name | jsonify }},
|
19
|
+
"_singular-key": {{ collection._singular_key | jsonify }},
|
20
|
+
"_disable-add": {{ collection._disable_add | jsonify }},
|
21
|
+
"_icon": {{ collection._icon | jsonify }},
|
22
|
+
"_add-options": {{ collection._add_options | cc_safe_jsonify }}
|
23
|
+
}
|
24
|
+
{%- unless forloop.last %},{% endunless %}
|
25
|
+
{%- endfor -%}
|
26
|
+
},
|
27
|
+
{% if site._comments -%}
|
28
|
+
"comments": {{ site._comments | cc_safe_jsonify }},
|
29
|
+
{%- endif %}
|
30
|
+
{% if site._editor -%}
|
31
|
+
"editor": {
|
32
|
+
"default-path": {{ site._editor.default_path | jsonify }}
|
33
|
+
},
|
34
|
+
{%- endif %}
|
35
|
+
{% if site._source_editor -%}
|
36
|
+
"source-editor": {
|
37
|
+
"tab-size": {{ site._source_editor.tab_size | jsonify }},
|
38
|
+
"show-gutter": {{ site._source_editor.show_gutter | jsonify }},
|
39
|
+
"theme": {{ site._source_editor.theme | jsonify }}
|
40
|
+
},
|
41
|
+
{%- endif %}
|
42
|
+
{% if site._explore -%}
|
43
|
+
"explore": {{ site._explore | cc_safe_jsonify }},
|
44
|
+
{%- endif %}
|
45
|
+
"paths": {
|
46
|
+
"uploads": {{ site.uploads_dir | jsonify }},
|
47
|
+
"plugins": {{ site.plugins_dir | jsonify }},
|
48
|
+
"data": {{ site.data_dir | jsonify }},
|
49
|
+
"collections": {{ site.collections_dir | jsonify }},
|
50
|
+
"includes": {{ site.includes_dir | jsonify }},
|
51
|
+
"layouts": {{ site.layouts_dir | jsonify }}
|
52
|
+
},
|
53
|
+
{% if site._array_structures -%}
|
54
|
+
"array-structures": {{ site._array_structures | cc_safe_jsonify }},
|
55
|
+
{%- endif %}
|
56
|
+
{% assign select_data = site | cc_site_select_data_jsonify -%}
|
57
|
+
{% if select_data -%}
|
58
|
+
"select-data": {{ select_data }},
|
59
|
+
{%- endif %}
|
60
|
+
"source": {{ site.source | jsonify }}
|
61
|
+
}
|
File without changes
|
@@ -9,33 +9,49 @@ module CloudCannonJekyll
|
|
9
9
|
|
10
10
|
def generate(site)
|
11
11
|
@site = site
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
details_data = { "gem_version" => CloudCannonJekyll::VERSION }
|
14
|
+
|
15
|
+
generate_file("details", @site.site_payload.merge(details_data))
|
16
|
+
generate_file("config", @site.site_payload)
|
17
|
+
|
14
18
|
@site.keep_files ||= []
|
15
|
-
@site.keep_files << "
|
19
|
+
@site.keep_files << path("details")
|
20
|
+
@site.keep_files << path("config")
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_file(filename, data)
|
24
|
+
dest = destination_path(filename)
|
25
|
+
FileUtils.mkdir_p(File.dirname(dest))
|
26
|
+
File.open(dest, "w") { |f| f.write(file_content(filename, data)) }
|
16
27
|
end
|
17
28
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
21
|
-
path = "_cloudcannon/details-3.0.x.json" if Jekyll::VERSION.match? %r!3\.[0-4]\.!
|
29
|
+
def version_path_suffix
|
30
|
+
return "-2.x" if Jekyll::VERSION.start_with? "2."
|
31
|
+
return "-3.0-4.x" if Jekyll::VERSION.match? %r!3\.[0-4]\.!
|
22
32
|
|
23
|
-
|
33
|
+
""
|
24
34
|
end
|
25
35
|
|
26
|
-
def
|
27
|
-
|
36
|
+
def path(filename, suffix = "")
|
37
|
+
"_cloudcannon/#{filename}#{suffix}.json"
|
28
38
|
end
|
29
39
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
40
|
+
def source_path(filename)
|
41
|
+
File.expand_path(path(filename, version_path_suffix), File.dirname(__FILE__))
|
42
|
+
end
|
43
|
+
|
44
|
+
def destination_path(filename)
|
45
|
+
Jekyll.sanitized_path(@site.dest, path(filename))
|
46
|
+
end
|
33
47
|
|
48
|
+
def file_content(filename, data)
|
49
|
+
json = PageWithoutAFile.new(@site, File.dirname(__FILE__), "", path(filename))
|
50
|
+
json.content = File.read(source_path(filename))
|
34
51
|
json.data["layout"] = nil
|
35
52
|
json.data["sitemap"] = false
|
36
|
-
json.data["permalink"] = "
|
37
|
-
|
38
|
-
json.render({}, @site.site_payload.merge("gem_version" => CloudCannonJekyll::VERSION))
|
53
|
+
json.data["permalink"] = "/#{path(filename)}"
|
54
|
+
json.render({}, data)
|
39
55
|
json.output
|
40
56
|
end
|
41
57
|
end
|
@@ -45,12 +45,11 @@ module CloudCannonJekyll
|
|
45
45
|
def self.document_data_to_json(data, out, prevent, depth)
|
46
46
|
prevent += %w(content output next previous excerpt)
|
47
47
|
|
48
|
-
data.
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
48
|
+
data.each { |key, value|
|
49
|
+
next if prevent.include? key
|
50
|
+
prevent.push key
|
51
|
+
out.push("#{key.to_json}: #{SafeJsonifyFilter.to_json(value, depth + 1)}")
|
52
|
+
}
|
54
53
|
|
55
54
|
"{#{out.join(",")}}"
|
56
55
|
end
|
@@ -120,12 +119,45 @@ module CloudCannonJekyll
|
|
120
119
|
|
121
120
|
def self.hash_to_json(input, depth)
|
122
121
|
hash = input.map do |key, value|
|
123
|
-
"
|
122
|
+
"#{key.to_json}: #{SafeJsonifyFilter.to_json(value, depth + 1)}"
|
124
123
|
end
|
125
124
|
|
126
125
|
"{#{hash.join(",")}}"
|
127
126
|
end
|
128
127
|
|
128
|
+
def self.site_drop_legacy_select_data_to_json(input, depth)
|
129
|
+
prevent = %w(config time related_posts destination cache_dir safe
|
130
|
+
keep_files encoding markdown_ext strict_front_matter show_drafts
|
131
|
+
limit_posts future unpublished whitelist maruku markdown highlighter
|
132
|
+
lsi excerpt_separator incremental detach port host show_dir_listing
|
133
|
+
permalink paginate_path quiet verbose defaults liquid kramdown title
|
134
|
+
url description categories data tags static_files html_pages pages
|
135
|
+
documents posts related_posts time source timezone include exclude
|
136
|
+
baseurl collections _comments _editor _source_editor _explore
|
137
|
+
uploads_dir plugins_dir data_dir collections_dir includes_dir
|
138
|
+
layouts_dir _array_structures cloudcannon rdiscount redcarpet redcloth)
|
139
|
+
|
140
|
+
if Jekyll::VERSION.start_with?("2.")
|
141
|
+
prevent = prevent.concat input["collections"].keys
|
142
|
+
prevent.push "gems"
|
143
|
+
elsif Jekyll::VERSION.match?(%r!3\.[0-4]\.!)
|
144
|
+
prevent = prevent.concat input["collections"].map { |c| c["label"] }
|
145
|
+
prevent = prevent.concat %w(plugins gems)
|
146
|
+
else
|
147
|
+
prevent.push "plugins"
|
148
|
+
end
|
149
|
+
|
150
|
+
out = input.map { |key, value|
|
151
|
+
next unless value.is_a?(Array) || value.is_a?(Hash)
|
152
|
+
next if prevent.include? key
|
153
|
+
prevent.push key
|
154
|
+
|
155
|
+
"#{key.to_json}: #{SafeJsonifyFilter.to_json(value, depth + 1)}"
|
156
|
+
}.compact
|
157
|
+
|
158
|
+
"{#{out.join(",")}}" if out.any?
|
159
|
+
end
|
160
|
+
|
129
161
|
def self.to_json(input, depth)
|
130
162
|
if depth > 8 || (depth > 2 && SafeJsonifyFilter.document_type?(input))
|
131
163
|
'"MAXIMUM_DEPTH"'
|
@@ -144,7 +176,7 @@ module CloudCannonJekyll
|
|
144
176
|
elsif input.is_a?(Hash)
|
145
177
|
SafeJsonifyFilter.hash_to_json(input, depth)
|
146
178
|
else
|
147
|
-
"\"UNSUPPORTED:#{input.class}\""
|
179
|
+
"\"UNSUPPORTED:#{input.class.to_json}\""
|
148
180
|
end
|
149
181
|
end
|
150
182
|
|
@@ -162,6 +194,14 @@ module CloudCannonJekyll
|
|
162
194
|
"[#{out.join(",")}]"
|
163
195
|
end
|
164
196
|
|
197
|
+
def cc_site_select_data_jsonify(input)
|
198
|
+
if input.key? "_select_data"
|
199
|
+
SafeJsonifyFilter.to_json(input["_select_data"], 0)
|
200
|
+
else
|
201
|
+
SafeJsonifyFilter.site_drop_legacy_select_data_to_json(input, 0)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
165
205
|
def cc_safe_jsonify(input)
|
166
206
|
SafeJsonifyFilter.to_json(input, 0)
|
167
207
|
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: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CloudCannon
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -86,6 +86,20 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0.11'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: json_schemer
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.2.13
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.2.13
|
89
103
|
description: Creates CloudCannon editor details for Jekyll
|
90
104
|
email:
|
91
105
|
- support@cloudcannon.com
|
@@ -104,8 +118,11 @@ files:
|
|
104
118
|
- Rakefile
|
105
119
|
- cloudcannon-jekyll.gemspec
|
106
120
|
- lib/cloudcannon-jekyll.rb
|
121
|
+
- lib/cloudcannon-jekyll/_cloudcannon/config-2.x.json
|
122
|
+
- lib/cloudcannon-jekyll/_cloudcannon/config-3.0-4.x.json
|
123
|
+
- lib/cloudcannon-jekyll/_cloudcannon/config.json
|
107
124
|
- lib/cloudcannon-jekyll/_cloudcannon/details-2.x.json
|
108
|
-
- lib/cloudcannon-jekyll/_cloudcannon/details-3.0.x.json
|
125
|
+
- lib/cloudcannon-jekyll/_cloudcannon/details-3.0-4.x.json
|
109
126
|
- lib/cloudcannon-jekyll/_cloudcannon/details.json
|
110
127
|
- lib/cloudcannon-jekyll/configuration.rb
|
111
128
|
- lib/cloudcannon-jekyll/generator.rb
|
@@ -119,7 +136,7 @@ homepage: https://github.com/cloudcannon/cloudcannon-jekyll
|
|
119
136
|
licenses:
|
120
137
|
- MIT
|
121
138
|
metadata: {}
|
122
|
-
post_install_message:
|
139
|
+
post_install_message:
|
123
140
|
rdoc_options: []
|
124
141
|
require_paths:
|
125
142
|
- lib
|
@@ -134,9 +151,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
151
|
- !ruby/object:Gem::Version
|
135
152
|
version: '0'
|
136
153
|
requirements: []
|
137
|
-
rubyforge_project:
|
154
|
+
rubyforge_project:
|
138
155
|
rubygems_version: 2.7.6.2
|
139
|
-
signing_key:
|
156
|
+
signing_key:
|
140
157
|
specification_version: 4
|
141
158
|
summary: CloudCannon Jekyll integration
|
142
159
|
test_files: []
|