jekyll-open-sdg-plugins 1.2.0 → 1.3.0.pre.beta1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2c1ce04469e6f2a44c30979e06c5a2782bb2fc0468baa4eb7d8521e4d87750d
4
- data.tar.gz: 452f3790764b11cfe9934fb95f310f294b4c8ecca7b200d916b64e85e0354a43
3
+ metadata.gz: 1579412cd0fc422e1af1ee418f9dcf89d10a8491ff0ce362c269ca49ad3b8f9d
4
+ data.tar.gz: c67a8ba97b93d0264e28f9cd764cd90f6a7db755ad10e1e5823a1cd4a25b927d
5
5
  SHA512:
6
- metadata.gz: 9e6baf613af1260e093345739182b08d84d41008495bb2e224b0b4181cb086348636277bbc16e0fe9b67f3d94ca2dae93c84609de49b52c03dc3477b11e818e2
7
- data.tar.gz: 6be0fc2e582b7fa8dfb1c945f656ea9220b6d1e277e8953b3d6ab4b6f4a8ac0f66b4d255f2a3b12814343a030ea71789c93441f1f7cb3098634ce5425e66ef5e
6
+ metadata.gz: 77a40b3a54553c73cc1ff3a560310f97e709b94be07c1b539ed92b0423803ba628454484b3910dc62b4175463fd520c7cd4c5a90c9f051cb6fde6bf6842c6f2a
7
+ data.tar.gz: d556a58a95a4627a25d947c8dd66470b3f3a580f56baa3c86da25b2b82499a5913a4ef3ec42083676cf7b7e3dffd2f8c9b944a8499e9492ab00a64d6ab0d1191
@@ -23,6 +23,9 @@ module JekyllOpenSdgPlugins
23
23
  metadata = site.data['meta']
24
24
  end
25
25
  metadata.each do |inid, indicator|
26
+ if indicator.has_key?('standalone') and indicator['standalone']
27
+ next
28
+ end
26
29
  goal = inid.split('-')[0].to_i
27
30
  goals[goal] = true
28
31
  end
@@ -34,8 +34,13 @@ module JekyllOpenSdgPlugins
34
34
  end
35
35
  # Loop through the indicators (using metadata as a list).
36
36
  metadata.each do |inid, meta|
37
+ permalink = inid
38
+ if meta.has_key?('permalink') and meta['permalink'] != ''
39
+ permalink = meta['permalink']
40
+ end
37
41
  # Add the language subfolder for all except the default (first) language.
38
- dir = index == 0 ? inid : File.join(language_public, inid)
42
+ dir = index == 0 ? permalink : File.join(language_public, permalink)
43
+
39
44
  # Create the indicator page.
40
45
  site.collections['indicators'].docs << IndicatorPage.new(site, site.source, dir, inid, language, layout)
41
46
  end
@@ -64,9 +69,13 @@ module JekyllOpenSdgPlugins
64
69
  language_public = languages_public[language]
65
70
  end
66
71
  metadata.each do |inid, meta|
67
- dir = File.join('config', inid)
72
+ permalink = inid
73
+ if meta.has_key?('permalink') and meta['permalink'] != ''
74
+ permalink = meta['permalink']
75
+ end
76
+ dir = File.join('config', permalink)
68
77
  if index != 0
69
- dir = File.join(language_public, 'config', inid)
78
+ dir = File.join(language_public, 'config', permalink)
70
79
  end
71
80
  site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, meta, layout)
72
81
  end
@@ -3,6 +3,17 @@
3
3
  "title": "Open SDG indicator configuration",
4
4
  "description": "This form will produce an indicator's configuration for your Open SDG implementation.",
