jekyll-open-sdg-plugins 1.5.0.pre.beta1 → 1.6.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 +4 -4
- data/lib/jekyll-open-sdg-plugins/backwards_compatibility.rb +61 -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 +102 -3
- 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 +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea24daaae4b8498fa13522aa018ddbd941fd634de1a4560f44545f658fb01503
|
4
|
+
data.tar.gz: 590a264c698030df46d090f1c279550eb814e8b41e86036711f6ba5722bf91da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfc5cfc56bb2ad2cef06b4bd71db36b34815327a89759727bea1fed0e2f442dcf82368f378e41b9b1c00164f62b649cf559451a9023cc65bbd8027eba85fd00b
|
7
|
+
data.tar.gz: 0baaae1c694dc51dd7f769364369e71b02e9c26717828d245d5934532d546c7751fc892c9194da8dff488958b0d759b6d5b622a395c6229ae5c58865eb531410
|
@@ -0,0 +1,61 @@
|
|
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
|
+
site.config['reporting_status']['status_types'] = reporting_status_types.map do |status_type|
|
35
|
+
{
|
36
|
+
'value' => status_type['value'],
|
37
|
+
'label' => status_type['translation_key'],
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Also fill in the "reporting" data with things needed by older templates.
|
43
|
+
add_translation_keys(site.data['reporting']['statuses'], site)
|
44
|
+
add_translation_keys(site.data['reporting']['overall']['statuses'], site)
|
45
|
+
|
46
|
+
if site.data['reporting'].has_key?('extra_fields')
|
47
|
+
site.data['reporting']['extra_fields'].each do |key, extra_field|
|
48
|
+
extra_field.each do |extra_field_value|
|
49
|
+
add_translation_keys(extra_field_value['statuses'], site)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
if site.data['reporting'].has_key?('goals')
|
55
|
+
site.data['reporting']['goals'].each do |goal|
|
56
|
+
add_translation_keys(goal['statuses'], site)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
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,7 +175,8 @@
|
|
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": [
|
@@ -328,7 +329,6 @@
|
|
328
329
|
},
|
329
330
|
"data_edit_url": {
|
330
331
|
"type": "string",
|
331
|
-
"minLength": 1,
|
332
332
|
"title": "Data edit URL",
|
333
333
|
"description": "This setting controls the URL of the 'Edit Data' buttons that appear on the staging site's indicator pages.",
|
334
334
|
"links": [
|
@@ -470,6 +470,24 @@
|
|
470
470
|
}
|
471
471
|
]
|
472
472
|
},
|
473
|
+
"favicons": {
|
474
|
+
"type": "string",
|
475
|
+
"title": "Favicons",
|
476
|
+
"description": "The type of favicons to use.",
|
477
|
+
"enum": ["legacy", "favicon.io"],
|
478
|
+
"options": {
|
479
|
+
"enum_titles": [
|
480
|
+
"Legacy",
|
481
|
+
"Favicon.io (recommended)"
|
482
|
+
]
|
483
|
+
},
|
484
|
+
"links": [
|
485
|
+
{
|
486
|
+
"rel": "More information on the favicons setting",
|
487
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#favicons"
|
488
|
+
}
|
489
|
+
]
|
490
|
+
},
|
473
491
|
"footer_language_toggle": {
|
474
492
|
"type": "string",
|
475
493
|
"title": "Footer language toggle",
|
@@ -1129,7 +1147,6 @@
|
|
1129
1147
|
},
|
1130
1148
|
"metadata_edit_url": {
|
1131
1149
|
"type": "string",
|
1132
|
-
"minLength": 1,
|
1133
1150
|
"title": "Metadata edit URL",
|
1134
1151
|
"description": "This setting controls the URL of the 'Edit Metadata' buttons that appear on the staging site's indicator pages.",
|
1135
1152
|
"links": [
|
@@ -1206,6 +1223,58 @@
|
|
1206
1223
|
}
|
1207
1224
|
]
|
1208
1225
|
},
|
1226
|
+
"progress_status": {
|
1227
|
+
"options": {"collapsed": true},
|
1228
|
+
"type": "object",
|
1229
|
+
"title": "Progress status",
|
1230
|
+
"description": "This setting is used in the 'goal-with-progress' layout. It controls the behavior of progress status functionality.",
|
1231
|
+
"properties": {
|
1232
|
+
"status_heading": {
|
1233
|
+
"title": "Status heading",
|
1234
|
+
"type": "string",
|
1235
|
+
"description": "A heading to display before the progress status on indicator pages."
|
1236
|
+
},
|
1237
|
+
"status_types": {
|
1238
|
+
"options": {"collapsed": true},
|
1239
|
+
"type": "array",
|
1240
|
+
"title": "Status types",
|
1241
|
+
"description": "Controls the behavior and labels for the different progress status types.",
|
1242
|
+
"items": {
|
1243
|
+
"type": "object",
|
1244
|
+
"title": "Status type",
|
1245
|
+
"properties": {
|
1246
|
+
"value": {
|
1247
|
+
"type": "string",
|
1248
|
+
"minLength": 1,
|
1249
|
+
"title": "Value",
|
1250
|
+
"description": "The value of the status type, as it is set in the indicator configuration (eg, 'targetachieved')."
|
1251
|
+
},
|
1252
|
+
"label": {
|
1253
|
+
"type": "string",
|
1254
|
+
"title": "Label",
|
1255
|
+
"description": "The human-readable label for the status type. Can be a translation key (eg, 'status.target_achieved')."
|
1256
|
+
},
|
1257
|
+
"image": {
|
1258
|
+
"type": "string",
|
1259
|
+
"title": "Image",
|
1260
|
+
"description": "The internal path to the image to use (if any) for this progress status."
|
1261
|
+
},
|
1262
|
+
"alt": {
|
1263
|
+
"type": "string",
|
1264
|
+
"title": "Alt",
|
1265
|
+
"description": "An alt tag for the image above."
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
}
|
1269
|
+
}
|
1270
|
+
},
|
1271
|
+
"links": [
|
1272
|
+
{
|
1273
|
+
"rel": "More information on the progress status setting",
|
1274
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#progress_status"
|
1275
|
+
}
|
1276
|
+
]
|
1277
|
+
},
|
1209
1278
|
"remote_data_prefix": {
|
1210
1279
|
"type": "string",
|
1211
1280
|
"minLength": 1,
|
@@ -1232,6 +1301,36 @@
|
|
1232
1301
|
"type": "boolean",
|
1233
1302
|
"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.",
|
1234
1303
|
"format": "checkbox"
|
1304
|
+
},
|
1305
|
+
"status_types": {
|
1306
|
+
"options": {"collapsed": true},
|
1307
|
+
"type": "array",
|
1308
|
+
"title": "Status types",
|
1309
|
+
"description": "Controls the behavior and labels for the different reporting status types.",
|
1310
|
+
"items": {
|
1311
|
+
"type": "object",
|
1312
|
+
"title": "Status type",
|
1313
|
+
"properties": {
|
1314
|
+
"value": {
|
1315
|
+
"type": "string",
|
1316
|
+
"minLength": 1,
|
1317
|
+
"title": "Value",
|
1318
|
+
"description": "The value of the status type, as it is set in the indicator configuration (eg, 'complete')."
|
1319
|
+
},
|
1320
|
+
"label": {
|
1321
|
+
"type": "string",
|
1322
|
+
"minLength": 1,
|
1323
|
+
"title": "Label",
|
1324
|
+
"description": "The human-readable label for the status type. Can be a translation key (eg, 'status.reported_online')."
|
1325
|
+
},
|
1326
|
+
"hide_on_goal_pages": {
|
1327
|
+
"type": "boolean",
|
1328
|
+
"title": "Hide on goal pages",
|
1329
|
+
"description": "Whether to hide this status type on goal pages. Useful for the most commonly-occuring type.",
|
1330
|
+
"format": "checkbox"
|
1331
|
+
}
|
1332
|
+
}
|
1333
|
+
}
|
1235
1334
|
}
|
1236
1335
|
}
|
1237
1336
|
}
|
@@ -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.0
|
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-09 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
|
@@ -101,9 +102,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
102
|
version: '0'
|
102
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
104
|
requirements:
|
104
|
-
- - "
|
105
|
+
- - ">="
|
105
106
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
107
|
+
version: '0'
|
107
108
|
requirements: []
|
108
109
|
rubygems_version: 3.1.4
|
109
110
|
signing_key:
|