jekyll-open-sdg-plugins 1.2.0.pre.beta6 → 1.4.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.rb +1 -0
- data/lib/jekyll-open-sdg-plugins/create_goals.rb +3 -0
- data/lib/jekyll-open-sdg-plugins/create_indicators.rb +135 -19
- data/lib/jekyll-open-sdg-plugins/create_pages.rb +20 -5
- data/lib/jekyll-open-sdg-plugins/fetch_remote_data.rb +3 -2
- data/lib/jekyll-open-sdg-plugins/metadata_schema_to_config.rb +72 -0
- data/lib/jekyll-open-sdg-plugins/schema-indicator-config.json +226 -152
- data/lib/jekyll-open-sdg-plugins/schema-site-config.json +280 -33
- data/lib/jekyll-open-sdg-plugins/sdg_variables.rb +78 -9
- data/lib/jekyll-open-sdg-plugins/site_configuration.rb +9 -0
- data/lib/jekyll-open-sdg-plugins/translate_date.rb +25 -1
- data/lib/jekyll-open-sdg-plugins/version.rb +1 -1
- data/tests/_config.yml +10 -0
- metadata +3 -2
@@ -87,6 +87,25 @@
|
|
87
87
|
}
|
88
88
|
]
|
89
89
|
},
|
90
|
+
"contrast_type": {
|
91
|
+
"type": "string",
|
92
|
+
"title": "Contrast type",
|
93
|
+
"description": "The type of high-contrast toggle to use.",
|
94
|
+
"enum": ["default", "single", "long"],
|
95
|
+
"options": {
|
96
|
+
"enum_titles": [
|
97
|
+
"Default - two 'A' buttons side-by-side",
|
98
|
+
"Single - one 'A' button which toggles on/off",
|
99
|
+
"Long - text toggling between 'High contrast' and 'Default contrast'"
|
100
|
+
]
|
101
|
+
},
|
102
|
+
"links": [
|
103
|
+
{
|
104
|
+
"rel": "More information on the contrast type setting",
|
105
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#contrast_type"
|
106
|
+
}
|
107
|
+
]
|
108
|
+
},
|
90
109
|
"country": {
|
91
110
|
"options": {"collapsed": true},
|
92
111
|
"type": "object",
|
@@ -113,35 +132,6 @@
|
|
113
132
|
}
|
114
133
|
]
|
115
134
|
},
|
116
|
-
"create_config_forms": {
|
117
|
-
"options": {"collapsed": true},
|
118
|
-
"type": "object",
|
119
|
-
"title": "Create configuration forms",
|
120
|
-
"description": "This setting can be used to automatically create the configuration form pages.",
|
121
|
-
"properties": {
|
122
|
-
"layout": {
|
123
|
-
"type": "string",
|
124
|
-
"title": "Layout",
|
125
|
-
"enum": [
|
126
|
-
"",
|
127
|
-
"config-builder"
|
128
|
-
],
|
129
|
-
"options": {
|
130
|
-
"enum_titles": [
|
131
|
-
"Do not automatically create config forms",
|
132
|
-
"config-builder"
|
133
|
-
]
|
134
|
-
},
|
135
|
-
"description": "The layout to use for the configuration form pages."
|
136
|
-
}
|
137
|
-
},
|
138
|
-
"links": [
|
139
|
-
{
|
140
|
-
"rel": "More information on the create config forms setting",
|
141
|
-
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#create_config_forms"
|
142
|
-
}
|
143
|
-
]
|
144
|
-
},
|
145
135
|
"create_goals": {
|
146
136
|
"options": {"collapsed": true},
|
147
137
|
"type": "object",
|
@@ -167,6 +157,12 @@
|
|
167
157
|
},
|
168
158
|
"description": "The layout to use for the goal pages."
|
169
159
|
},
|
160
|
+
"previous_next_links": {
|
161
|
+
"title": "Previous/next links",
|
162
|
+
"type": "boolean",
|
163
|
+
"description": "This setting can be used to show navigation links to the previous/next goals.",
|
164
|
+
"format": "checkbox"
|
165
|
+
},
|
170
166
|
"goals": {
|
171
167
|
"options": {"collapsed": true},
|
172
168
|
"type": "array",
|
@@ -213,6 +209,12 @@
|
|
213
209
|
]
|
214
210
|
},
|
215
211
|
"description": "The layout to use for the indicator pages."
|
212
|
+
},
|
213
|
+
"previous_next_links": {
|
214
|
+
"title": "Previous/next links",
|
215
|
+
"type": "boolean",
|
216
|
+
"description": "This setting can be used to show navigation links to the previous/next indicators.",
|
217
|
+
"format": "checkbox"
|
216
218
|
}
|
217
219
|
},
|
218
220
|
"links": [
|
@@ -306,6 +308,30 @@
|
|
306
308
|
}
|
307
309
|
]
|
308
310
|
},
|
311
|
+
"data_fields": {
|
312
|
+
"options": {"collapsed": true},
|
313
|
+
"type": "object",
|
314
|
+
"title": "Data fields",
|
315
|
+
"description": "Control the names of fields used for special purposes in data.",
|
316
|
+
"properties": {
|
317
|
+
"units": {
|
318
|
+
"type": "string",
|
319
|
+
"title": "Units",
|
320
|
+
"description": "Field to reserve for units of measurement. Defaults to 'Units'."
|
321
|
+
},
|
322
|
+
"series": {
|
323
|
+
"type": "string",
|
324
|
+
"title": "Series",
|
325
|
+
"description": "Field to reserve for the SDG series. Defaults to 'Series'."
|
326
|
+
}
|
327
|
+
},
|
328
|
+
"links": [
|
329
|
+
{
|
330
|
+
"rel": "More information on the data fields setting",
|
331
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#data_fields"
|
332
|
+
}
|
333
|
+
]
|
334
|
+
},
|
309
335
|
"date_formats": {
|
310
336
|
"options": {"collapsed": true},
|
311
337
|
"type": "array",
|
@@ -575,12 +601,40 @@
|
|
575
601
|
}
|
576
602
|
]
|
577
603
|
},
|
604
|
+
"graph_color_headline": {
|
605
|
+
"type": "string",
|
606
|
+
"format": "color",
|
607
|
+
"title": "Graph color for headline",
|
608
|
+
"default": "#004466",
|
609
|
+
"description": "This setting can be used to customize the color used in the chart 'headlines'.",
|
610
|
+
"examples": [],
|
611
|
+
"links": [
|
612
|
+
{
|
613
|
+
"rel": "More information on the graph color headline setting",
|
614
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#graph_color_headline"
|
615
|
+
}
|
616
|
+
]
|
617
|
+
},
|
618
|
+
"graph_color_headline_high_contrast": {
|
619
|
+
"type": "string",
|
620
|
+
"format": "color",
|
621
|
+
"title": "Graph color for headline - high-contrast",
|
622
|
+
"default": "#55a6e5",
|
623
|
+
"description": "This setting can be used to customize the color used in the chart 'headlines' in high-contrast mode.",
|
624
|
+
"examples": [],
|
625
|
+
"links": [
|
626
|
+
{
|
627
|
+
"rel": "More information on the graph color headline high-contrast setting",
|
628
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#graph_color_headline_high_contrast"
|
629
|
+
}
|
630
|
+
]
|
631
|
+
},
|
578
632
|
"graph_color_set": {
|
579
633
|
"type": "string",
|
580
634
|
"title": "Graph color set",
|
581
635
|
"description": "This setting can be used to customize the color set used in the charts.",
|
582
636
|
"examples": [],
|
583
|
-
"enum": ["default", "sdg", "goal", "custom"],
|
637
|
+
"enum": ["default", "accessible", "sdg", "goal", "custom"],
|
584
638
|
"links": [
|
585
639
|
{
|
586
640
|
"rel": "More information on the graph color set setting",
|
@@ -617,6 +671,47 @@
|
|
617
671
|
}
|
618
672
|
]
|
619
673
|
},
|
674
|
+
"graph_title_from_series": {
|
675
|
+
"title": "Graph title from series",
|
676
|
+
"type": "boolean",
|
677
|
+
"description": "This setting can be set to `true` to use the selected series for the graph title, whenever possible.",
|
678
|
+
"format": "checkbox",
|
679
|
+
"links": [
|
680
|
+
{
|
681
|
+
"rel": "More information on the graph title from series setting",
|
682
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#graph_title_from_series"
|
683
|
+
}
|
684
|
+
]
|
685
|
+
},
|
686
|
+
"header": {
|
687
|
+
"options": {"collapsed": true},
|
688
|
+
"type": "object",
|
689
|
+
"title": "Header",
|
690
|
+
"description": "This setting can be used to customise the header.",
|
691
|
+
"properties": {
|
692
|
+
"include": {
|
693
|
+
"type": "string",
|
694
|
+
"title": "Include file",
|
695
|
+
"enum": [
|
696
|
+
"header-default.html",
|
697
|
+
"header-menu-left-aligned.html"
|
698
|
+
],
|
699
|
+
"options": {
|
700
|
+
"enum_titles": [
|
701
|
+
"Default header",
|
702
|
+
"Menu left-aligned"
|
703
|
+
]
|
704
|
+
},
|
705
|
+
"description": "The header style to use on all pages."
|
706
|
+
}
|
707
|
+
},
|
708
|
+
"links": [
|
709
|
+
{
|
710
|
+
"rel": "More information on the header setting",
|
711
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#header"
|
712
|
+
}
|
713
|
+
]
|
714
|
+
},
|
620
715
|
"header_language_toggle": {
|
621
716
|
"type": "string",
|
622
717
|
"title": "Header language toggle",
|
@@ -648,6 +743,69 @@
|
|
648
743
|
"description": "Configuration of the indicator configuration form.",
|
649
744
|
"$ref": "#/definitions/config_form_options"
|
650
745
|
},
|
746
|
+
"indicator_data_form": {
|
747
|
+
"options": {"collapsed": true},
|
748
|
+
"type": "object",
|
749
|
+
"title": "Indicator data form",
|
750
|
+
"description": "Configuration of the indicator data form.",
|
751
|
+
"properties": {
|
752
|
+
"enabled": {
|
753
|
+
"type": "boolean",
|
754
|
+
"title": "Enable this type of form",
|
755
|
+
"description": "If enabled, the indicator data form will be available.",
|
756
|
+
"format": "checkbox"
|
757
|
+
},
|
758
|
+
"repository_link": {
|
759
|
+
"type": "string",
|
760
|
+
"title": "Repository link",
|
761
|
+
"description": "The URL pattern of the 'Go to repository' link on the configuration page."
|
762
|
+
}
|
763
|
+
}
|
764
|
+
},
|
765
|
+
"indicator_metadata_form": {
|
766
|
+
"options": {"collapsed": true},
|
767
|
+
"type": "object",
|
768
|
+
"title": "Indicator metadata form",
|
769
|
+
"description": "Configuration of the indicator metadata form.",
|
770
|
+
"allOf": [
|
771
|
+
{ "$ref": "#/definitions/config_form_options" },
|
772
|
+
{
|
773
|
+
"properties": {
|
774
|
+
"language": {
|
775
|
+
"type": "string",
|
776
|
+
"title": "Language for editing",
|
777
|
+
"description": "Choose the language you prefer when editing metadata. This is used to translate the labels of the metadata fields."
|
778
|
+
},
|
779
|
+
"scopes": {
|
780
|
+
"options": {"collapsed": true},
|
781
|
+
"type": "array",
|
782
|
+
"title": "Metadata scopes",
|
783
|
+
"description": "Specify the 'scopes' of metadata to include on the form. Eg: 'national' or 'global'.",
|
784
|
+
"items": {
|
785
|
+
"type": "string",
|
786
|
+
"title": "Scope"
|
787
|
+
}
|
788
|
+
},
|
789
|
+
"exclude_fields": {
|
790
|
+
"options": {"collapsed": true},
|
791
|
+
"type": "array",
|
792
|
+
"title": "Exclude fields",
|
793
|
+
"description": "Specify any fields you would like to exclude from the form.",
|
794
|
+
"items": {
|
795
|
+
"type": "string",
|
796
|
+
"title": "Field"
|
797
|
+
}
|
798
|
+
},
|
799
|
+
"translated": {
|
800
|
+
"type": "boolean",
|
801
|
+
"title": "Display translated contents in the form",
|
802
|
+
"description": "This should only be enabled if you are using the 'subfolder' approach for your metadata.",
|
803
|
+
"format": "checkbox"
|
804
|
+
}
|
805
|
+
}
|
806
|
+
}
|
807
|
+
]
|
808
|
+
},
|
651
809
|
"languages": {
|
652
810
|
"options": {"collapsed": true},
|
653
811
|
"type": "array",
|
@@ -696,6 +854,41 @@
|
|
696
854
|
}
|
697
855
|
]
|
698
856
|
},
|
857
|
+
"logos": {
|
858
|
+
"options": {"collapsed": true},
|
859
|
+
"type": "array",
|
860
|
+
"title": "Logos",
|
861
|
+
"description": "This setting can be used to control the main logo (or logos).",
|
862
|
+
"items": {
|
863
|
+
"type": "object",
|
864
|
+
"title": "Logo",
|
865
|
+
"properties": {
|
866
|
+
"language": {
|
867
|
+
"type": "string",
|
868
|
+
"title": "Language",
|
869
|
+
"description": "The language on which this logo displays. Leave blank to show on all."
|
870
|
+
},
|
871
|
+
"src": {
|
872
|
+
"type": "string",
|
873
|
+
"minLength": 1,
|
874
|
+
"title": "Image file",
|
875
|
+
"description": "The image file (path or URL) for this logo"
|
876
|
+
},
|
877
|
+
"alt": {
|
878
|
+
"type": "string",
|
879
|
+
"minLength": 1,
|
880
|
+
"title": "Alt text",
|
881
|
+
"description": "The alt text for this logo"
|
882
|
+
}
|
883
|
+
}
|
884
|
+
},
|
885
|
+
"links": [
|
886
|
+
{
|
887
|
+
"rel": "More information on the logos setting",
|
888
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#logos"
|
889
|
+
}
|
890
|
+
]
|
891
|
+
},
|
699
892
|
"map_layers": {
|
700
893
|
"options": {"collapsed": true},
|
701
894
|
"type": "array",
|
@@ -855,7 +1048,23 @@
|
|
855
1048
|
"title": "Main menu",
|
856
1049
|
"description": "The links to display in the main menu.",
|
857
1050
|
"items": {
|
858
|
-
"
|
1051
|
+
"title": "Menu item",
|
1052
|
+
"allOf": [
|
1053
|
+
{ "$ref": "#/definitions/menu_item" },
|
1054
|
+
{
|
1055
|
+
"properties": {
|
1056
|
+
"dropdown": {
|
1057
|
+
"title": "Dropdown menu",
|
1058
|
+
"type": "array",
|
1059
|
+
"description": "Enter menu items here to turn this into a dropdown.",
|
1060
|
+
"items": {
|
1061
|
+
"$ref": "#/definitions/menu_item",
|
1062
|
+
"title": "Dropdown menu item"
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
]
|
859
1068
|
},
|
860
1069
|
"links": [
|
861
1070
|
{
|
@@ -946,8 +1155,8 @@
|
|
946
1155
|
"remote_data_prefix": {
|
947
1156
|
"type": "string",
|
948
1157
|
"minLength": 1,
|
949
|
-
"title": "Remote data
|
950
|
-
"description": "Specify the URL of your
|
1158
|
+
"title": "Remote data prefix",
|
1159
|
+
"description": "Specify the URL of the 'data service' that is generated from your data repository.",
|
951
1160
|
"links": [
|
952
1161
|
{
|
953
1162
|
"rel": "More information on the remote data prefix setting",
|
@@ -980,6 +1189,28 @@
|
|
980
1189
|
}
|
981
1190
|
]
|
982
1191
|
},
|
1192
|
+
"repository_url_data": {
|
1193
|
+
"type": "string",
|
1194
|
+
"title": "Repository URL - Data",
|
1195
|
+
"description": "The URL of your data repository, eg: https://github.com/my-github-org/data",
|
1196
|
+
"links": [
|
1197
|
+
{
|
1198
|
+
"rel": "More information on the data repository URL setting",
|
1199
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#repository_url_data"
|
1200
|
+
}
|
1201
|
+
]
|
1202
|
+
},
|
1203
|
+
"repository_url_site": {
|
1204
|
+
"type": "string",
|
1205
|
+
"title": "Repository URL - Site",
|
1206
|
+
"description": "The URL of your site repository, eg: https://github.com/my-github-org/site",
|
1207
|
+
"links": [
|
1208
|
+
{
|
1209
|
+
"rel": "More information on the site repository URL setting",
|
1210
|
+
"href": "https://open-sdg.readthedocs.io/en/latest/configuration/#repository_url_site"
|
1211
|
+
}
|
1212
|
+
]
|
1213
|
+
},
|
983
1214
|
"search_index_boost": {
|
984
1215
|
"options": {"collapsed": true},
|
985
1216
|
"type": "array",
|
@@ -1166,6 +1397,12 @@
|
|
1166
1397
|
"config_form_options": {
|
1167
1398
|
"type": "object",
|
1168
1399
|
"properties": {
|
1400
|
+
"enabled": {
|
1401
|
+
"type": "boolean",
|
1402
|
+
"title": "Enable this type of form",
|
1403
|
+
"description": "If enabled, this type of configuration form will be available.",
|
1404
|
+
"format": "checkbox"
|
1405
|
+
},
|
1169
1406
|
"dropdowns": {
|
1170
1407
|
"type": "array",
|
1171
1408
|
"title": "Dropdown lists",
|
@@ -1199,6 +1436,16 @@
|
|
1199
1436
|
}
|
1200
1437
|
}
|
1201
1438
|
}
|
1439
|
+
},
|
1440
|
+
"repository_link": {
|
1441
|
+
"type": "string",
|
1442
|
+
"title": "Repository link",
|
1443
|
+
"description": "The URL pattern of the 'Go to repository' link on the configuration page."
|
1444
|
+
},
|
1445
|
+
"translation_link": {
|
1446
|
+
"type": "string",
|
1447
|
+
"title": "Translation link",
|
1448
|
+
"description": "The URL pattern for all 'Go to translation' links on the configuration page."
|
1202
1449
|
}
|
1203
1450
|
}
|
1204
1451
|
}
|
@@ -15,7 +15,11 @@ module JekyllOpenSdgPlugins
|
|
15
15
|
# Get a target number from an indicator number.
|
16
16
|
def get_target_number(indicator_number)
|
17
17
|
parts = indicator_number.split('.')
|
18
|
-
parts
|
18
|
+
if parts.length() < 2
|
19
|
+
indicator_number
|
20
|
+
else
|
21
|
+
parts[0] + '.' + parts[1]
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
# Is this string numeric?
|
@@ -43,10 +47,28 @@ module JekyllOpenSdgPlugins
|
|
43
47
|
sort_order
|
44
48
|
end
|
45
49
|
|
50
|
+
# Get previous item from an array, or loop to the end.
|
51
|
+
def get_previous_item(list, index)
|
52
|
+
decremented = index - 1
|
53
|
+
if decremented < 0
|
54
|
+
decremented = list.length() - 1
|
55
|
+
end
|
56
|
+
list[decremented]
|
57
|
+
end
|
58
|
+
|
59
|
+
# Get next item from an array, or loop to the beginning.
|
60
|
+
def get_next_item(list, index)
|
61
|
+
incremented = index + 1
|
62
|
+
if incremented >= list.length()
|
63
|
+
incremented = 0
|
64
|
+
end
|
65
|
+
list[incremented]
|
66
|
+
end
|
67
|
+
|
46
68
|
# The Jekyll baseurl is user-configured, and can be inconsistent. This
|
47
69
|
# ensure it is consistent in whether it starts/ends with a slash.
|
48
70
|
def normalize_baseurl(baseurl)
|
49
|
-
if baseurl == ''
|
71
|
+
if baseurl == '' || baseurl.nil?
|
50
72
|
baseurl = '/'
|
51
73
|
end
|
52
74
|
if !baseurl.start_with? '/'
|
@@ -170,7 +192,7 @@ module JekyllOpenSdgPlugins
|
|
170
192
|
goal_image_base = site.config['goal_image_base']
|
171
193
|
end
|
172
194
|
goal_image_extension = 'png'
|
173
|
-
if site.config.has_key? 'goal_image_extension'
|
195
|
+
if site.config.has_key?('goal_image_extension') && site.config['goal_image_extension'] != ''
|
174
196
|
goal_image_extension = site.config['goal_image_extension']
|
175
197
|
end
|
176
198
|
|
@@ -209,6 +231,7 @@ module JekyllOpenSdgPlugins
|
|
209
231
|
goal_number = get_goal_number(indicator_number)
|
210
232
|
target_number = get_target_number(indicator_number)
|
211
233
|
is_global_indicator = global_inids.index(indicator_number) != nil
|
234
|
+
|
212
235
|
# To get the name of global stuff, we can use predicable translation
|
213
236
|
# keys from the SDG Translations project. Eg: global_goals.1-title
|
214
237
|
goal_translation_key = 'global_goals.' + goal_number
|
@@ -253,8 +276,10 @@ module JekyllOpenSdgPlugins
|
|
253
276
|
end
|
254
277
|
end
|
255
278
|
|
279
|
+
is_standalone = (meta.has_key?('standalone') and meta['standalone'])
|
280
|
+
|
256
281
|
# Set the goal for this language, once only.
|
257
|
-
if already_added[language].index(goal_number) == nil
|
282
|
+
if !is_standalone && already_added[language].index(goal_number) == nil
|
258
283
|
already_added[language].push(goal_number)
|
259
284
|
available_goal = {
|
260
285
|
'number' => goal_number,
|
@@ -269,7 +294,7 @@ module JekyllOpenSdgPlugins
|
|
269
294
|
available_goals[language].push(available_goal)
|
270
295
|
end
|
271
296
|
# Set the target for this language, once only.
|
272
|
-
if already_added[language].index(target_number) == nil
|
297
|
+
if !is_standalone && already_added[language].index(target_number) == nil
|
273
298
|
already_added[language].push(target_number)
|
274
299
|
available_target = {
|
275
300
|
'number' => target_number,
|
@@ -293,12 +318,21 @@ module JekyllOpenSdgPlugins
|
|
293
318
|
else
|
294
319
|
indicator_name = meta['indicator_name']
|
295
320
|
end
|
321
|
+
indicator_path = indicator_number
|
322
|
+
if is_standalone && meta.has_key?('permalink') && meta['permalink'] != ''
|
323
|
+
indicator_path = meta['permalink']
|
324
|
+
end
|
325
|
+
indicator_sort = get_sort_order(indicator_number)
|
326
|
+
if meta.has_key?('sort') && meta['sort'] != ''
|
327
|
+
# Allow metadata 'sort' field to override the default sort.
|
328
|
+
indicator_sort = meta['sort']
|
329
|
+
end
|
296
330
|
available_indicator = {
|
297
331
|
'number' => indicator_number,
|
298
332
|
'slug' => indicator_number.gsub('.', '-'),
|
299
333
|
'name' => opensdg_translate_key(indicator_name, translations, language),
|
300
|
-
'url' => get_url(baseurl, language,
|
301
|
-
'sort' =>
|
334
|
+
'url' => get_url(baseurl, language, indicator_path, languages, languages_public),
|
335
|
+
'sort' => indicator_sort,
|
302
336
|
'goal_number' => goal_number,
|
303
337
|
'target_number' => target_number,
|
304
338
|
'global' => global_indicator,
|
@@ -353,8 +387,36 @@ module JekyllOpenSdgPlugins
|
|
353
387
|
doc.data['remote_data_prefix'] = normalize_baseurl(baseurl)
|
354
388
|
end
|
355
389
|
if opensdg_translated_builds(site)
|
390
|
+
doc.data['remote_data_prefix_untranslated'] = File.join(doc.data['remote_data_prefix'], 'untranslated')
|
356
391
|
doc.data['remote_data_prefix'] = File.join(doc.data['remote_data_prefix'], language)
|
392
|
+
else
|
393
|
+
doc.data['remote_data_prefix_untranslated'] = doc.data['remote_data_prefix']
|
394
|
+
end
|
395
|
+
|
396
|
+
# Set the logo for this page.
|
397
|
+
logo = {}
|
398
|
+
match = false
|
399
|
+
if site.config.has_key?('logos') && site.config['logos'].length > 0
|
400
|
+
match = site.config['logos'].find{ |item| item['language'] == language }
|
401
|
+
unless match
|
402
|
+
match = site.config['logos'].find{ |item| item.fetch('language', '') == '' }
|
403
|
+
end
|
357
404
|
end
|
405
|
+
if match
|
406
|
+
src = match['src']
|
407
|
+
unless src.start_with?('http')
|
408
|
+
src = normalize_baseurl(baseurl) + src
|
409
|
+
end
|
410
|
+
logo['src'] = src
|
411
|
+
logo['alt'] = opensdg_translate_key(match['alt'], translations, language)
|
412
|
+
else
|
413
|
+
logo['src'] = normalize_baseurl(baseurl) + 'assets/img/SDG_logo.png'
|
414
|
+
alt_text = opensdg_translate_key('general.sdg', translations, language)
|
415
|
+
alt_text += ' - '
|
416
|
+
alt_text += opensdg_translate_key('header.tag_line', translations, language)
|
417
|
+
logo['alt'] = alt_text
|
418
|
+
end
|
419
|
+
doc.data['logo'] = logo
|
358
420
|
|
359
421
|
if collection == 'indicators'
|
360
422
|
# For indicators we also set the current indicator/target/goal.
|
@@ -374,7 +436,11 @@ module JekyllOpenSdgPlugins
|
|
374
436
|
target_number = get_target_number(indicator_number)
|
375
437
|
doc.data['goal'] = available_goals[language].find {|x| x['number'] == goal_number}
|
376
438
|
doc.data['target'] = available_targets[language].find {|x| x['number'] == target_number}
|
377
|
-
|
439
|
+
indicator_index = available_indicators[language].find_index {|x| x['number'] == indicator_number}
|
440
|
+
doc.data['indicator'] = available_indicators[language][indicator_index]
|
441
|
+
doc.data['next'] = get_next_item(available_indicators[language], indicator_index)
|
442
|
+
doc.data['previous'] = get_previous_item(available_indicators[language], indicator_index)
|
443
|
+
|
378
444
|
elsif collection == 'goals'
|
379
445
|
# For goals we also set the current goal.
|
380
446
|
if doc.data.has_key? 'goal_number'
|
@@ -389,7 +455,10 @@ module JekyllOpenSdgPlugins
|
|
389
455
|
if goal_number.is_a? Numeric
|
390
456
|
goal_number = goal_number.to_s
|
391
457
|
end
|
392
|
-
|
458
|
+
goal_index = available_goals[language].find_index {|x| x['number'] == goal_number}
|
459
|
+
doc.data['goal'] = available_goals[language][goal_index]
|
460
|
+
doc.data['next'] = get_next_item(available_goals[language], goal_index)
|
461
|
+
doc.data['previous'] = get_previous_item(available_goals[language], goal_index)
|
393
462
|
end
|
394
463
|
end
|
395
464
|
end
|