jekyll-open-sdg-plugins 1.5.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-open-sdg-plugins/backwards_compatibility.rb +64 -0
- data/lib/jekyll-open-sdg-plugins/create_indicators.rb +0 -27
- data/lib/jekyll-open-sdg-plugins/create_pages.rb +0 -9
- data/lib/jekyll-open-sdg-plugins/schema-indicator-config.json +13 -1
- data/lib/jekyll-open-sdg-plugins/schema-site-config.json +86 -15
- data/lib/jekyll-open-sdg-plugins/site_configuration.rb +21 -0
- data/lib/jekyll-open-sdg-plugins/version.rb +1 -1
- data/lib/jekyll-open-sdg-plugins.rb +1 -0
- data/tests/_config.yml +12 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc7af2adda55aeb703e6ee1f419e9a21aa294df764c23f1a4700185827ed546b
|
4
|
+
data.tar.gz: 1447e290b59a47ed87ed0bd8d838535e44c9236a4ab799b237e6ee2dc76b1afb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 695adba003d784151e497271c83a4c356f7782f9e3b920ed024655aa786e50fd63a1fcf2602decb10f97254044ba7ed3ff20ba7c064f344996e9777246dc3a4f
|
7
|
+
data.tar.gz: d73f0c4f344a7150202863622e171061e0d56db6b2faa310316f1d5d40975e9972d86c698e93b8fcedac5f0c5313d38daee4a74ab979a13b014f737e95d145d6
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "jekyll"
|
2
|
+
require_relative "helpers"
|
3
|
+
|
4
|
+
module JekyllOpenSdgPlugins
|
5
|
+
class BackwardsCompatibility < Jekyll::Generator
|
6
|
+
safe true
|
7
|
+
priority :low
|
8
|
+
|
9
|
+
def add_translation_keys(statuses, site)
|
10
|
+
statuses.each do |status|
|
11
|
+
status_var = 'value'
|
12
|
+
unless status.has_key?(status_var)
|
13
|
+
status_var = 'status'
|
14
|
+
end
|
15
|
+
status_in_site_config = site.config['reporting_status']['status_types'].detect {|s| s['value'] == status[status_var] }
|
16
|
+
if status_in_site_config.nil?
|
17
|
+
opensdg_notice('Unexpected reporting status type: ' + status[status_var] + '. Expected reporting status types:')
|
18
|
+
puts site.config['reporting_status']['status_types'].map { |s| s['value'] }
|
19
|
+
end
|
20
|
+
status['translation_key'] = status_in_site_config['label']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# This file is used to avoid any backwards compatibility issues
|
25
|
+
# as the Open SDG API changes over time.
|
26
|
+
def generate(site)
|
27
|
+
|
28
|
+
# Handle legacy treatment of reporting status types.
|
29
|
+
unless (site.config.has_key?('reporting_status') &&
|
30
|
+
site.config['reporting_status'].has_key?('status_types') &&
|
31
|
+
site.config['reporting_status']['status_types'].count > 0)
|
32
|
+
reporting_status = site.data['schema'].detect {|f| f['name'] == 'reporting_status' }
|
33
|
+
reporting_status_types = reporting_status['field']['options']
|
34
|
+
unless site.config.has_key?('reporting_status')
|
35
|
+
site.config['reporting_status'] = {}
|
36
|
+
end
|
37
|
+
site.config['reporting_status']['status_types'] = reporting_status_types.map do |status_type|
|
38
|
+
{
|
39
|
+
'value' => status_type['value'],
|
40
|
+
'label' => status_type['translation_key'],
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Also fill in the "reporting" data with things needed by older templates.
|
46
|
+
add_translation_keys(site.data['reporting']['statuses'], site)
|
47
|
+
add_translation_keys(site.data['reporting']['overall']['statuses'], site)
|
48
|
+
|
49
|
+
if site.data['reporting'].has_key?('extra_fields')
|
50
|
+
site.data['reporting']['extra_fields'].each do |key, extra_field|
|
51
|
+
extra_field.each do |extra_field_value|
|
52
|
+
add_translation_keys(extra_field_value['statuses'], site)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
if site.data['reporting'].has_key?('goals')
|
58
|
+
site.data['reporting']['goals'].each do |goal|
|
59
|
+
add_translation_keys(goal['statuses'], site)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -14,33 +14,6 @@ module JekyllOpenSdgPlugins
|
|
14
14
|
form_settings_meta = site.config['indicator_metadata_form']
|
15
15
|
form_settings_data = site.config['indicator_data_form']
|
16
16
|
|
17
|
-
# Special treatment of repository_link settings: prefix them
|
18
|
-
# with the repository_url_data site config if needed.
|
19
|
-
repo_url = site.config['repository_url_data']
|
20
|
-
if repo_url && repo_url != '' && repo_url.start_with?('http')
|
21
|
-
if form_settings_config != nil && form_settings_config && form_settings_config['enabled']
|
22
|
-
if form_settings_config['repository_link'] && form_settings_config['repository_link'] != ''
|
23
|
-
unless form_settings_config['repository_link'].start_with?('http')
|
24
|
-
form_settings_config['repository_link'] = repo_url + form_settings_config['repository_link']
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
if form_settings_meta != nil && form_settings_meta && form_settings_meta['enabled']
|
29
|
-
if form_settings_meta['repository_link'] && form_settings_meta['repository_link'] != ''
|
30
|
-
unless form_settings_meta['repository_link'].start_with?('http')
|
31
|
-
form_settings_meta['repository_link'] = repo_url + form_settings_meta['repository_link']
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
if form_settings_data != nil && form_settings_data && form_settings_data['enabled']
|
36
|
-
if form_settings_data['repository_link'] && form_settings_data['repository_link'] != ''
|
37
|
-
unless form_settings_data['repository_link'].start_with?('http')
|
38
|
-
form_settings_data['repository_link'] = repo_url + form_settings_data['repository_link']
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
17
|
translations = site.data['translations']
|
45
18
|
# If site.create_indicators is set, create indicators per the metadata.
|
46
19
|
if (language_config and indicator_config and indicator_config.key?('layout') and indicator_config['layout'] != '')
|
@@ -81,15 +81,6 @@ module JekyllOpenSdgPlugins
|
|
81
81
|
# Make sure the form settings are set.
|
82
82
|
config_page = pages.find { |page| page['layout'] == 'config-builder' }
|
83
83
|
if config_page != nil && form_settings && form_settings['enabled']
|
84
|
-
# Special treatment of repository_link.
|
85
|
-
if form_settings['repository_link'] && form_settings['repository_link'] != ''
|
86
|
-
unless form_settings['repository_link'].start_with?('http')
|
87
|
-
repo_url = site.config['repository_url_site']
|
88
|
-
if repo_url && repo_url != '' && repo_url.start_with?('http')
|
89
|
-
form_settings['repository_link'] = repo_url + form_settings['repository_link']
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
84
|
config_page['form_settings'] = form_settings
|
94
85
|
end
|
95
86
|
|
@@ -613,11 +613,23 @@
|
|
613
613
|
]
|
614
614
|
}
|
615
615
|
},
|
616
|
+
"progress_status": {
|
617
|
+
"type": "string",
|
618
|
+
"title": "Progress status",
|
619
|
+
"enum": ["not_available", "challenges_remain", "approaching_target", "target_achieved"],
|
620
|
+
"description": "The progress status of the indicator.",
|
621
|
+
"links": [
|
622
|
+
{
|
623
|
+
"rel": "More information on the progress status setting",
|
624
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/indicator-configuration/#progress-status"
|
625
|
+
}
|
626
|
+
]
|
627
|
+
},
|
616
628
|
"reporting_status": {
|
617
629
|
"type": "string",
|
618
630
|
"title": "Reporting status",
|
619
631
|
"enum": ["complete", "inprogress", "notstarted", "notapplicable"],
|
620
|
-
"description": "The status of the indicator.",
|
632
|
+
"description": "The reporting status of the indicator.",
|
621
633
|
"links": [
|
622
634
|
{
|
623
635
|
"rel": "More information on the reporting status setting",
|
@@ -175,14 +175,16 @@
|
|
175
175
|
"",
|
176
176
|
"goal",
|
177
177
|
"goal-by-target",
|
178
|
-
"goal-by-target-vertical"
|
178
|
+
"goal-by-target-vertical",
|
179
|
+
"goal-with-progress"
|
179
180
|
],
|
180
181
|
"options": {
|
181
182
|
"enum_titles": [
|
182
183
|
"Do not automatically create goals",
|
183
184
|
"goal",
|
184
185
|
"goal-by-target",
|
185
|
-
"goal-by-target-vertical"
|
186
|
+
"goal-by-target-vertical",
|
187
|
+
"goal-with-progress"
|
186
188
|
]
|
187
189
|
},
|
188
190
|
"description": "The layout to use for the goal pages."
|
@@ -328,7 +330,6 @@
|
|
328
330
|
},
|
329
331
|
"data_edit_url": {
|
330
332
|
"type": "string",
|
331
|
-
"minLength": 1,
|
332
333
|
"title": "Data edit URL",
|
333
334
|
"description": "This setting controls the URL of the 'Edit Data' buttons that appear on the staging site's indicator pages.",
|
334
335
|
"links": [
|
@@ -1147,7 +1148,6 @@
|
|
1147
1148
|
},
|
1148
1149
|
"metadata_edit_url": {
|
1149
1150
|
"type": "string",
|
1150
|
-
"minLength": 1,
|
1151
1151
|
"title": "Metadata edit URL",
|
1152
1152
|
"description": "This setting controls the URL of the 'Edit Metadata' buttons that appear on the staging site's indicator pages.",
|
1153
1153
|
"links": [
|
@@ -1224,6 +1224,58 @@
|
|
1224
1224
|
}
|
1225
1225
|
]
|
1226
1226
|
},
|
1227
|
+
"progress_status": {
|
1228
|
+
"options": {"collapsed": true},
|
1229
|
+
"type": "object",
|
1230
|
+
"title": "Progress status",
|
1231
|
+
"description": "This setting is used in the 'goal-with-progress' layout. It controls the behavior of progress status functionality.",
|
1232
|
+
"properties": {
|
1233
|
+
"status_heading": {
|
1234
|
+
"title": "Status heading",
|
1235
|
+
"type": "string",
|
1236
|
+
"description": "A heading to display before the progress status on indicator pages."
|
1237
|
+
},
|
1238
|
+
"status_types": {
|
1239
|
+
"options": {"collapsed": true},
|
1240
|
+
"type": "array",
|
1241
|
+
"title": "Status types",
|
1242
|
+
"description": "Controls the behavior and labels for the different progress status types.",
|
1243
|
+
"items": {
|
1244
|
+
"type": "object",
|
1245
|
+
"title": "Status type",
|
1246
|
+
"properties": {
|
1247
|
+
"value": {
|
1248
|
+
"type": "string",
|
1249
|
+
"minLength": 1,
|
1250
|
+
"title": "Value",
|
1251
|
+
"description": "The value of the status type, as it is set in the indicator configuration (eg, 'targetachieved')."
|
1252
|
+
},
|
1253
|
+
"label": {
|
1254
|
+
"type": "string",
|
1255
|
+
"title": "Label",
|
1256
|
+
"description": "The human-readable label for the status type. Can be a translation key (eg, 'status.target_achieved')."
|
1257
|
+
},
|
1258
|
+
"image": {
|
1259
|
+
"type": "string",
|
1260
|
+
"title": "Image",
|
1261
|
+
"description": "The internal path to the image to use (if any) for this progress status."
|
1262
|
+
},
|
1263
|
+
"alt": {
|
1264
|
+
"type": "string",
|
1265
|
+
"title": "Alt",
|
1266
|
+
"description": "An alt tag for the image above."
|
1267
|
+
}
|
1268
|
+
}
|
1269
|
+
}
|
1270
|
+
}
|
1271
|
+
},
|
1272
|
+
"links": [
|
1273
|
+
{
|
1274
|
+
"rel": "More information on the progress status setting",
|
1275
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#progress_status"
|
1276
|
+
}
|
1277
|
+
]
|
1278
|
+
},
|
1227
1279
|
"remote_data_prefix": {
|
1228
1280
|
"type": "string",
|
1229
1281
|
"minLength": 1,
|
@@ -1250,6 +1302,36 @@
|
|
1250
1302
|
"type": "boolean",
|
1251
1303
|
"description": "Whether or not to display disaggregation status tabs. If you enable this setting, you should also use 'expected_disaggregations' in your indicator configuration, in order to provide the disaggregation status report with useful metrics.",
|
1252
1304
|
"format": "checkbox"
|
1305
|
+
},
|
1306
|
+
"status_types": {
|
1307
|
+
"options": {"collapsed": true},
|
1308
|
+
"type": "array",
|
1309
|
+
"title": "Status types",
|
1310
|
+
"description": "Controls the behavior and labels for the different reporting status types.",
|
1311
|
+
"items": {
|
1312
|
+
"type": "object",
|
1313
|
+
"title": "Status type",
|
1314
|
+
"properties": {
|
1315
|
+
"value": {
|
1316
|
+
"type": "string",
|
1317
|
+
"minLength": 1,
|
1318
|
+
"title": "Value",
|
1319
|
+
"description": "The value of the status type, as it is set in the indicator configuration (eg, 'complete')."
|
1320
|
+
},
|
1321
|
+
"label": {
|
1322
|
+
"type": "string",
|
1323
|
+
"minLength": 1,
|
1324
|
+
"title": "Label",
|
1325
|
+
"description": "The human-readable label for the status type. Can be a translation key (eg, 'status.reported_online')."
|
1326
|
+
},
|
1327
|
+
"hide_on_goal_pages": {
|
1328
|
+
"type": "boolean",
|
1329
|
+
"title": "Hide on goal pages",
|
1330
|
+
"description": "Whether to hide this status type on goal pages. Useful for the most commonly-occuring type.",
|
1331
|
+
"format": "checkbox"
|
1332
|
+
}
|
1333
|
+
}
|
1334
|
+
}
|
1253
1335
|
}
|
1254
1336
|
}
|
1255
1337
|
}
|
@@ -1341,17 +1423,6 @@
|
|
1341
1423
|
}
|
1342
1424
|
]
|
1343
1425
|
},
|
1344
|
-
"sharethis_property": {
|
1345
|
-
"type": "string",
|
1346
|
-
"title": "ShareThis property",
|
1347
|
-
"description": "This setting creates a ShareThis widget along the left side of every page. It should be the property id for your ShareThis account.",
|
1348
|
-
"links": [
|
1349
|
-
{
|
1350
|
-
"rel": "More information on the sharethis setting",
|
1351
|
-
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#sharethis_property"
|
1352
|
-
}
|
1353
|
-
]
|
1354
|
-
},
|
1355
1426
|
"site_config_form": {
|
1356
1427
|
"options": {"collapsed": true},
|
1357
1428
|
"type": "object",
|
@@ -40,6 +40,27 @@ module JekyllOpenSdgPlugins
|
|
40
40
|
site.config[setting.downcase] = ENV[setting]
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
# Hardcode some variables.
|
45
|
+
site.config['disaggregation_status'] = {}
|
46
|
+
site.config['disaggregation_status']['status_types'] = [
|
47
|
+
{
|
48
|
+
'value' => 'complete',
|
49
|
+
'label' => 'status.disaggregation_status_complete',
|
50
|
+
},
|
51
|
+
{
|
52
|
+
'value' => 'inprogress',
|
53
|
+
'label' => 'status.disaggregation_status_inprogress',
|
54
|
+
},
|
55
|
+
{
|
56
|
+
'value' => 'notstarted',
|
57
|
+
'label' => 'status.disaggregation_status_notstarted',
|
58
|
+
},
|
59
|
+
{
|
60
|
+
'value' => 'notapplicable',
|
61
|
+
'label' => 'status.disaggregation_status_notapplicable',
|
62
|
+
},
|
63
|
+
]
|
43
64
|
end
|
44
65
|
|
45
66
|
# Copy properties from a hash onto another hash.
|
@@ -12,6 +12,7 @@ require_relative "jekyll-open-sdg-plugins/sdg_variables"
|
|
12
12
|
require_relative "jekyll-open-sdg-plugins/search_index"
|
13
13
|
require_relative "jekyll-open-sdg-plugins/validate_indicator_config"
|
14
14
|
require_relative "jekyll-open-sdg-plugins/metadata_schema_to_config"
|
15
|
+
require_relative "jekyll-open-sdg-plugins/backwards_compatibility"
|
15
16
|
|
16
17
|
module JekyllOpenSdgPlugins
|
17
18
|
end
|
data/tests/_config.yml
CHANGED
@@ -154,4 +154,15 @@ indicator_config_form:
|
|
154
154
|
indicator_metadata_form:
|
155
155
|
repository_link: https://github.com/open-sdg/open-sdg-data-starter/tree/develop/meta
|
156
156
|
scopes:
|
157
|
-
- national
|
157
|
+
- national
|
158
|
+
|
159
|
+
reporting_status:
|
160
|
+
status_types:
|
161
|
+
- value: complete
|
162
|
+
label: Complete
|
163
|
+
- value: notstarted
|
164
|
+
label: Not started
|
165
|
+
- value: inprogress
|
166
|
+
label: In progress
|
167
|
+
- value: notapplicable
|
168
|
+
label: Not applicable
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-open-sdg-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brock Fanning
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- jekyll-open-sdg-plugins.gemspec
|
69
69
|
- lib/jekyll-open-sdg-plugins.rb
|
70
|
+
- lib/jekyll-open-sdg-plugins/backwards_compatibility.rb
|
70
71
|
- lib/jekyll-open-sdg-plugins/create_goals.rb
|
71
72
|
- lib/jekyll-open-sdg-plugins/create_indicators.rb
|
72
73
|
- lib/jekyll-open-sdg-plugins/create_pages.rb
|