5
5
  "properties": {
6
+ "composite_breakdown_label": {
7
+ "type": "string",
8
+ "title": "Composite breakdown label",
9
+ "description": "Used as a label for the COMPOSITE_BREAKDOWN column, if it appears in the indicator data.",
10
+ "links": [
11
+ {
12
+ "rel": "More information on the composite breakdown label setting",
13
+ "href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#composite-breakdown-label"
14
+ }
15
+ ]
16
+ },
6
17
  "computation_units": {
7
18
  "type": "string",
8
19
  "title": "Unit of measurement",
@@ -492,6 +503,17 @@
492
503
  "title": "Page content",
493
504
  "description": "Content which displays in the main content area of the indicator page."
494
505
  },
506
+ "permalink": {
507
+ "type": "string",
508
+ "title": "Permalink",
509
+ "description": "Overrides the normal path of the indicator page. Not recommended, execpt for 'standalone' indicators.",
510
+ "links": [
511
+ {
512
+ "rel": "More information the permalink setting",
513
+ "href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#standalone-indicators"
514
+ }
515
+ ]
516
+ },
495
517
  "reporting_status": {
496
518
  "type": "string",
497
519
  "title": "Reporting status",
@@ -504,6 +526,29 @@
504
526
  }
505
527
  ]
506
528
  },
529
+ "sort": {
530
+ "type": "string",
531
+ "title": "Sort order",
532
+ "description": "Override the default order in which this indicator is displayed in lists. This can be left blank, and it will be automatically determined.",
533
+ "links": [
534
+ {
535
+ "rel": "More information on the sort setting",
536
+ "href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#sorting-in-lists"
537
+ }
538
+ ]
539
+ },
540
+ "standalone": {
541
+ "title": "Standalone indicator",
542
+ "type": "boolean",
543
+ "description": "Whether the indicator is standalone (separate from the SDGs) or not.",
544
+ "format": "checkbox",
545
+ "links": [
546
+ {
547
+ "rel": "More information the standalone setting",
548
+ "href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#standalone-indicators"
549
+ }
550
+ ]
551
+ },
507
552
  "tags": {
508
553
  "options": {"collapsed": true},
509
554
  "type": "array",
@@ -167,6 +167,12 @@
167
167
  },
168
168
  "description": "The layout to use for the goal pages."
169
169
  },
170
+ "previous_next_links": {
171
+ "title": "Previous/next links",
172
+ "type": "boolean",
173
+ "description": "This setting can be used to show navigation links to the previous/next goals.",
174
+ "format": "checkbox"
175
+ },
170
176
  "goals": {
171
177
  "options": {"collapsed": true},
172
178
  "type": "array",
@@ -213,6 +219,12 @@
213
219
  ]
214
220
  },
215
221
  "description": "The layout to use for the indicator pages."
222
+ },
223
+ "previous_next_links": {
224
+ "title": "Previous/next links",
225
+ "type": "boolean",
226
+ "description": "This setting can be used to show navigation links to the previous/next indicators.",
227
+ "format": "checkbox"
216
228
  }
217
229
  },
218
230
  "links": [
@@ -306,6 +318,30 @@
306
318
  }
307
319
  ]
308
320
  },
321
+ "data_fields": {
322
+ "options": {"collapsed": true},
323
+ "type": "object",
324
+ "title": "Data fields",
325
+ "description": "Control the names of fields used for special purposes in data.",
326
+ "properties": {
327
+ "units": {
328
+ "type": "string",
329
+ "title": "Units",
330
+ "description": "Field to reserve for units of measurement. Defaults to 'Units'."
331
+ },
332
+ "series": {
333
+ "type": "string",
334
+ "title": "Series",
335
+ "description": "Field to reserve for the SDG series. Defaults to 'Series'."
336
+ }
337
+ },
338
+ "links": [
339
+ {
340
+ "rel": "More information on the data fields setting",
341
+ "href": "https://open-sdg.readthedocs.io/en/latest/configuration/#data_fields"
342
+ }
343
+ ]
344
+ },
309
345
  "date_formats": {
310
346
  "options": {"collapsed": true},
311
347
  "type": "array",
@@ -580,7 +616,7 @@
580
616
  "title": "Graph color set",
581
617
  "description": "This setting can be used to customize the color set used in the charts.",
582
618
  "examples": [],
583
- "enum": ["default", "sdg", "goal", "custom"],
619
+ "enum": ["default", "accessible", "sdg", "goal", "custom"],
584
620
  "links": [
585
621
  {
586
622
  "rel": "More information on the graph color set setting",
@@ -617,6 +653,35 @@
617
653
  }
618
654
  ]
619
655
  },
