jekyll-open-sdg-plugins 2.0.0 → 2.1.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/create_goals.rb +18 -3
- data/lib/jekyll-open-sdg-plugins/schema-indicator-config.json +118 -0
- data/lib/jekyll-open-sdg-plugins/schema-site-config.json +42 -0
- data/lib/jekyll-open-sdg-plugins/sdg_variables.rb +26 -0
- data/lib/jekyll-open-sdg-plugins/translate_key.rb +6 -0
- data/lib/jekyll-open-sdg-plugins/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b54675415b0bc48b5f88576abdf876b6914ac17ab88c5b510d1aadefe706f22
|
4
|
+
data.tar.gz: 37e98d01d30cda580a96562b1364c5f8788c34372497622ec3ad785568bd0a01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f024b94736c76f6c9aab3629abc27af6d12539f0610b0722af3fe8a8c43a41a9dc038ed9a9972621aedfcb562507a2c2e4b627d6545ba062cdb41f15780a144
|
7
|
+
data.tar.gz: 45ef81eac3af62ca2b61517489109e8c4ff925ac3c5bb24e600e47dd2858f43e329703004cc0e2662f5fc314c90a1531868e2c3ff7d534a1f3ccb181c63dac01
|
@@ -37,7 +37,13 @@ module JekyllOpenSdgPlugins
|
|
37
37
|
end
|
38
38
|
# Loop through the goals.
|
39
39
|
goal_index = 0
|
40
|
-
goals
|
40
|
+
# In the SDGs the goals are numeric, so try to sort them numerically.
|
41
|
+
begin
|
42
|
+
goals_sorted = goals.keys.sort_by { |k| k.to_i if Float(k) rescue k }
|
43
|
+
rescue
|
44
|
+
goals_sorted = goals.keys.sort
|
45
|
+
end
|
46
|
+
goals_sorted.each do |goal|
|
41
47
|
# Add the language subfolder for all except the default (first) language.
|
42
48
|
dir = index == 0 ? goal.to_s : File.join(language_public, goal.to_s)
|
43
49
|
# Create the goal page.
|
@@ -59,8 +65,17 @@ module JekyllOpenSdgPlugins
|
|
59
65
|
|
60
66
|
goal_content = ''
|
61
67
|
if site.config['create_goals'].has_key?('goals')
|
62
|
-
|
63
|
-
|
68
|
+
# Try to find goal content by match the goal ID with a "goal" property on each item
|
69
|
+
# in the create_goals.goals site config. Otherwise fallback to the order they appear
|
70
|
+
# in that list.
|
71
|
+
goal_by_goal = site.config['create_goals']['goals'].detect {|g| g['goal'].to_s == goal.to_s }
|
72
|
+
goal_by_index = site.config['create_goals']['goals'][goal_index]
|
73
|
+
if !goal_by_goal.nil?
|
74
|
+
goal_content = goal_by_goal['content']
|
75
|
+
elsif !goal_by_index.nil?
|
76
|
+
if !goal_by_index.has_key?('goal') || goal_by_index['goal'].to_s == goal.to_s
|
77
|
+
goal_content = goal_by_index['content']
|
78
|
+
end
|
64
79
|
end
|
65
80
|
end
|
66
81
|
@content = goal_content
|
@@ -690,6 +690,57 @@
|
|
690
690
|
}
|
691
691
|
]
|
692
692
|
},
|
693
|
+
"publications": {
|
694
|
+
"options": {"collapsed": true},
|
695
|
+
"type": "array",
|
696
|
+
"title": "Publications",
|
697
|
+
"description": "This setting controls the content of the 'Related publications' tab. It can contain any number of publications. You may have much of this information in the indicator metadata, but this configuration is available to supplement the metadata with a more structured way to list multiple publications.",
|
698
|
+
"items": {
|
699
|
+
"type": "object",
|
700
|
+
"title": "Publication",
|
701
|
+
"properties": {
|
702
|
+
"title": {
|
703
|
+
"type": "string",
|
704
|
+
"title": "Title"
|
705
|
+
},
|
706
|
+
"link": {
|
707
|
+
"type": "string",
|
708
|
+
"title": "Link"
|
709
|
+
},
|
710
|
+
"description": {
|
711
|
+
"type": "string",
|
712
|
+
"title": "description",
|
713
|
+
"format": "markdown"
|
714
|
+
},
|
715
|
+
"date": {
|
716
|
+
"type": "string",
|
717
|
+
"title": "Date"
|
718
|
+
}
|
719
|
+
}
|
720
|
+
},
|
721
|
+
"links": [
|
722
|
+
{
|
723
|
+
"rel": "More information on the publications setting",
|
724
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/indicator-configuration/#publications"
|
725
|
+
}
|
726
|
+
]
|
727
|
+
},
|
728
|
+
"related_indicators": {
|
729
|
+
"options": {"collapsed": true},
|
730
|
+
"type": "array",
|
731
|
+
"title": "Related indicators",
|
732
|
+
"description": "This setting controls the 'Related indicators' tab. Specify indicators by using their indicator numbers, such as: 1.1.1",
|
733
|
+
"items": {
|
734
|
+
"type": "string",
|
735
|
+
"title": "Related indicator"
|
736
|
+
},
|
737
|
+
"links": [
|
738
|
+
{
|
739
|
+
"rel": "More information on the related_indicators setting",
|
740
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/indicator-configuration/#related_indicators"
|
741
|
+
}
|
742
|
+
]
|
743
|
+
},
|
693
744
|
"reporting_status": {
|
694
745
|
"type": "string",
|
695
746
|
"title": "Reporting status",
|
@@ -713,6 +764,73 @@
|
|
713
764
|
}
|
714
765
|
]
|
715
766
|
},
|
767
|
+
"sources": {
|
768
|
+
"options": {"collapsed": true},
|
769
|
+
"type": "array",
|
770
|
+
"title": "Sources",
|
771
|
+
"description": "This setting controls the content of the 'Sources' tab. It can contain any number sources. You may have much of this information in the metadata, but this configuration is available to supplement the metadata with a more structured way to list multiple sources.",
|
772
|
+
"items": {
|
773
|
+
"type": "object",
|
774
|
+
"title": "Source",
|
775
|
+
"properties": {
|
776
|
+
"organisation": {
|
777
|
+
"type": "string",
|
778
|
+
"title": "Organisation"
|
779
|
+
},
|
780
|
+
"periodicity": {
|
781
|
+
"type": "string",
|
782
|
+
"title": "Periodicity"
|
783
|
+
},
|
784
|
+
"earliest_available": {
|
785
|
+
"type": "string",
|
786
|
+
"title": "Earliest available data"
|
787
|
+
},
|
788
|
+
"geographical_coverage": {
|
789
|
+
"type": "string",
|
790
|
+
"title": "Geographical coverage"
|
791
|
+
},
|
792
|
+
"url": {
|
793
|
+
"type": "string",
|
794
|
+
"title": "URL"
|
795
|
+
},
|
796
|
+
"url_text": {
|
797
|
+
"type": "string",
|
798
|
+
"title": "URL text"
|
799
|
+
},
|
800
|
+
"release_date": {
|
801
|
+
"type": "string",
|
802
|
+
"title": "Release date"
|
803
|
+
},
|
804
|
+
"next_release": {
|
805
|
+
"type": "string",
|
806
|
+
"title": "Next release"
|
807
|
+
},
|
808
|
+
"statistical_classification": {
|
809
|
+
"type": "string",
|
810
|
+
"title": "Statistical classification"
|
811
|
+
},
|
812
|
+
"contact": {
|
813
|
+
"type": "string",
|
814
|
+
"title": "Contact"
|
815
|
+
},
|
816
|
+
"other_info": {
|
817
|
+
"type": "string",
|
818
|
+
"title": "Other information",
|
819
|
+
"format": "markdown"
|
820
|
+
},
|
821
|
+
"logo": {
|
822
|
+
"type": "string",
|
823
|
+
"title": "Path to logo image"
|
824
|
+
}
|
825
|
+
}
|
826
|
+
},
|
827
|
+
"links": [
|
828
|
+
{
|
829
|
+
"rel": "More information on the sources setting",
|
830
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/indicator-configuration/#sources"
|
831
|
+
}
|
832
|
+
]
|
833
|
+
},
|
716
834
|
"standalone": {
|
717
835
|
"title": "Standalone indicator",
|
718
836
|
"type": "boolean",
|
@@ -131,6 +131,11 @@
|
|
131
131
|
"description": "This setting can be used to show navigation links to the previous/next goals.",
|
132
132
|
"format": "checkbox"
|
133
133
|
},
|
134
|
+
"goal_content_heading": {
|
135
|
+
"type": "string",
|
136
|
+
"title": "Goal content heading",
|
137
|
+
"description": "Text entered here will appear as an H2 heading above any content configured below in 'goals'."
|
138
|
+
},
|
134
139
|
"goals": {
|
135
140
|
"options": {"collapsed": true},
|
136
141
|
"type": "array",
|
@@ -145,6 +150,11 @@
|
|
145
150
|
"title": "Content",
|
146
151
|
"format": "markdown",
|
147
152
|
"description": "Markdown content or a translation key for this goal."
|
153
|
+
},
|
154
|
+
"goal": {
|
155
|
+
"type": "string",
|
156
|
+
"title": "Goal",
|
157
|
+
"description": "Optionally specify the goal ID this content applies to. Can be left blank if using the correct order of the goals (1, 2, 3, etc.)."
|
148
158
|
}
|
149
159
|
}
|
150
160
|
}
|
@@ -385,6 +395,17 @@
|
|
385
395
|
}
|
386
396
|
]
|
387
397
|
},
|
398
|
+
"empty_metadata_placeholder": {
|
399
|
+
"type": "string",
|
400
|
+
"title": "Empty metadata placeholder",
|
401
|
+
"description": "This setting controls the text that will display for any metadata field which has no content. Note that this is not used if 'hide_empty_metadata' is true.",
|
402
|
+
"links": [
|
403
|
+
{
|
404
|
+
"rel": "More information on the empty metadata placeholder setting",
|
405
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#empty_metadata_placeholder"
|
406
|
+
}
|
407
|
+
]
|
408
|
+
},
|
388
409
|
"environment": {
|
389
410
|
"type": "string",
|
390
411
|
"minLength": 1,
|
@@ -667,6 +688,22 @@
|
|
667
688
|
}
|
668
689
|
]
|
669
690
|
},
|
691
|
+
"ignored_disaggregations": {
|
692
|
+
"options": {"collapsed": true},
|
693
|
+
"type": "array",
|
694
|
+
"title": "Ignored disaggregations",
|
695
|
+
"description": "An optional list of data columns that should not appear as disaggregation drop-downs in the left sidebar.",
|
696
|
+
"items": {
|
697
|
+
"type": "string",
|
698
|
+
"title": "Ignored disaggregation"
|
699
|
+
},
|
700
|
+
"links": [
|
701
|
+
{
|
702
|
+
"rel": "More information on the ignored_disaggregations setting",
|
703
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#ignored_disaggregations"
|
704
|
+
}
|
705
|
+
]
|
706
|
+
},
|
670
707
|
"indicator_config_form": {
|
671
708
|
"options": {"collapsed": true},
|
672
709
|
"type": "object",
|
@@ -1120,6 +1157,11 @@
|
|
1120
1157
|
"type": "string",
|
1121
1158
|
"description": "A heading to display before the progress status on indicator pages."
|
1122
1159
|
},
|
1160
|
+
"status_help": {
|
1161
|
+
"title": "Status help",
|
1162
|
+
"type": "string",
|
1163
|
+
"description": "An explanatory column header above the progress status on goal pages."
|
1164
|
+
},
|
1123
1165
|
"status_types": {
|
1124
1166
|
"options": {"collapsed": true},
|
1125
1167
|
"type": "array",
|
@@ -433,6 +433,32 @@ module JekyllOpenSdgPlugins
|
|
433
433
|
available_indicator[key] = opensdg_translate_key(value, translations, language)
|
434
434
|
end
|
435
435
|
end
|
436
|
+
# Translate the ignored_disaggregations site configuration for this particular indicator.
|
437
|
+
if site.config.has_key?('ignored_disaggregations') && site.config['ignored_disaggregations'].is_a?(Array)
|
438
|
+
translated_ignored_disaggregations = []
|
439
|
+
site.config['ignored_disaggregations'].each do |key|
|
440
|
+
translated = opensdg_translate_key(key, translations, language)
|
441
|
+
if translated == key && key.is_a?(String)
|
442
|
+
# If no translation happened, also try the SDMX convention of using the dimension code
|
443
|
+
# for both the "translation group" and the "translation key". Eg, "OBS_STATUS.OBS_STATUS"
|
444
|
+
sdmx_key = key + '.' + key
|
445
|
+
sdmx_translation = opensdg_translate_key(sdmx_key, translations, language)
|
446
|
+
if sdmx_translation != sdmx_key
|
447
|
+
translated = sdmx_translation
|
448
|
+
else
|
449
|
+
# If still no translation happened, also try the "data" translation group.
|
450
|
+
data_key = 'data.' + key
|
451
|
+
data_translation = opensdg_translate_key(data_key, translations, language)
|
452
|
+
if data_translation != data_key
|
453
|
+
translated = data_translation
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
translated_ignored_disaggregations.push(translated)
|
458
|
+
end
|
459
|
+
available_indicator['ignored_disaggregations'] = translated_ignored_disaggregations
|
460
|
+
end
|
461
|
+
|
436
462
|
available_indicators[language].push(available_indicator)
|
437
463
|
end
|
438
464
|
end
|
@@ -13,6 +13,12 @@ module Jekyll
|
|
13
13
|
translations = site.data['translations']
|
14
14
|
language = @context.environments.first["page"]['language']
|
15
15
|
translated = opensdg_translate_key(key, translations, language)
|
16
|
+
|
17
|
+
# Stop now if we do not have a string.
|
18
|
+
unless translated.is_a?(String)
|
19
|
+
return translated
|
20
|
+
end
|
21
|
+
|
16
22
|
# Also look for references to site configuration within the translation,
|
17
23
|
# as "%" parameters.
|
18
24
|
translated = translated.gsub(/%([a-zA-Z0-9_.]+)/) do |match|
|
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: 2.0.
|
4
|
+
version: 2.1.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: 2022-
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -102,9 +102,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
|
-
- - "
|
105
|
+
- - ">"
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
version:
|
107
|
+
version: 1.3.1
|
108
108
|
requirements: []
|
109
109
|
rubygems_version: 3.0.9
|
110
110
|
signing_key:
|