jekyll-open-sdg-plugins 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 223b4a55da18c4e20ce1e07823c71ea9e12a935598dcbefe39eb37c4246f2757
4
- data.tar.gz: 377bc37c6b248fd74f7762bfea0d26ca54ec023d5359da05ade3ce4385fdb204
3
+ metadata.gz: 84b88b5f39066164b92412735bb030d01c6dfc7210c2c543187aa0d7f53e253a
4
+ data.tar.gz: 7d663912c4f8b4426f47615b4bce831da3422104a880e33c51276fb244d6de02
5
5
  SHA512:
6
- metadata.gz: 79d8089c8c040c0bd4fdff209e95ffd54adffa8b929dc1f4804a0c0c1a5b471728f73104d784ce50ed94af12f861764706823d01386ed4aa561a4b462dfa719a
7
- data.tar.gz: 33fe8ac6009c5807c5036fdc539ec60300548560e4f8d09dd05560cb06e11ea038ea183c18f8e15ff3ed63ed9960999fb2cd4cbeac6ecdc002c0bc5b2bd1c061
6
+ metadata.gz: 203de7cb85bee411542589d9c712384a4e1df0e87e12a62ace92f48d7ae35adde6bb3582a789ff95cd450a2fe0236d6436737a9259cdb2b7b7761aac061951db
7
+ data.tar.gz: '0989f9bd7f936ad4f627ee0b0d6736ab6a96af59fc8edbac5b66f6b0f256f3ecc806d4a8004c3f8e359d2ec451a9d46999fa56471ad9454d9f8a45b211f157fa'
@@ -37,7 +37,13 @@ module JekyllOpenSdgPlugins
37
37
  end
38
38
  # Loop through the goals.
39
39
  goal_index = 0
40
- goals.keys.sort.each do |goal|
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
- if !site.config['create_goals']['goals'][goal_index].nil?
63
- goal_content = site.config['create_goals']['goals'][goal_index]['content']
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,28 @@
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
+ },
409
+ "empty_metadata_placeholder_sources": {
410
+ "type": "string",
411
+ "title": "Empty metadata placeholder (sources)",
412
+ "description": "This setting controls the text that will display for any sources field which has no content. Note that this is not used if 'hide_empty_metadata' is true.",
413
+ "links": [
414
+ {
415
+ "rel": "More information on the empty metadata placeholder (sources) setting",
416
+ "href": "https://open-sdg.readthedocs.io/en/latest/configuration/#empty_metadata_placeholder_sources"
417
+ }
418
+ ]
419
+ },
388
420
  "environment": {
389
421
  "type": "string",
390
422
  "minLength": 1,
@@ -667,6 +699,22 @@
667
699
  }
668
700
  ]
669
701
  },
702
+ "ignored_disaggregations": {
703
+ "options": {"collapsed": true},
704
+ "type": "array",
705
+ "title": "Ignored disaggregations",
706
+ "description": "An optional list of data columns that should not appear as disaggregation drop-downs in the left sidebar.",
707
+ "items": {
708
+ "type": "string",
709
+ "title": "Ignored disaggregation"
710
+ },
711
+ "links": [
712
+ {
713
+ "rel": "More information on the ignored_disaggregations setting",
714
+ "href": "https://open-sdg.readthedocs.io/en/latest/configuration/#ignored_disaggregations"
715
+ }
716
+ ]
717
+ },
670
718
  "indicator_config_form": {
671
719
  "options": {"collapsed": true},
672
720
  "type": "object",
@@ -1120,6 +1168,11 @@
1120
1168
  "type": "string",
1121
1169
  "description": "A heading to display before the progress status on indicator pages."
1122
1170
  },
1171
+ "status_help": {
1172
+ "title": "Status help",
1173
+ "type": "string",
1174
+ "description": "An explanatory column header above the progress status on goal pages."
1175
+ },
1123
1176
  "status_types": {
1124
1177
  "options": {"collapsed": true},
1125
1178
  "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|
@@ -1,3 +1,3 @@
1
1
  module JekyllOpenSdgPlugins
2
- VERSION = "2.0.0".freeze
2
+ VERSION = "2.1.0".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: 2.0.0
4
+ version: 2.1.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: 2022-06-25 00:00:00.000000000 Z
11
+ date: 2022-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
- rubygems_version: 3.0.9
109
+ rubygems_version: 3.1.4
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Jekyll plugins for use with the Open SDG platform