cloudcannon-jekyll 0.0.5 → 0.2.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 +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +2 -3
- data/HISTORY.md +25 -3
- data/cloudcannon-jekyll.gemspec +3 -2
- data/lib/cloudcannon-jekyll.rb +5 -7
- data/lib/cloudcannon-jekyll/_cloudcannon/config-2.x.json +45 -0
- data/lib/cloudcannon-jekyll/_cloudcannon/config-3.0-4.x.json +45 -0
- data/lib/cloudcannon-jekyll/_cloudcannon/config.json +67 -0
- data/lib/cloudcannon-jekyll/_cloudcannon/details-2.x.json +5 -3
- data/lib/cloudcannon-jekyll/_cloudcannon/{details-3.0.x.json → details-3.0-4.x.json} +4 -2
- data/lib/cloudcannon-jekyll/_cloudcannon/details.json +16 -4
- data/lib/cloudcannon-jekyll/generator.rb +32 -16
- data/lib/cloudcannon-jekyll/safe-jsonify-filter.rb +56 -9
- data/lib/cloudcannon-jekyll/version.rb +1 -1
- data/script/release +4 -2
- metadata +29 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 71e33735df4c89f5a837224c14fc5830262d6296
|
4
|
+
data.tar.gz: 748068f64fd86fb1514533a9b84f8576c7cd79e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0872a4182a09614927851140c865ad761c5f2ee41c8e79798ad27efc08ef270b1ec9acf60c75da436aea327cf4e11cade050f308921807116fb18e8d8d07fbe5'
|
7
|
+
data.tar.gz: 6f9207baa8d6084af8a968c2aad4f3d7c9e16e1ec6283408c372e5db156cc890b75e9f22cd98e59619f37172d4981fb859b728f5935d0d3fac40ad17b589ee0e
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -25,3 +25,8 @@ AllCops:
|
|
25
25
|
Naming/MemoizedInstanceVariableName:
|
26
26
|
Exclude:
|
27
27
|
- lib/cloudcannon-jekyll/page-without-a-file.rb
|
28
|
+
|
29
|
+
# This is excluded since the ruby target is 2.3.8 which doesn't support String.match?(Regexp)
|
30
|
+
Performance/RegexpMatch:
|
31
|
+
Exclude:
|
32
|
+
- lib/cloudcannon-jekyll/generator.rb
|
data/.travis.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
3
|
rvm:
|
4
|
-
- 2.
|
4
|
+
- 2.3.8
|
5
5
|
|
6
6
|
before_install:
|
7
7
|
- gem update --system
|
@@ -15,5 +15,4 @@ env:
|
|
15
15
|
matrix:
|
16
16
|
- JEKYLL_VERSION="2.4.0"
|
17
17
|
- JEKYLL_VERSION="3.0.0"
|
18
|
-
- JEKYLL_VERSION="3.
|
19
|
-
- JEKYLL_VERSION="4.0.0"
|
18
|
+
- JEKYLL_VERSION="3.2.1"
|
data/HISTORY.md
CHANGED
@@ -1,7 +1,29 @@
|
|
1
|
-
#
|
1
|
+
# 0.2.0
|
2
2
|
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Add defaults and input-options keys to config output
|
4
|
+
* Add more ignore keys for legacy select data filter
|
5
|
+
* Reduce methods added from other plugins clashing
|
6
|
+
* Fix invalid output when unsupported class found
|
7
|
+
|
8
|
+
# 0.1.0
|
9
|
+
|
10
|
+
* Add output config file
|
11
|
+
* Add support for including only specified `data` keys
|
12
|
+
* Fix invalid JSON issue for sites built with Jekyll 2 and no collections
|
13
|
+
* Change module load style for easier dropping into _plugins
|
14
|
+
|
15
|
+
# 0.0.8
|
16
|
+
|
17
|
+
* Removed unsupported Jekyll test targets
|
18
|
+
|
19
|
+
# 0.0.7
|
20
|
+
|
21
|
+
* Fix invalid JSON issue for sites built with Jekyll 2 and no collections
|
22
|
+
|
23
|
+
# 0.0.6
|
24
|
+
|
25
|
+
* Fixed unsupported Fixnum for Ruby 2.3
|
26
|
+
* Fixed reference to unsupported String::match? for Ruby 2.3
|
5
27
|
|
6
28
|
# 0.0.5
|
7
29
|
|
data/cloudcannon-jekyll.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_development_dependency "rake", "~> 13.0"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.9"
|
26
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
27
|
-
spec.add_development_dependency "rubocop-jekyll", "~> 0.
|
26
|
+
spec.add_development_dependency "rubocop", "~> 0.80"
|
27
|
+
spec.add_development_dependency "rubocop-jekyll", "~> 0.11"
|
28
|
+
spec.add_development_dependency "json_schemer", "~> 0.2.4"
|
28
29
|
end
|
data/lib/cloudcannon-jekyll.rb
CHANGED
@@ -2,13 +2,11 @@
|
|
2
2
|
|
3
3
|
require "jekyll"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
autoload :VERSION, "cloudcannon-jekyll/version"
|
11
|
-
end
|
5
|
+
require_relative "cloudcannon-jekyll/page-without-a-file"
|
6
|
+
require_relative "cloudcannon-jekyll/generator"
|
7
|
+
require_relative "cloudcannon-jekyll/configuration"
|
8
|
+
require_relative "cloudcannon-jekyll/safe-jsonify-filter"
|
9
|
+
require_relative "cloudcannon-jekyll/version"
|
12
10
|
|
13
11
|
Liquid::Template.register_filter(CloudCannonJekyll::SafeJsonifyFilter)
|
14
12
|
|
@@ -0,0 +1,45 @@
|
|
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._options %}"input-options": {{ site._options | cc_safe_jsonify }},{% endif %}
|
24
|
+
{% if site.defaults %}"defaults": {{ site.defaults | cc_safe_jsonify }},{% endif %}
|
25
|
+
{% if site._editor %}"editor": {
|
26
|
+
"default-path": {{ site._editor.default_path | jsonify }}
|
27
|
+
},{% endif %}
|
28
|
+
{% if site._source_editor %}"source-editor": {
|
29
|
+
"tab-size": {{ site._source_editor.tab_size | jsonify }},
|
30
|
+
"show-gutter": {{ site._source_editor.show_gutter | jsonify }},
|
31
|
+
"theme": {{ site._source_editor.theme | jsonify }}
|
32
|
+
},{% endif %}
|
33
|
+
{% if site._explore %}"explore": {{ site._explore | cc_safe_jsonify }},{% endif %}
|
34
|
+
"paths": {
|
35
|
+
"uploads": {{ site.uploads_dir | jsonify }},
|
36
|
+
"plugins": {{ site.plugins_dir | jsonify }},
|
37
|
+
"data": {{ site.data_dir | jsonify }},
|
38
|
+
"collections": {{ site.collections_dir | jsonify }},
|
39
|
+
"includes": {{ site.includes_dir | jsonify }},
|
40
|
+
"layouts": {{ site.layouts_dir | jsonify }}
|
41
|
+
},
|
42
|
+
{% if site._array_structures %}"array-structures": {{ site._array_structures | cc_safe_jsonify }},{% endif %}
|
43
|
+
{% assign select_data = site | cc_site_select_data_jsonify %}{% if select_data %}"select-data": {{ select_data }},{% endif %}
|
44
|
+
"source": {{ site.source | jsonify }}
|
45
|
+
}
|
@@ -0,0 +1,45 @@
|
|
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._options %}"input-options": {{ site._options | cc_safe_jsonify }},{% endif %}
|
24
|
+
{% if site.defaults %}"defaults": {{ site.defaults | cc_safe_jsonify }},{% endif %}
|
25
|
+
{% if site._editor %}"editor": {
|
26
|
+
"default-path": {{ site._editor.default_path | jsonify }}
|
27
|
+
},{% endif %}
|
28
|
+
{% if site._source_editor %}"source-editor": {
|
29
|
+
"tab-size": {{ site._source_editor.tab_size | jsonify }},
|
30
|
+
"show-gutter": {{ site._source_editor.show_gutter | jsonify }},
|
31
|
+
"theme": {{ site._source_editor.theme | jsonify }}
|
32
|
+
},{% endif %}
|
33
|
+
{% if site._explore %}"explore": {{ site._explore | cc_safe_jsonify }},{% endif %}
|
34
|
+
"paths": {
|
35
|
+
"uploads": {{ site.uploads_dir | jsonify }},
|
36
|
+
"plugins": {{ site.plugins_dir | jsonify }},
|
37
|
+
"data": {{ site.data_dir | jsonify }},
|
38
|
+
"collections": {{ site.collections_dir | jsonify }},
|
39
|
+
"includes": {{ site.includes_dir | jsonify }},
|
40
|
+
"layouts": {{ site.layouts_dir | jsonify }}
|
41
|
+
},
|
42
|
+
{% if site._array_structures %}"array-structures": {{ site._array_structures | cc_safe_jsonify }},{% endif %}
|
43
|
+
{% assign select_data = site | cc_site_select_data_jsonify %}{% if select_data %}"select-data": {{ select_data }},{% endif %}
|
44
|
+
"source": {{ site.source | jsonify }}
|
45
|
+
}
|
@@ -0,0 +1,67 @@
|
|
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._options -%}
|
31
|
+
"input-options": {{ site._options | cc_safe_jsonify }},
|
32
|
+
{%- endif %}
|
33
|
+
{% if site.defaults -%}
|
34
|
+
"defaults": {{ site.defaults | cc_safe_jsonify }},
|
35
|
+
{%- endif %}
|
36
|
+
{% if site._editor -%}
|
37
|
+
"editor": {
|
38
|
+
"default-path": {{ site._editor.default_path | jsonify }}
|
39
|
+
},
|
40
|
+
{%- endif %}
|
41
|
+
{% if site._source_editor -%}
|
42
|
+
"source-editor": {
|
43
|
+
"tab-size": {{ site._source_editor.tab_size | jsonify }},
|
44
|
+
"show-gutter": {{ site._source_editor.show_gutter | jsonify }},
|
45
|
+
"theme": {{ site._source_editor.theme | jsonify }}
|
46
|
+
},
|
47
|
+
{%- endif %}
|
48
|
+
{% if site._explore -%}
|
49
|
+
"explore": {{ site._explore | cc_safe_jsonify }},
|
50
|
+
{%- endif %}
|
51
|
+
"paths": {
|
52
|
+
"uploads": {{ site.uploads_dir | jsonify }},
|
53
|
+
"plugins": {{ site.plugins_dir | jsonify }},
|
54
|
+
"data": {{ site.data_dir | jsonify }},
|
55
|
+
"collections": {{ site.collections_dir | jsonify }},
|
56
|
+
"includes": {{ site.includes_dir | jsonify }},
|
57
|
+
"layouts": {{ site.layouts_dir | jsonify }}
|
58
|
+
},
|
59
|
+
{% if site._array_structures -%}
|
60
|
+
"array-structures": {{ site._array_structures | cc_safe_jsonify }},
|
61
|
+
{%- endif %}
|
62
|
+
{% assign select_data = site | cc_site_select_data_jsonify -%}
|
63
|
+
{% if select_data -%}
|
64
|
+
"select-data": {{ select_data }},
|
65
|
+
{%- endif %}
|
66
|
+
"source": {{ site.source | jsonify }}
|
67
|
+
}
|
@@ -13,10 +13,12 @@
|
|
13
13
|
"kramdown": {{ site.kramdown | cc_safe_jsonify }},
|
14
14
|
"commonmark": {{ site.commonmark | cc_safe_jsonify }}
|
15
15
|
}
|
16
|
-
},{% if site.cloudcannon.data %}
|
17
|
-
"data": {
|
16
|
+
},{% if site.cloudcannon.data.first %}{% assign data_seen = false %}
|
17
|
+
"data": {
|
18
|
+
{% for data in site.data %}{% assign key = data[0] %}{% if site.cloudcannon.data[key] %}{% if data_seen %},{% endif %}{{ data[0] | cc_safe_jsonify }}: {{ data[1] | cc_safe_jsonify }}{% assign data_seen = true %}{% endif %}{% endfor %}},
|
19
|
+
{% elsif site.cloudcannon.data %}"data": {{ site.data | cc_safe_jsonify }},{% endif %}
|
18
20
|
"collections": {
|
19
|
-
"posts": {{ site.posts | reverse | cc_safe_jsonify }},
|
21
|
+
"posts": {{ site.posts | reverse | cc_safe_jsonify }}{% if site.collections.size > 0 %},{% endif %}
|
20
22
|
{% for collection in site.collections %}"{{ collection[0] | xml_escape }}": {{ collection[1].docs | cc_safe_jsonify }}{% unless forloop.last %},{% endunless %}
|
21
23
|
{% endfor %}
|
22
24
|
},
|
@@ -13,8 +13,10 @@
|
|
13
13
|
"kramdown": {{ site.kramdown | cc_safe_jsonify }},
|
14
14
|
"commonmark": {{ site.commonmark | cc_safe_jsonify }}
|
15
15
|
}
|
16
|
-
},{% if site.cloudcannon.data %}
|
17
|
-
"data": {
|
16
|
+
},{% if site.cloudcannon.data.first %}{% assign data_seen = false %}
|
17
|
+
"data": {
|
18
|
+
{% for data in site.data %}{% assign key = data[0] %}{% if site.cloudcannon.data[key] %}{% if data_seen %},{% endif %}{{ data[0] | cc_safe_jsonify }}: {{ data[1] | cc_safe_jsonify }}{% assign data_seen = true %}{% endif %}{% endfor %}},
|
19
|
+
{% elsif site.cloudcannon.data %}"data": {{ site.data | cc_safe_jsonify }},{% endif %}
|
18
20
|
"collections": {
|
19
21
|
{% for collection in site.collections %}"{{ collection.label | xml_escape }}": {{ collection.docs | cc_safe_jsonify }}{% unless forloop.last %},{% endunless %}
|
20
22
|
{% endfor %}
|
@@ -14,14 +14,26 @@
|
|
14
14
|
"commonmark": {{ site.commonmark | cc_safe_jsonify }}
|
15
15
|
}
|
16
16
|
},
|
17
|
-
{
|
17
|
+
{% if site.cloudcannon.data.first -%}
|
18
|
+
"data": {
|
19
|
+
{%- assign data_seen = false %}
|
20
|
+
{%- for data in site.data %}
|
21
|
+
{%- assign key = data[0] %}
|
22
|
+
{%- if site.cloudcannon.data[key] %}
|
23
|
+
{%- if data_seen %},{% endif -%}
|
24
|
+
{{ data[0] | cc_safe_jsonify }}: {{ data[1] | cc_safe_jsonify }}
|
25
|
+
{%- assign data_seen = true %}
|
26
|
+
{%- endif %}
|
27
|
+
{%- endfor -%}
|
28
|
+
},
|
29
|
+
{% elsif site.cloudcannon.data -%}
|
18
30
|
"data": {{ site.data | cc_safe_jsonify }},
|
19
|
-
{
|
31
|
+
{%- endif %}
|
20
32
|
"collections": {
|
21
|
-
{
|
33
|
+
{%- for collection in site.collections -%}
|
22
34
|
"{{ collection.label | xml_escape }}": {{ collection.docs | cc_safe_jsonify }}
|
23
35
|
{%- unless forloop.last %},{% endunless %}
|
24
|
-
{%- endfor
|
36
|
+
{%- endfor -%}
|
25
37
|
},
|
26
38
|
"pages": {{ site.pages | cc_safe_jsonify }},
|
27
39
|
"static": {{ site.static_files | cc_static_files_jsonify }}
|
@@ -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 %r!3\.[0-4]\.! =~ Jekyll::VERSION
|
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
|
@@ -12,7 +12,8 @@ module CloudCannonJekyll
|
|
12
12
|
Date,
|
13
13
|
Time,
|
14
14
|
NilClass,
|
15
|
-
|
15
|
+
Object.const_defined?("Fixnum") ? Fixnum : nil,
|
16
|
+
].compact.freeze
|
16
17
|
|
17
18
|
@document_types = [
|
18
19
|
Jekyll::Document,
|
@@ -45,12 +46,11 @@ module CloudCannonJekyll
|
|
45
46
|
def self.document_data_to_json(data, out, prevent, depth)
|
46
47
|
prevent += %w(content output next previous excerpt)
|
47
48
|
|
48
|
-
data.
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
49
|
+
data.each { |key, value|
|
50
|
+
next if prevent.include? key
|
51
|
+
prevent.push key
|
52
|
+
out.push("#{key.to_json}: #{SafeJsonifyFilter.to_json(value, depth + 1)}")
|
53
|
+
}
|
54
54
|
|
55
55
|
"{#{out.join(",")}}"
|
56
56
|
end
|
@@ -120,12 +120,51 @@ module CloudCannonJekyll
|
|
120
120
|
|
121
121
|
def self.hash_to_json(input, depth)
|
122
122
|
hash = input.map do |key, value|
|
123
|
-
"
|
123
|
+
"#{key.to_json}: #{SafeJsonifyFilter.to_json(value, depth + 1)}"
|
124
124
|
end
|
125
125
|
|
126
126
|
"{#{hash.join(",")}}"
|
127
127
|
end
|
128
128
|
|
129
|
+
def self.site_drop_legacy_select_data_to_json(input, depth)
|
130
|
+
prevent = %w(config time related_posts destination cache_dir safe
|
131
|
+
keep_files encoding markdown_ext strict_front_matter show_drafts
|
132
|
+
limit_posts future unpublished whitelist maruku markdown highlighter
|
133
|
+
lsi excerpt_separator incremental detach port host show_dir_listing
|
134
|
+
permalink paginate_path quiet verbose defaults liquid kramdown title
|
135
|
+
url description categories data tags static_files html_pages pages
|
136
|
+
documents posts related_posts time source timezone include exclude
|
137
|
+
baseurl collections _comments _editor _source_editor _explore
|
138
|
+
uploads_dir plugins_dir data_dir collections_dir includes_dir
|
139
|
+
layouts_dir _array_structures _options cloudcannon rdiscount redcarpet
|
140
|
+
redcloth jekyll-archives archives)
|
141
|
+
|
142
|
+
if Jekyll::VERSION.start_with?("2.")
|
143
|
+
prevent.push "gems"
|
144
|
+
prevent = prevent.concat input["collections"].keys
|
145
|
+
elsif %r!3\.[0-4]\.! =~ Jekyll::VERSION
|
146
|
+
prevent.push "gems"
|
147
|
+
prevent.push "plugins"
|
148
|
+
prevent = prevent.concat(input["collections"].map { |c| c["label"] })
|
149
|
+
else
|
150
|
+
prevent.push "plugins"
|
151
|
+
prevent = prevent.concat(input.content_methods).uniq
|
152
|
+
end
|
153
|
+
|
154
|
+
out = []
|
155
|
+
|
156
|
+
input.each_key { |key|
|
157
|
+
next if prevent.include? key
|
158
|
+
prevent.push key
|
159
|
+
|
160
|
+
next unless input[key].is_a?(Array) || input[key].is_a?(Hash)
|
161
|
+
|
162
|
+
out << "#{key.to_json}: #{SafeJsonifyFilter.to_json(input[key], depth + 1)}"
|
163
|
+
}
|
164
|
+
|
165
|
+
"{#{out.join(",")}}" if out.any?
|
166
|
+
end
|
167
|
+
|
129
168
|
def self.to_json(input, depth)
|
130
169
|
if depth > 8 || (depth > 2 && SafeJsonifyFilter.document_type?(input))
|
131
170
|
'"MAXIMUM_DEPTH"'
|
@@ -144,7 +183,7 @@ module CloudCannonJekyll
|
|
144
183
|
elsif input.is_a?(Hash)
|
145
184
|
SafeJsonifyFilter.hash_to_json(input, depth)
|
146
185
|
else
|
147
|
-
|
186
|
+
input.class.to_s.prepend("UNSUPPORTED:").to_json
|
148
187
|
end
|
149
188
|
end
|
150
189
|
|
@@ -162,6 +201,14 @@ module CloudCannonJekyll
|
|
162
201
|
"[#{out.join(",")}]"
|
163
202
|
end
|
164
203
|
|
204
|
+
def cc_site_select_data_jsonify(input)
|
205
|
+
if input.key? "_select_data"
|
206
|
+
SafeJsonifyFilter.to_json(input["_select_data"], 0)
|
207
|
+
else
|
208
|
+
SafeJsonifyFilter.site_drop_legacy_select_data_to_json(input, 0)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
165
212
|
def cc_safe_jsonify(input)
|
166
213
|
SafeJsonifyFilter.to_json(input, 0)
|
167
214
|
end
|
data/script/release
CHANGED
@@ -33,5 +33,7 @@ git fetch -t origin
|
|
33
33
|
|
34
34
|
# Push tag and upload new gem
|
35
35
|
|
36
|
-
|
37
|
-
git push origin master &&
|
36
|
+
git tag "$tag" &&
|
37
|
+
git push origin master &&
|
38
|
+
git push origin "$tag" &&
|
39
|
+
gem push cloudcannon-jekyll-*.gem
|
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.0
|
4
|
+
version: 0.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:
|
11
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -64,28 +64,42 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
67
|
+
version: '0.80'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0.
|
74
|
+
version: '0.80'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rubocop-jekyll
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0.
|
81
|
+
version: '0.11'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0.
|
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.4
|
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.4
|
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:
|
138
|
-
rubygems_version: 2.
|
139
|
-
signing_key:
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.5.2.3
|
156
|
+
signing_key:
|
140
157
|
specification_version: 4
|
141
158
|
summary: CloudCannon Jekyll integration
|
142
159
|
test_files: []
|