jekyll-open-sdg-plugins 1.2.0.pre.beta1 → 1.2.0.pre.beta2
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/lib/jekyll-open-sdg-plugins/create_goals.rb +2 -5
- data/lib/jekyll-open-sdg-plugins/create_indicators.rb +30 -31
- data/lib/jekyll-open-sdg-plugins/create_pages.rb +9 -7
- data/lib/jekyll-open-sdg-plugins/schema-site-config.json +50 -0
- data/lib/jekyll-open-sdg-plugins/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c83cab37937dfcf97c1bfbef8746287e6297755250e89c7a6e5e45edfbc366d5
|
4
|
+
data.tar.gz: 8fee68ec2cff47f46d217c12f97af1b1953d1bef5eae6020937345d69c641859
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87d899fbed0085ac3b376251ba97189415b685c5673b6d1096eb48db87898e2ae54d32f8757b16d59f3b96e7a9994d183ffa68bcac3ab2164865cf6a77190ebc
|
7
|
+
data.tar.gz: d54c8b23f83c63bbded2cb46f77358756f61d37164839a800f7c615af07446693368fa80873ad7d81bc69b7384540ca407658770550bc5716a009dfecf68a123
|
@@ -8,7 +8,7 @@ module JekyllOpenSdgPlugins
|
|
8
8
|
|
9
9
|
def generate(site)
|
10
10
|
# If site.create_goals is set, create goals per the metadata.
|
11
|
-
if site.config['languages'] and site.config['create_goals']
|
11
|
+
if site.config['languages'] and site.config['create_goals'] and site.config['create_goals'].key?('layout') and site.config['create_goals']['layout'] != ''
|
12
12
|
# Compile the list of goals.
|
13
13
|
goals = {}
|
14
14
|
# Are we using translated builds?
|
@@ -27,10 +27,7 @@ module JekyllOpenSdgPlugins
|
|
27
27
|
goals[goal] = true
|
28
28
|
end
|
29
29
|
# Decide what layout to use for the goal pages.
|
30
|
-
layout = '
|
31
|
-
if site.config['create_goals'].key?('layout')
|
32
|
-
layout = site.config['create_goals']['layout']
|
33
|
-
end
|
30
|
+
layout = site.config['create_goals']['layout']
|
34
31
|
# See if we need to "map" any language codes.
|
35
32
|
languages_public = Hash.new
|
36
33
|
if site.config['languages_public']
|
@@ -8,12 +8,9 @@ module JekyllOpenSdgPlugins
|
|
8
8
|
|
9
9
|
def generate(site)
|
10
10
|
# If site.create_indicators is set, create indicators per the metadata.
|
11
|
-
if site.config['languages'] and site.config['create_indicators']
|
11
|
+
if site.config['languages'] and site.config['create_indicators'] and site.config['create_indicators'].key?('layout') and site.config['create_indicators']['layout'] != ''
|
12
12
|
# Decide what layout to use for the indicator pages.
|
13
|
-
layout = '
|
14
|
-
if site.config['create_indicators'].key?('layout')
|
15
|
-
layout = site.config['create_indicators']['layout']
|
16
|
-
end
|
13
|
+
layout = site.config['create_indicators']['layout']
|
17
14
|
# See if we need to "map" any language codes.
|
18
15
|
languages_public = Hash.new
|
19
16
|
if site.config['languages_public']
|
@@ -44,33 +41,35 @@ module JekyllOpenSdgPlugins
|
|
44
41
|
end
|
45
42
|
end
|
46
43
|
# Create the indicator configuration pages.
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
if site.config['create_config_forms'] && site.config['create_config_forms'].key?('layout') && site.config['create_config_forms']['layout'] != ''
|
45
|
+
metadata = {}
|
46
|
+
layout = site.config['create_config_forms']['layout']
|
47
|
+
if opensdg_translated_builds(site)
|
48
|
+
if site.data.has_key?('untranslated')
|
49
|
+
metadata = site.data['untranslated']['meta']
|
50
|
+
else
|
51
|
+
default_language = site.config['languages'][0]
|
52
|
+
metadata = site.data[default_language]['meta']
|
53
|
+
end
|
51
54
|
else
|
52
|
-
|
53
|
-
metadata = site.data[default_language]['meta']
|
55
|
+
metadata = site.data['meta']
|
54
56
|
end
|
55
|
-
|
56
|
-
metadata
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
if index != 0
|
71
|
-
dir = File.join(language_public, 'config', inid)
|
57
|
+
# Loop through the indicators (using metadata as a list).
|
58
|
+
if !metadata.empty?
|
59
|
+
# Loop through the languages.
|
60
|
+
site.config['languages'].each_with_index do |language, index|
|
61
|
+
# Get the "public language" (for URLs) which may be different.
|
62
|
+
language_public = language
|
63
|
+
if languages_public[language]
|
64
|
+
language_public = languages_public[language]
|
65
|
+
end
|
66
|
+
metadata.each do |inid, meta|
|
67
|
+
dir = File.join('config', inid)
|
68
|
+
if index != 0
|
69
|
+
dir = File.join(language_public, 'config', inid)
|
70
|
+
end
|
71
|
+
site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, meta, layout)
|
72
72
|
end
|
73
|
-
site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, meta)
|
74
73
|
end
|
75
74
|
end
|
76
75
|
end
|
@@ -98,7 +97,7 @@ module JekyllOpenSdgPlugins
|
|
98
97
|
|
99
98
|
# A Page subclass used in the `CreateIndicators` class.
|
100
99
|
class IndicatorConfigPage < Jekyll::Page
|
101
|
-
def initialize(site, base, dir, inid, language, meta)
|
100
|
+
def initialize(site, base, dir, inid, language, meta, layout)
|
102
101
|
@site = site
|
103
102
|
@base = base
|
104
103
|
@dir = dir
|
@@ -109,7 +108,7 @@ module JekyllOpenSdgPlugins
|
|
109
108
|
self.data['language'] = language
|
110
109
|
self.data['indicator_number'] = inid.gsub('-', '.')
|
111
110
|
self.data['config_type'] = 'indicator'
|
112
|
-
self.data['layout'] =
|
111
|
+
self.data['layout'] = layout
|
113
112
|
self.data['meta'] = meta
|
114
113
|
self.data['title'] = 'Open SDG indicator configuration: ' + self.data['indicator_number']
|
115
114
|
self.data['config_filename'] = inid + '.yml'
|
@@ -67,13 +67,15 @@ module JekyllOpenSdgPlugins
|
|
67
67
|
# Hardcode the site configuration page if it's not already there.
|
68
68
|
config_page = pages.find { |page| page['layout'] == 'config-builder' }
|
69
69
|
if config_page == nil
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
70
|
+
if site.config['create_config_forms'] && site.config['create_config_forms'].key?('layout') && site.config['create_config_forms']['layout'] != ''
|
71
|
+
pages.push({
|
72
|
+
'folder' => '/config',
|
73
|
+
'layout' => site.config['create_config_forms']['layout'],
|
74
|
+
'title' => 'Open SDG site configuration',
|
75
|
+
'config_type' => 'site',
|
76
|
+
'config_filename' => 'site_config.yml'
|
77
|
+
})
|
78
|
+
end
|
77
79
|
end
|
78
80
|
|
79
81
|
# See if we need to "map" any language codes.
|
@@ -116,6 +116,30 @@
|
|
116
116
|
}
|
117
117
|
]
|
118
118
|
},
|
119
|
+
"create_config_forms": {
|
120
|
+
"options": {"collapsed": true},
|
121
|
+
"type": "object",
|
122
|
+
"title": "Create configuration forms",
|
123
|
+
"description": "This setting can be used to automatically create the configuration form pages.",
|
124
|
+
"properties": {
|
125
|
+
"layout": {
|
126
|
+
"type": "string",
|
127
|
+
"title": "Layout",
|
128
|
+
"format": "choices",
|
129
|
+
"enum": [
|
130
|
+
"",
|
131
|
+
"config-builder"
|
132
|
+
],
|
133
|
+
"options": {
|
134
|
+
"enum_titles": [
|
135
|
+
"Do not automatically create config forms",
|
136
|
+
"config-builder"
|
137
|
+
]
|
138
|
+
},
|
139
|
+
"description": "The layout to use for the configuration form pages."
|
140
|
+
}
|
141
|
+
}
|
142
|
+
},
|
119
143
|
"create_goals": {
|
120
144
|
"options": {"collapsed": true},
|
121
145
|
"type": "object",
|
@@ -125,6 +149,21 @@
|
|
125
149
|
"layout": {
|
126
150
|
"type": "string",
|
127
151
|
"title": "Layout",
|
152
|
+
"format": "choices",
|
153
|
+
"enum": [
|
154
|
+
"",
|
155
|
+
"goal",
|
156
|
+
"goal-by-target",
|
157
|
+
"goal-by-target-vertical"
|
158
|
+
],
|
159
|
+
"options": {
|
160
|
+
"enum_titles": [
|
161
|
+
"Do not automatically create goals",
|
162
|
+
"goal",
|
163
|
+
"goal-by-target",
|
164
|
+
"goal-by-target-vertical"
|
165
|
+
]
|
166
|
+
},
|
128
167
|
"description": "The layout to use for the goal pages."
|
129
168
|
}
|
130
169
|
},
|
@@ -144,6 +183,17 @@
|
|
144
183
|
"layout": {
|
145
184
|
"type": "string",
|
146
185
|
"title": "Layout",
|
186
|
+
"format": "choices",
|
187
|
+
"enum": [
|
188
|
+
"",
|
189
|
+
"indicator"
|
190
|
+
],
|
191
|
+
"options": {
|
192
|
+
"enum_titles": [
|
193
|
+
"Do not automatically create indicators",
|
194
|
+
"indicator"
|
195
|
+
]
|
196
|
+
},
|
147
197
|
"description": "The layout to use for the indicator pages."
|
148
198
|
}
|
149
199
|
},
|