jekyll-open-sdg-plugins 1.4.0 → 1.5.0.pre.beta1

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: f535300e051b6be3aae0ab0fc136f5fdda75d2453dd832388f3408ff8d8370d2
4
- data.tar.gz: bcd82b1a845f92ed56c49b92f175d778bd9bfc91c1276d32dcc244b29821d685
3
+ metadata.gz: 06e9d51fe6fddfeab87a899fb547b6b1762d0832d59de269f12d5bddd6aeedc4
4
+ data.tar.gz: 8f1728d821fffbb4cc51382cbc705e1e1e565c8b34cba3fbfdbe7bedd0ae4c3d
5
5
  SHA512:
6
- metadata.gz: edbdfc568479a3eb1e6c39a26a9e81d97e8edf9d082c32cd62448ecc6b14802b7f007afcb9076fb08671647abb56e91317604f10031cb6a312fef98cc295c4bd
7
- data.tar.gz: '02282d6323e8b8224d8d1b7404753d6bd3ae7e075dcbc3183b11a01e113927e60c7a8058e33afb2918d9759df84ab547d0cf80a2a6858f8e2ee9f502b0cd8c1d'
6
+ metadata.gz: 68c29fd1482b09b1b22875375277ea93e748d6f8bfa9a89e986cea37790782761ad5f790d1e49d12335578a048140e76e9979b6cd16c1a1cd7fcbca0356670a7
7
+ data.tar.gz: 8af06e8364fd7ce44039fab11617ba98ff6e8f6eb63ea5e9b4839fcb1bd36e81746d2ec333422159f10931737bda790719895e1f6e66a28fec5212b6116622fc
@@ -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].to_i
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
- goals.sort.each do |goal, value|
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'][goal - 1].nil?
69
- goal_content = site.config['create_goals']['goals'][goal - 1]['content']
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
@@ -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": "string",
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": "#FFFFFFF",
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": "#FFFFFF",
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": "#FFFFFF",
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",
@@ -576,6 +663,17 @@
576
663
  "href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#recommended-special-fields"
577
664
  }
578
665
  ]
666
+ },
667
+ "x_axis_label": {
668
+ "type": "string",
669
+ "title": "X axis label",
670
+ "description": "A label beneath the X axis on charts. This overrides the same site configuration setting.",
671
+ "links": [
672
+ {
673
+ "rel": "More information on the X axis label setting",
674
+ "href": "https://open-sdg.readthedocs.io/en/latest/indicator-configuration/#x_axis_label"
675
+ }
676
+ ]
579
677
  }
580
678
  },
581
679
  "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
- "ga_prod": {
36
+ "ua": {
37
37
  "type": "string",
38
- "title": "Google Analytics tracking ID",
39
- "description": "The tracking ID (UA code) for your property on Google Analytics."
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",
@@ -736,6 +766,30 @@
736
766
  }
737
767
  ]
738
768
  },
769
+ "hide_single_series": {
770
+ "title": "Hide single series",
771
+ "type": "boolean",
772
+ "description": "This setting can be used to hide the 'Series' toggle on indicators where there is only one choice.",
773
+ "format": "checkbox",
774
+ "links": [
775
+ {
776
+ "rel": "More information on the hide single series setting",
777
+ "href": "https://open-sdg.readthedocs.io/en/latest/configuration/#hide_single_series"
778
+ }
779
+ ]
780
+ },
781
+ "hide_single_unit": {
782
+ "title": "Hide single unit",
783
+ "type": "boolean",
784
+ "description": "This setting can be used to hide the 'Unit' toggle on indicators where there is only one choice.",
785
+ "format": "checkbox",
786
+ "links": [
787
+ {
788
+ "rel": "More information on the hide single unit setting",
789
+ "href": "https://open-sdg.readthedocs.io/en/latest/configuration/#hide_single_unit"
790
+ }
791
+ ]
792
+ },
739
793
  "indicator_config_form": {
740
794
  "options": {"collapsed": true},
741
795
  "type": "object",
@@ -1310,6 +1364,17 @@
1310
1364
  "href": "https://open-sdg.readthedocs.io/en/latest/configuration/#validate_site_config"
1311
1365
  }
1312
1366
  ]
1367
+ },
1368
+ "x_axis_label": {
1369
+ "type": "string",
1370
+ "title": "X axis label",
1371
+ "description": "A label beneath the X axis on charts. This is overridden by the same indicator configuration setting.",
1372
+ "links": [
1373
+ {
1374
+ "rel": "More information on the X axis label setting",
1375
+ "href": "https://open-sdg.readthedocs.io/en/latest/configuration/#x_axis_label"
1376
+ }
1377
+ ]
1313
1378
  }
1314
1379
  },
1315
1380
  "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'] = get_next_item(available_indicators[language], indicator_index)
442
- doc.data['previous'] = get_previous_item(available_indicators[language], indicator_index)
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.
@@ -1,3 +1,3 @@
1
1
  module JekyllOpenSdgPlugins
2
- VERSION = "1.4.0".freeze
2
+ VERSION = "1.5.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.4.0
4
+ version: 1.5.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-07-15 00:00:00.000000000 Z
11
+ date: 2021-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -101,9 +101,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - ">="
104
+ - - ">"
105
105
  - !ruby/object:Gem::Version
106
- version: '0'
106
+ version: 1.3.1
107
107
  requirements: []
108
108
  rubygems_version: 3.1.4
109
109
  signing_key: