jekyll-open-sdg-plugins 1.4.0.pre.beta1 → 1.6.0.pre.beta1
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 +61 -0
- data/lib/jekyll-open-sdg-plugins/create_goals.rb +8 -6
- 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 +116 -6
- data/lib/jekyll-open-sdg-plugins/schema-site-config.json +171 -7
- data/lib/jekyll-open-sdg-plugins/sdg_variables.rb +43 -2
- 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: b37fec3e9d58774c1d4bb3b6102a3e37347e92c559e9eafacaa97d793d8584ce
|
4
|
+
data.tar.gz: b64a110e6f4f6da10c805e221ae3d591bbd65ae026baa5e7a835395790a2857f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2297001ac108425e4ecb56bc59d16c63ddfc84c85588a67e65c0adde49d83d46db4d0cdc8dc2452700a0118f1cfc50de9b5f578c2e0749596a6835ebb60ad8e7
|
7
|
+
data.tar.gz: af31105e71d58e3193ab246a1c91e4f4fc04ee34e7013570631e0bcd899fe269f696687e71b7a10f5395cccfe14b935b512cfc7b06741eb1c185b03510ba744d
|
@@ -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
|
@@ -26,7 +26,7 @@ module JekyllOpenSdgPlugins
|
|
26
26
|
if indicator.has_key?('standalone') and indicator['standalone']
|
27
27
|
next
|
28
28
|
end
|
29
|
-
goal = inid.split('-')[0]
|
29
|
+
goal = inid.split('-')[0]
|
30
30
|
goals[goal] = true
|
31
31
|
end
|
32
32
|
# Decide what layout to use for the goal pages.
|
@@ -44,11 +44,13 @@ module JekyllOpenSdgPlugins
|
|
44
44
|
language_public = languages_public[language]
|
45
45
|
end
|
46
46
|
# Loop through the goals.
|
47
|
-
|
47
|
+
goal_index = 0
|
48
|
+
goals.keys.sort.each do |goal|
|
48
49
|
# Add the language subfolder for all except the default (first) language.
|
49
50
|
dir = index == 0 ? goal.to_s : File.join(language_public, goal.to_s)
|
50
51
|
# Create the goal page.
|
51
|
-
site.collections['goals'].docs << GoalPage.new(site, site.source, dir, goal, language, layout)
|
52
|
+
site.collections['goals'].docs << GoalPage.new(site, site.source, dir, goal, language, layout, goal_index)
|
53
|
+
goal_index += 1
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|
@@ -57,7 +59,7 @@ module JekyllOpenSdgPlugins
|
|
57
59
|
|
58
60
|
# A Page subclass used in the `CreateGoals` class.
|
59
61
|
class GoalPage < Jekyll::Page
|
60
|
-
def initialize(site, base, dir, goal, language, layout)
|
62
|
+
def initialize(site, base, dir, goal, language, layout, goal_index)
|
61
63
|
@site = site
|
62
64
|
@base = base
|
63
65
|
@dir = dir
|
@@ -65,8 +67,8 @@ module JekyllOpenSdgPlugins
|
|
65
67
|
|
66
68
|
goal_content = ''
|
67
69
|
if site.config['create_goals'].has_key?('goals')
|
68
|
-
if !site.config['create_goals']['goals'][
|
69
|
-
goal_content = site.config['create_goals']['goals'][
|
70
|
+
if !site.config['create_goals']['goals'][goal_index].nil?
|
71
|
+
goal_content = site.config['create_goals']['goals'][goal_index]['content']
|
70
72
|
end
|
71
73
|
end
|
72
74
|
@content = goal_content
|
@@ -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
|
|
@@ -248,6 +248,7 @@
|
|
248
248
|
"type": "string",
|
249
249
|
"format": "color",
|
250
250
|
"title": "Line color",
|
251
|
+
"default": "#949494",
|
251
252
|
"description": "The color of the line.",
|
252
253
|
"links": [
|
253
254
|
{
|
@@ -257,9 +258,14 @@
|
|
257
258
|
]
|
258
259
|
},
|
259
260
|
"borderDash": {
|
260
|
-
"type": "
|
261
|
+
"type": "array",
|
261
262
|
"title": "Line dash type",
|
262
263
|
"description": "The type of line dash.",
|
264
|
+
"default": [10, 5],
|
265
|
+
"items": {
|
266
|
+
"type": "number"
|
267
|
+
},
|
268
|
+
"minItems": 2,
|
263
269
|
"links": [
|
264
270
|
{
|
265
271
|
"rel": "More information on the line dash setting",
|
@@ -294,12 +300,13 @@
|
|
294
300
|
"type": "string",
|
295
301
|
"format": "color",
|
296
302
|
"title": "Label color",
|
297
|
-
"description": "Color for the label text."
|
303
|
+
"description": "Color for the label text.",
|
304
|
+
"default": "#000000"
|
298
305
|
},
|
299
306
|
"backgroundColor": {
|
300
307
|
"type": "string",
|
301
308
|
"format": "color",
|
302
|
-
"default": "#
|
309
|
+
"default": "#ffffff",
|
303
310
|
"title": "Background color",
|
304
311
|
"description": "Background color for the label text."
|
305
312
|
}
|
@@ -313,7 +320,7 @@
|
|
313
320
|
"borderColor": {
|
314
321
|
"type": "string",
|
315
322
|
"format": "color",
|
316
|
-
"default": "#
|
323
|
+
"default": "#ffffff",
|
317
324
|
"title": "High-contrast line color",
|
318
325
|
"description": "The color of the line in high-contrast mode."
|
319
326
|
},
|
@@ -325,7 +332,7 @@
|
|
325
332
|
"fontColor": {
|
326
333
|
"type": "string",
|
327
334
|
"format": "color",
|
328
|
-
"default": "#
|
335
|
+
"default": "#ffffff",
|
329
336
|
"title": "High-contrast label color",
|
330
337
|
"description": "Color for the label text in high-contrast mode."
|
331
338
|
},
|
@@ -386,6 +393,40 @@
|
|
386
393
|
}
|
387
394
|
]
|
388
395
|
},
|
396
|
+
"graph_series_breaks": {
|
397
|
+
"options": {"collapsed": true},
|
398
|
+
"type": "array",
|
399
|
+
"title": "Graph series breaks",
|
400
|
+
"description": "A list of series break (ie, a gap among the years) lines to display on the graph.",
|
401
|
+
"items": {
|
402
|
+
"type": "object",
|
403
|
+
"title": "Series break",
|
404
|
+
"allOf": [
|
405
|
+
{ "$ref": "#/definitions/series_unit_constraint" },
|
406
|
+
{
|
407
|
+
"properties": {
|
408
|
+
"label_content": {
|
409
|
+
"type": "string",
|
410
|
+
"title": "Label content",
|
411
|
+
"default": "indicator.annotation_series_break",
|
412
|
+
"description": "The text to display for this series break."
|
413
|
+
},
|
414
|
+
"value": {
|
415
|
+
"type": "number",
|
416
|
+
"title": "Value",
|
417
|
+
"description": "The numeric value at which to place the series break. This number should be between 0 (the left side of the chart) and the number of years minus 1 (the right side of the chart)."
|
418
|
+
}
|
419
|
+
}
|
420
|
+
}
|
421
|
+
]
|
422
|
+
},
|
423
|
+
"links": [
|
424
|
+
{
|
425
|
+
"rel": "More information on the graph target lines setting",
|
426
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/indicator-configuration/#graph_series_breaks"
|
427
|
+
}
|
428
|
+
]
|
429
|
+
},
|
389
430
|
"graph_stacked_disaggregation": {
|
390
431
|
"type": "string",
|
391
432
|
"title": "Stacked disaggregation",
|
@@ -397,6 +438,40 @@
|
|
397
438
|
}
|
398
439
|
]
|
399
440
|
},
|
441
|
+
"graph_target_lines": {
|
442
|
+
"options": {"collapsed": true},
|
443
|
+
"type": "array",
|
444
|
+
"title": "Graph target lines",
|
445
|
+
"description": "A list of target lines to display on the graph.",
|
446
|
+
"items": {
|
447
|
+
"type": "object",
|
448
|
+
"title": "Target line",
|
449
|
+
"allOf": [
|
450
|
+
{ "$ref": "#/definitions/series_unit_constraint" },
|
451
|
+
{
|
452
|
+
"properties": {
|
453
|
+
"label_content": {
|
454
|
+
"type": "string",
|
455
|
+
"title": "Label content",
|
456
|
+
"default": "indicator.annotation_2030_target",
|
457
|
+
"description": "The text to display for this target line."
|
458
|
+
},
|
459
|
+
"value": {
|
460
|
+
"type": "number",
|
461
|
+
"title": "Value",
|
462
|
+
"description": "The numeric value at which to place the target line."
|
463
|
+
}
|
464
|
+
}
|
465
|
+
}
|
466
|
+
]
|
467
|
+
},
|
468
|
+
"links": [
|
469
|
+
{
|
470
|
+
"rel": "More information on the graph target lines setting",
|
471
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/indicator-configuration/#graph_target_lines"
|
472
|
+
}
|
473
|
+
]
|
474
|
+
},
|
400
475
|
"graph_title": {
|
401
476
|
"type": "string",
|
402
477
|
"title": "Graph title",
|
@@ -504,6 +579,18 @@
|
|
504
579
|
}
|
505
580
|
]
|
506
581
|
},
|
582
|
+
"placeholder": {
|
583
|
+
"title": "Placeholder indicator",
|
584
|
+
"type": "string",
|
585
|
+
"description": "Entering text here identifies this as a 'placeholder' indicator. The text will be displayed on the goal page, in place of a link to the indicator page.",
|
586
|
+
"format": "textarea",
|
587
|
+
"links": [
|
588
|
+
{
|
589
|
+
"rel": "More information the placeholder setting",
|
590
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/indicator-configuration/#placeholder"
|
591
|
+
}
|
592
|
+
]
|
593
|
+
},
|
507
594
|
"precision": {
|
508
595
|
"options": {"collapsed": true},
|
509
596
|
"type": "array",
|
@@ -526,11 +613,23 @@
|
|
526
613
|
]
|
527
614
|
}
|
528
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
|
+
},
|
529
628
|
"reporting_status": {
|
530
629
|
"type": "string",
|
531
630
|
"title": "Reporting status",
|
532
631
|
"enum": ["complete", "inprogress", "notstarted", "notapplicable"],
|
533
|
-
"description": "The status of the indicator.",
|
632
|
+
"description": "The reporting status of the indicator.",
|
534
633
|
"links": [
|
535
634
|
{
|
536
635
|
"rel": "More information on the reporting status setting",
|
@@ -576,6 +675,17 @@
|
|
576
675
|
"href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#recommended-special-fields"
|
577
676
|
}
|
578
677
|
]
|
678
|
+
},
|
679
|
+
"x_axis_label": {
|
680
|
+
"type": "string",
|
681
|
+
"title": "X axis label",
|
682
|
+
"description": "A label beneath the X axis on charts. This overrides the same site configuration setting.",
|
683
|
+
"links": [
|
684
|
+
{
|
685
|
+
"rel": "More information on the X axis label setting",
|
686
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/indicator-configuration/#x_axis_label"
|
687
|
+
}
|
688
|
+
]
|
579
689
|
}
|
580
690
|
},
|
581
691
|
"additionalProperties": true,
|
@@ -31,12 +31,22 @@
|
|
31
31
|
"options": {"collapsed": true},
|
32
32
|
"type": "object",
|
33
33
|
"title": "Analytics",
|
34
|
-
"description": "If these settings are used, usage statistics will be sent to Google Analytics.",
|
34
|
+
"description": "If these settings are used, usage statistics will be sent to Google Analytics. These are optional, and you don't have to use all of them. Typically you would just use one, such as the 'ua' option.",
|
35
35
|
"properties": {
|
36
|
-
"
|
36
|
+
"ua": {
|
37
37
|
"type": "string",
|
38
|
-
"title": "
|
39
|
-
"description": "The tracking ID
|
38
|
+
"title": "Universal Analytics (ua) tracking ID",
|
39
|
+
"description": "The tracking ID for the analytics.js approach, for your property on Google Analytics. Typically starts with 'UA-'."
|
40
|
+
},
|
41
|
+
"gtag": {
|
42
|
+
"type": "string",
|
43
|
+
"title": "gtag.js (gtag) tracking ID",
|
44
|
+
"description": "The tracking ID for the gtag.js approach, for your property on Google Analytics. Typically starts with 'G-'."
|
45
|
+
},
|
46
|
+
"gtm": {
|
47
|
+
"type": "string",
|
48
|
+
"title": "Google Tag Manager (gtm) tracking ID",
|
49
|
+
"description": "Your tracking ID for Google Tag Manager. Typically starts with 'GTM-'. Though this is included as an analytics approach, it requires additional configuration within Google Tag Manager in order to capture analytics."
|
40
50
|
}
|
41
51
|
},
|
42
52
|
"links": [
|
@@ -106,6 +116,26 @@
|
|
106
116
|
}
|
107
117
|
]
|
108
118
|
},
|
119
|
+
"cookie_consent_form": {
|
120
|
+
"options": {"collapsed": true},
|
121
|
+
"type": "object",
|
122
|
+
"title": "Cookie consent form",
|
123
|
+
"description": "A cookie consent form for users",
|
124
|
+
"properties": {
|
125
|
+
"enabled": {
|
126
|
+
"type": "boolean",
|
127
|
+
"title": "Enabled",
|
128
|
+
"description": "Whether the cookie consent form will be enabled",
|
129
|
+
"format": "checkbox"
|
130
|
+
}
|
131
|
+
},
|
132
|
+
"links": [
|
133
|
+
{
|
134
|
+
"rel": "More information on the cookie_consent_form setting",
|
135
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#cookie_consent_form"
|
136
|
+
}
|
137
|
+
]
|
138
|
+
},
|
109
139
|
"country": {
|
110
140
|
"options": {"collapsed": true},
|
111
141
|
"type": "object",
|
@@ -145,7 +175,8 @@
|
|
145
175
|
"",
|
146
176
|
"goal",
|
147
177
|
"goal-by-target",
|
148
|
-
"goal-by-target-vertical"
|
178
|
+
"goal-by-target-vertical",
|
179
|
+
"goal-with-progress"
|
149
180
|
],
|
150
181
|
"options": {
|
151
182
|
"enum_titles": [
|
@@ -298,7 +329,6 @@
|
|
298
329
|
},
|
299
330
|
"data_edit_url": {
|
300
331
|
"type": "string",
|
301
|
-
"minLength": 1,
|
302
332
|
"title": "Data edit URL",
|
303
333
|
"description": "This setting controls the URL of the 'Edit Data' buttons that appear on the staging site's indicator pages.",
|
304
334
|
"links": [
|
@@ -440,6 +470,24 @@
|
|
440
470
|
}
|
441
471
|
]
|
442
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
|
+
},
|
443
491
|
"footer_language_toggle": {
|
444
492
|
"type": "string",
|
445
493
|
"title": "Footer language toggle",
|
@@ -736,6 +784,30 @@
|
|
736
784
|
}
|
737
785
|
]
|
738
786
|
},
|
787
|
+
"hide_single_series": {
|
788
|
+
"title": "Hide single series",
|
789
|
+
"type": "boolean",
|
790
|
+
"description": "This setting can be used to hide the 'Series' toggle on indicators where there is only one choice.",
|
791
|
+
"format": "checkbox",
|
792
|
+
"links": [
|
793
|
+
{
|
794
|
+
"rel": "More information on the hide single series setting",
|
795
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#hide_single_series"
|
796
|
+
}
|
797
|
+
]
|
798
|
+
},
|
799
|
+
"hide_single_unit": {
|
800
|
+
"title": "Hide single unit",
|
801
|
+
"type": "boolean",
|
802
|
+
"description": "This setting can be used to hide the 'Unit' toggle on indicators where there is only one choice.",
|
803
|
+
"format": "checkbox",
|
804
|
+
"links": [
|
805
|
+
{
|
806
|
+
"rel": "More information on the hide single unit setting",
|
807
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#hide_single_unit"
|
808
|
+
}
|
809
|
+
]
|
810
|
+
},
|
739
811
|
"indicator_config_form": {
|
740
812
|
"options": {"collapsed": true},
|
741
813
|
"type": "object",
|
@@ -1075,7 +1147,6 @@
|
|
1075
1147
|
},
|
1076
1148
|
"metadata_edit_url": {
|
1077
1149
|
"type": "string",
|
1078
|
-
"minLength": 1,
|
1079
1150
|
"title": "Metadata edit URL",
|
1080
1151
|
"description": "This setting controls the URL of the 'Edit Metadata' buttons that appear on the staging site's indicator pages.",
|
1081
1152
|
"links": [
|
@@ -1152,6 +1223,58 @@
|
|
1152
1223
|
}
|
1153
1224
|
]
|
1154
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
|
+
},
|
1155
1278
|
"remote_data_prefix": {
|
1156
1279
|
"type": "string",
|
1157
1280
|
"minLength": 1,
|
@@ -1178,6 +1301,36 @@
|
|
1178
1301
|
"type": "boolean",
|
1179
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.",
|
1180
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
|
+
}
|
1181
1334
|
}
|
1182
1335
|
}
|
1183
1336
|
}
|
@@ -1310,6 +1463,17 @@
|
|
1310
1463
|
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#validate_site_config"
|
1311
1464
|
}
|
1312
1465
|
]
|
1466
|
+
},
|
1467
|
+
"x_axis_label": {
|
1468
|
+
"type": "string",
|
1469
|
+
"title": "X axis label",
|
1470
|
+
"description": "A label beneath the X axis on charts. This is overridden by the same indicator configuration setting.",
|
1471
|
+
"links": [
|
1472
|
+
{
|
1473
|
+
"rel": "More information on the X axis label setting",
|
1474
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#x_axis_label"
|
1475
|
+
}
|
1476
|
+
]
|
1313
1477
|
}
|
1314
1478
|
},
|
1315
1479
|
"additionalProperties": true,
|
@@ -65,6 +65,38 @@ module JekyllOpenSdgPlugins
|
|
65
65
|
list[incremented]
|
66
66
|
end
|
67
67
|
|
68
|
+
# Wrapper of get_previous_item specifically for indicators.
|
69
|
+
def get_previous_indicator(list, index)
|
70
|
+
indicator = get_previous_item(list, index)
|
71
|
+
# Skip placeholder indicators.
|
72
|
+
is_placeholder = (indicator.has_key?('placeholder') and indicator['placeholder'] != '')
|
73
|
+
while (is_placeholder)
|
74
|
+
index -= 1
|
75
|
+
if index < 0
|
76
|
+
index = list.length() - 1
|
77
|
+
end
|
78
|
+
indicator = get_previous_item(list, index)
|
79
|
+
is_placeholder = (indicator.has_key?('placeholder') and indicator['placeholder'] != '')
|
80
|
+
end
|
81
|
+
return indicator
|
82
|
+
end
|
83
|
+
|
84
|
+
# Wrapper of get_next_item specifically for indicators.
|
85
|
+
def get_next_indicator(list, index)
|
86
|
+
indicator = get_next_item(list, index)
|
87
|
+
# Skip placeholder indicators.
|
88
|
+
is_placeholder = (indicator.has_key?('placeholder') and indicator['placeholder'] != '')
|
89
|
+
while (is_placeholder)
|
90
|
+
index += 1
|
91
|
+
if index >= list.length()
|
92
|
+
index = 0
|
93
|
+
end
|
94
|
+
indicator = get_next_item(list, index)
|
95
|
+
is_placeholder = (indicator.has_key?('placeholder') and indicator['placeholder'] != '')
|
96
|
+
end
|
97
|
+
return indicator
|
98
|
+
end
|
99
|
+
|
68
100
|
# The Jekyll baseurl is user-configured, and can be inconsistent. This
|
69
101
|
# ensure it is consistent in whether it starts/ends with a slash.
|
70
102
|
def normalize_baseurl(baseurl)
|
@@ -277,6 +309,7 @@ module JekyllOpenSdgPlugins
|
|
277
309
|
end
|
278
310
|
|
279
311
|
is_standalone = (meta.has_key?('standalone') and meta['standalone'])
|
312
|
+
is_placeholder = (meta.has_key?('placeholder') and meta['placeholder'] != '')
|
280
313
|
|
281
314
|
# Set the goal for this language, once only.
|
282
315
|
if !is_standalone && already_added[language].index(goal_number) == nil
|
@@ -327,6 +360,14 @@ module JekyllOpenSdgPlugins
|
|
327
360
|
# Allow metadata 'sort' field to override the default sort.
|
328
361
|
indicator_sort = meta['sort']
|
329
362
|
end
|
363
|
+
if meta.has_key?('graph_annotations') && meta['graph_annotations'].length > 0
|
364
|
+
meta['graph_annotations'].each do |annotation|
|
365
|
+
if annotation.has_key?('borderDash') && annotation['borderDash'].is_a?(String)
|
366
|
+
annotation['borderDash'] = [2, 2]
|
367
|
+
opensdg_notice('The "borderDash" property in graph annotations must be an array. Using [2, 2].')
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
330
371
|
available_indicator = {
|
331
372
|
'number' => indicator_number,
|
332
373
|
'slug' => indicator_number.gsub('.', '-'),
|
@@ -438,8 +479,8 @@ module JekyllOpenSdgPlugins
|
|
438
479
|
doc.data['target'] = available_targets[language].find {|x| x['number'] == target_number}
|
439
480
|
indicator_index = available_indicators[language].find_index {|x| x['number'] == indicator_number}
|
440
481
|
doc.data['indicator'] = available_indicators[language][indicator_index]
|
441
|
-
doc.data['next'] =
|
442
|
-
doc.data['previous'] =
|
482
|
+
doc.data['next'] = get_next_indicator(available_indicators[language], indicator_index)
|
483
|
+
doc.data['previous'] = get_previous_indicator(available_indicators[language], indicator_index)
|
443
484
|
|
444
485
|
elsif collection == 'goals'
|
445
486
|
# For goals we also set the current goal.
|
@@ -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.pre.beta1
|
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-10-28 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
|