656
+ "header": {
657
+ "options": {"collapsed": true},
658
+ "type": "object",
659
+ "title": "Header",
660
+ "description": "This setting can be used to customise the header.",
661
+ "properties": {
662
+ "include": {
663
+ "type": "string",
664
+ "title": "Include file",
665
+ "enum": [
666
+ "header-default.html",
667
+ "header-menu-left-aligned.html"
668
+ ],
669
+ "options": {
670
+ "enum_titles": [
671
+ "Default header",
672
+ "Menu left-aligned"
673
+ ]
674
+ },
675
+ "description": "The header style to use on all pages."
676
+ }
677
+ },
678
+ "links": [
679
+ {
680
+ "rel": "More information on the header setting",
681
+ "href": "https://open-sdg.readthedocs.io/en/latest/configuration/#header"
682
+ }
683
+ ]
684
+ },
620
685
  "header_language_toggle": {
621
686
  "type": "string",
622
687
  "title": "Header language toggle",
@@ -855,7 +920,23 @@
855
920
  "title": "Main menu",
856
921
  "description": "The links to display in the main menu.",
857
922
  "items": {
858
- "$ref": "#/definitions/menu_item"
923
+ "title": "Menu item",
924
+ "allOf": [
925
+ { "$ref": "#/definitions/menu_item" },
926
+ {
927
+ "properties": {
928
+ "dropdown": {
929
+ "title": "Dropdown menu",
930
+ "type": "array",
931
+ "description": "Enter menu items here to turn this into a dropdown.",
932
+ "items": {
933
+ "$ref": "#/definitions/menu_item",
934
+ "title": "Dropdown menu item"
935
+ }
936
+ }
937
+ }
938
+ }
939
+ ]
859
940
  },
860
941
  "links": [
861
942
  {
@@ -43,6 +43,24 @@ module JekyllOpenSdgPlugins
43
43
  sort_order
44
44
  end
45
45
 
46
+ # Get previous item from an array, or loop to the end.
47
+ def get_previous_item(list, index)
48
+ decremented = index - 1
49
+ if decremented < 0
50
+ decremented = list.length() - 1
51
+ end
52
+ list[decremented]
53
+ end
54
+
55
+ # Get next item from an array, or loop to the beginning.
56
+ def get_next_item(list, index)
57
+ incremented = index + 1
58
+ if incremented >= list.length()
59
+ incremented = 0
60
+ end
61
+ list[incremented]
62
+ end
63
+
46
64
  # The Jekyll baseurl is user-configured, and can be inconsistent. This
47
65
  # ensure it is consistent in whether it starts/ends with a slash.
48
66
  def normalize_baseurl(baseurl)
@@ -209,6 +227,7 @@ module JekyllOpenSdgPlugins
209
227
  goal_number = get_goal_number(indicator_number)
210
228
  target_number = get_target_number(indicator_number)
211
229
  is_global_indicator = global_inids.index(indicator_number) != nil
230
+
212
231
  # To get the name of global stuff, we can use predicable translation
213
232
  # keys from the SDG Translations project. Eg: global_goals.1-title
214
233
  goal_translation_key = 'global_goals.' + goal_number
@@ -253,8 +272,10 @@ module JekyllOpenSdgPlugins
253
272
  end
254
273
  end
255
274
 
275
+ is_standalone = meta.has_key?('standalone') and meta['standalone']
276
+
256
277
  # Set the goal for this language, once only.
257
- if already_added[language].index(goal_number) == nil
278
+ if !is_standalone && already_added[language].index(goal_number) == nil
258
279
  already_added[language].push(goal_number)
259
280
  available_goal = {
260
281
  'number' => goal_number,
@@ -269,7 +290,7 @@ module JekyllOpenSdgPlugins
269
290
  available_goals[language].push(available_goal)
270
291
  end
271
292
  # Set the target for this language, once only.
272
- if already_added[language].index(target_number) == nil
293
+ if !is_standalone && already_added[language].index(target_number) == nil
273
294
  already_added[language].push(target_number)
274
295
  available_target = {
275
296
  'number' => target_number,
@@ -293,12 +314,21 @@ module JekyllOpenSdgPlugins
293
314
  else
294
315
  indicator_name = meta['indicator_name']
295
316
  end
317
+ indicator_path = indicator_number
318
+ if is_standalone && meta.has_key?('permalink') && meta['permalink'] != ''
319
+ indicator_path = meta['permalink']
320
+ end
321
+ indicator_sort = get_sort_order(indicator_number)
322
+ if meta.has_key?('sort') && meta['sort'] != ''
323
+ # Allow metadata 'sort' field to override the default sort.
324
+ indicator_sort = meta['sort']
325
+ end
296
326
  available_indicator = {
297
327
  'number' => indicator_number,
298
328
  'slug' => indicator_number.gsub('.', '-'),
299
329
  'name' => opensdg_translate_key(indicator_name, translations, language),
300
- 'url' => get_url(baseurl, language, indicator_number, languages, languages_public),
301
- 'sort' => get_sort_order(indicator_number),
330
+ 'url' => get_url(baseurl, language, indicator_path, languages, languages_public),
331
+ 'sort' => indicator_sort,
302
332
  'goal_number' => goal_number,
303
333
  'target_number' => target_number,
304
334
  'global' => global_indicator,
@@ -374,7 +404,11 @@ module JekyllOpenSdgPlugins
374
404
  target_number = get_target_number(indicator_number)
375
405
  doc.data['goal'] = available_goals[language].find {|x| x['number'] == goal_number}
376
406
  doc.data['target'] = available_targets[language].find {|x| x['number'] == target_number}
377
- doc.data['indicator'] = available_indicators[language].find {|x| x['number'] == indicator_number}
407
+ indicator_index = available_indicators[language].find_index {|x| x['number'] == indicator_number}
408
+ doc.data['indicator'] = available_indicators[language][indicator_index]
409
+ doc.data['next'] = get_next_item(available_indicators[language], indicator_index)
410
+ doc.data['previous'] = get_previous_item(available_indicators[language], indicator_index)
411
+
378
412
  elsif collection == 'goals'
379
413
  # For goals we also set the current goal.
380
414
  if doc.data.has_key? 'goal_number'
@@ -389,7 +423,10 @@ module JekyllOpenSdgPlugins
389
423
  if goal_number.is_a? Numeric
390
424
  goal_number = goal_number.to_s
391
425
  end
392
- doc.data['goal'] = available_goals[language].find {|x| x['number'] == goal_number}
426
+ goal_index = available_goals[language].find_index {|x| x['number'] == goal_number}
427
+ doc.data['goal'] = available_goals[language][goal_index]
428
+ doc.data['next'] = get_next_item(available_goals[language], goal_index)
429
+ doc.data['previous'] = get_previous_item(available_goals[language], goal_index)
393
430
  end
394
431
  end
395
432
  end
@@ -1,3 +1,3 @@
1
1
  module JekyllOpenSdgPlugins
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.3.0-beta1".freeze
3
3
  end
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.2.0
4
+ version: 1.3.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-01-22 00:00:00.000000000 Z
11
+ date: 2021-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -100,9 +100,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - ">="
103
+ - - ">"
104
104
  - !ruby/object:Gem::Version
105
- version: '0'
105
+ version: 1.3.1
106
106
  requirements: []
107
107
  rubygems_version: 3.1.4
108
108
  signing_key: