jekyll-open-sdg-plugins 1.2.0.pre.beta6 → 1.4.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: 175c1098b80cdde83f1b14cf976f2c5a14d4ef5605bd5970712276c5ac4e0098
4
- data.tar.gz: 053f7aae3bc5b4b1a0c1ffbb51ffab2029e1058d62e40fda80567b2ac522279d
3
+ metadata.gz: 6ba22fd994d04edb16b31b864db8b6538e2a996cfbf98c16f0eaee128fa8117c
4
+ data.tar.gz: 70d64a4098ecc895aac3f8690617bf34c019b743cff279734cf81b71c015d5de
5
5
  SHA512:
6
- metadata.gz: 47644a62f2244696045fb915262421fcf0f83b2ade9ee37824f76a172ad2851f68513ee00e92495334c0d2ffa1f43aa54deb95ebabfeeb58f923806670624fd5
7
- data.tar.gz: fb4aee69cf0c348d0d08af195dace95571444d72394ba7259c6078583387361665f8d472160a3695e79ccc341b534faabde0943c08afd2d7f117c4b1e098cecc
6
+ metadata.gz: f9440c732b7ecb4ea1cbe223abd96288ffbbc647c4e4ab102009a3887643dfa6f0270c6171cbb7636e816385865ceebee7f840dfb09e454c0d38968779b9d720
7
+ data.tar.gz: 920503070bad04e792f6ec01815236a50edc5a5556f611da5640d867416eb0dd5bbcb52dfde684db521af5156f59490ce84ff64b234c2d6b0103b5b9ef038858
@@ -11,6 +11,7 @@ require_relative "jekyll-open-sdg-plugins/create_pages"
11
11
  require_relative "jekyll-open-sdg-plugins/sdg_variables"
12
12
  require_relative "jekyll-open-sdg-plugins/search_index"
13
13
  require_relative "jekyll-open-sdg-plugins/validate_indicator_config"
14
+ require_relative "jekyll-open-sdg-plugins/metadata_schema_to_config"
14
15
 
15
16
  module JekyllOpenSdgPlugins
16
17
  end
@@ -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
@@ -7,17 +7,52 @@ module JekyllOpenSdgPlugins
7
7
  priority :normal
8
8
 
9
9
  def generate(site)
10
+ # Some references to clean up the code below.
11
+ language_config = site.config['languages']
12
+ indicator_config = site.config['create_indicators']
13
+ form_settings_config = site.config['indicator_config_form']
14
+ form_settings_meta = site.config['indicator_metadata_form']
15
+ form_settings_data = site.config['indicator_data_form']
16
+
17
+ # Special treatment of repository_link settings: prefix them
18
+ # with the repository_url_data site config if needed.
19
+ repo_url = site.config['repository_url_data']
20
+ if repo_url && repo_url != '' && repo_url.start_with?('http')
21
+ if form_settings_config != nil && form_settings_config && form_settings_config['enabled']
22
+ if form_settings_config['repository_link'] && form_settings_config['repository_link'] != ''
23
+ unless form_settings_config['repository_link'].start_with?('http')
24
+ form_settings_config['repository_link'] = repo_url + form_settings_config['repository_link']
25
+ end
26
+ end
27
+ end
28
+ if form_settings_meta != nil && form_settings_meta && form_settings_meta['enabled']
29
+ if form_settings_meta['repository_link'] && form_settings_meta['repository_link'] != ''
30
+ unless form_settings_meta['repository_link'].start_with?('http')
31
+ form_settings_meta['repository_link'] = repo_url + form_settings_meta['repository_link']
32
+ end
33
+ end
34
+ end
35
+ if form_settings_data != nil && form_settings_data && form_settings_data['enabled']
36
+ if form_settings_data['repository_link'] && form_settings_data['repository_link'] != ''
37
+ unless form_settings_data['repository_link'].start_with?('http')
38
+ form_settings_data['repository_link'] = repo_url + form_settings_data['repository_link']
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ translations = site.data['translations']
10
45
  # If site.create_indicators is set, create indicators per the metadata.
11
- if site.config['languages'] and site.config['create_indicators'] and site.config['create_indicators'].key?('layout') and site.config['create_indicators']['layout'] != ''
46
+ if (language_config and indicator_config and indicator_config.key?('layout') and indicator_config['layout'] != '')
12
47
  # Decide what layout to use for the indicator pages.
13
- layout = site.config['create_indicators']['layout']
48
+ layout = indicator_config['layout']
14
49
  # See if we need to "map" any language codes.
15
50
  languages_public = Hash.new
16
51
  if site.config['languages_public']
17
52
  languages_public = opensdg_languages_public(site)
18
53
  end
19
54
  # Loop through the languages.
20
- site.config['languages'].each_with_index do |language, index|
55
+ language_config.each_with_index do |language, index|
21
56
  # Get the "public language" (for URLs) which may be different.
22
57
  language_public = language
23
58
  if languages_public[language]
@@ -34,41 +69,102 @@ module JekyllOpenSdgPlugins
34
69
  end
35
70
  # Loop through the indicators (using metadata as a list).
36
71
  metadata.each do |inid, meta|
72
+ permalink = inid
73
+ if (meta.has_key?('permalink') and meta['permalink'] != '')
74
+ permalink = meta['permalink']
75
+ end
37
76
  # Add the language subfolder for all except the default (first) language.
38
- dir = index == 0 ? inid : File.join(language_public, inid)
77
+ dir = index == 0 ? permalink : File.join(language_public, permalink)
78
+
39
79
  # Create the indicator page.
40
80
  site.collections['indicators'].docs << IndicatorPage.new(site, site.source, dir, inid, language, layout)
41
81
  end
42
82
  end
43
- # Create the indicator configuration pages.
44
- if site.config['create_config_forms'] && site.config['create_config_forms'].key?('layout') && site.config['create_config_forms']['layout'] != ''
83
+ # Create the indicator settings configuration/metadata/data pages.
84
+ do_indicator_config_forms = form_settings_config && form_settings_config['enabled']
85
+ do_indicator_meta_forms = form_settings_meta && form_settings_meta['enabled']
86
+ do_indicator_data_forms = form_settings_data && form_settings_data['enabled']
87
+ use_translated_metadata = form_settings_meta && form_settings_meta['translated']
88
+ if do_indicator_config_forms || do_indicator_meta_forms || do_indicator_data_forms
89
+
45
90
  metadata = {}
46
- layout = site.config['create_config_forms']['layout']
47
91
  if opensdg_translated_builds(site)
48
92
  if site.data.has_key?('untranslated')
49
93
  metadata = site.data['untranslated']['meta']
50
94
  else
51
- default_language = site.config['languages'][0]
95
+ default_language = language_config[0]
52
96
  metadata = site.data[default_language]['meta']
53
97
  end
54
98
  else
55
99
  metadata = site.data['meta']
56
100
  end
101
+
102
+ metadata_by_language = {}
103
+ language_config.each do |language|
104
+ if opensdg_translated_builds(site)
105
+ metadata_by_language[language] = site.data[language]['meta']
106
+ else
107
+ metadata_by_language[language] = site.data['meta']
108
+ end
109
+ end
110
+
111
+ # Because we have config forms for indicator config or meta/data, we
112
+ # take over the meta/data_edit_url and configuration_edit_url settings
113
+ # here with simple relative links.
114
+ if do_indicator_config_forms
115
+ site.config['configuration_edit_url'] = 'config'
116
+ end
117
+
118
+ if do_indicator_meta_forms
119
+ site.config['metadata_edit_url'] = 'metadata'
120
+ end
121
+
122
+ if do_indicator_data_forms
123
+ site.config['data_edit_url'] = 'data'
124
+ end
125
+
57
126
  # Loop through the indicators (using metadata as a list).
58
127
  if !metadata.empty?
59
128
  # Loop through the languages.
60
- site.config['languages'].each_with_index do |language, index|
129
+ language_config.each_with_index do |language, index|
61
130
  # Get the "public language" (for URLs) which may be different.
62
131
  language_public = language
63
132
  if languages_public[language]
64
133
  language_public = languages_public[language]
65
134
  end
66
135
  metadata.each do |inid, meta|
67
- dir = File.join('config', inid)
136
+ permalink = inid
137
+ if (meta.has_key?('permalink') and meta['permalink'] != '')
138
+ permalink = meta['permalink']
139
+ end
140
+ dir_base = File.join(permalink)
68
141
  if index != 0
69
- dir = File.join(language_public, 'config', inid)
142
+ dir_base = File.join(language_public, permalink)
143
+ end
144
+
145
+ if do_indicator_config_forms
146
+ dir = File.join(dir_base, 'config')
147
+ title = opensdg_translate_key('indicator.edit_configuration', translations, language)
148
+ config_type = 'indicator'
149
+ site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, meta, title, config_type, form_settings_config)
150
+ end
151
+
152
+ if do_indicator_meta_forms
153
+ metadata_to_use = meta
154
+ if use_translated_metadata
155
+ metadata_to_use = metadata_by_language[language][inid]
156
+ end
157
+ dir = File.join(dir_base, 'metadata')
158
+ title = opensdg_translate_key('indicator.edit_metadata', translations, language)
159
+ config_type = 'metadata'
160
+ site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, metadata_to_use, title, config_type, form_settings_meta)
161
+ end
162
+
163
+ if do_indicator_data_forms
164
+ dir = File.join(dir_base, 'data')
165
+ title = opensdg_translate_key('indicator.edit_data', translations, language)
166
+ site.collections['pages'].docs << IndicatorDataPage.new(site, site.source, dir, inid, language, title, form_settings_data)
70
167
  end
71
- site.collections['pages'].docs << IndicatorConfigPage.new(site, site.source, dir, inid, language, meta, layout)
72
168
  end
73
169
  end
74
170
  end
@@ -77,7 +173,7 @@ module JekyllOpenSdgPlugins
77
173
  end
78
174
  end
79
175
 
80
- # A Page subclass used in the `CreateIndicators` class.
176
+ # A Page subclass used in the `CreateIndicators` class for the indicators.
81
177
  class IndicatorPage < Jekyll::Page
82
178
  def initialize(site, base, dir, inid, language, layout)
83
179
  @site = site
@@ -95,9 +191,9 @@ module JekyllOpenSdgPlugins
95
191
  end
96
192
  end
97
193
 
98
- # A Page subclass used in the `CreateIndicators` class.
194
+ # A Page subclass used in the `CreateIndicators` class for the indicator config forms.
99
195
  class IndicatorConfigPage < Jekyll::Page
100
- def initialize(site, base, dir, inid, language, meta, layout)
196
+ def initialize(site, base, dir, inid, language, meta, title, config_type, form_settings)
101
197
  @site = site
102
198
  @base = base
103
199
  @dir = dir
@@ -106,12 +202,32 @@ module JekyllOpenSdgPlugins
106
202
  self.process(@name)
107
203
  self.data = {}
108
204
  self.data['language'] = language
109
- self.data['indicator_number'] = inid.gsub('-', '.')
110
- self.data['config_type'] = 'indicator'
111
- self.data['layout'] = layout
205
+ self.data['indicator_number'] = inid
206
+ self.data['config_type'] = config_type
207
+ self.data['layout'] = 'config-builder'
112
208
  self.data['meta'] = meta
113
- self.data['title'] = 'Open SDG indicator configuration: ' + self.data['indicator_number']
209
+ self.data['title'] = title + ': ' + inid.gsub('-', '.')
114
210
  self.data['config_filename'] = inid + '.yml'
211
+ self.data['form_settings'] = form_settings
212
+ end
213
+ end
214
+
215
+ # A Page subclass used in the `CreateIndicators` class for the indicator data forms.
216
+ class IndicatorDataPage < Jekyll::Page
217
+ def initialize(site, base, dir, inid, language, title, form_settings)
218
+ @site = site
219
+ @base = base
220
+ @dir = dir
221
+ @name = 'index.html'
222
+
223
+ self.process(@name)
224
+ self.data = {}
225
+ self.data['language'] = language
226
+ self.data['indicator_number'] = inid
227
+ self.data['layout'] = 'data-editor'
228
+ self.data['title'] = title + ': ' + inid.gsub('-', '.')
229
+ self.data['config_filename'] = 'indicator_' + inid
230
+ self.data['form_settings'] = form_settings
115
231
  end
116
232
  end
117
233
  end
@@ -30,7 +30,7 @@ module JekyllOpenSdgPlugins
30
30
  # To use the default 4 pages, simply put:
31
31
  #
32
32
  # create_pages: true
33
- if site.config['languages'] and site.config['create_pages']
33
+ if (site.config['languages'] and site.config['create_pages'])
34
34
 
35
35
  default_pages = [
36
36
  {
@@ -54,7 +54,7 @@ module JekyllOpenSdgPlugins
54
54
  }
55
55
  ]
56
56
  pages = default_pages
57
- if site.config['create_pages'].is_a?(Hash) and site.config['create_pages'].key?('pages')
57
+ if (site.config['create_pages'].is_a?(Hash) and site.config['create_pages'].key?('pages'))
58
58
  # Backwards compatability to support the deprecated "pages" key.
59
59
  pages = site.config['create_pages']['pages']
60
60
  elsif site.config['create_pages'].is_a?(Array)
@@ -65,18 +65,33 @@ module JekyllOpenSdgPlugins
65
65
  pages = pages.clone
66
66
 
67
67
  # Hardcode the site configuration page if it's not already there.
68
+ form_settings = site.config['site_config_form']
68
69
  config_page = pages.find { |page| page['layout'] == 'config-builder' }
69
70
  if config_page == nil
70
- if site.config['create_config_forms'] && site.config['create_config_forms'].key?('layout') && site.config['create_config_forms']['layout'] != ''
71
+ if form_settings && form_settings['enabled']
71
72
  pages.push({
72
73
  'folder' => '/config',
73
- 'layout' => site.config['create_config_forms']['layout'],
74
+ 'layout' => 'config-builder',
74
75
  'title' => 'Open SDG site configuration',
75
76
  'config_type' => 'site',
76
- 'config_filename' => 'site_config.yml'
77
+ 'config_filename' => 'site_config.yml',
77
78
  })
78
79
  end
79
80
  end
81
+ # Make sure the form settings are set.
82
+ config_page = pages.find { |page| page['layout'] == 'config-builder' }
83
+ if config_page != nil && form_settings && form_settings['enabled']
84
+ # Special treatment of repository_link.
85
+ if form_settings['repository_link'] && form_settings['repository_link'] != ''
86
+ unless form_settings['repository_link'].start_with?('http')
87
+ repo_url = site.config['repository_url_site']
88
+ if repo_url && repo_url != '' && repo_url.start_with?('http')
89
+ form_settings['repository_link'] = repo_url + form_settings['repository_link']
90
+ end
91
+ end
92
+ end
93
+ config_page['form_settings'] = form_settings
94
+ end
80
95
 
81
96
  # See if we need to "map" any language codes.
82
97
  languages_public = Hash.new
@@ -25,7 +25,8 @@ module JekyllOpenSdgPlugins
25
25
  'disaggregation' => 'stats/disaggregation.json',
26
26
  'translations' => 'translations/translations.json',
27
27
  'zip' => 'zip/all_indicators.json',
28
- 'indicator_downloads' => 'downloads/indicator-downloads.json'
28
+ 'indicator_downloads' => 'downloads/indicator-downloads.json',
29
+ 'data_packages' => 'data-packages/all.json',
29
30
  }
30
31
  end
31
32
 
@@ -43,7 +44,7 @@ module JekyllOpenSdgPlugins
43
44
  rescue StandardError => e
44
45
  # For backwards compatibility, forego the exception in some cases.
45
46
  abort_build = true
46
- if ['translations', 'indicator_downloads', 'disaggregation'].include? key
47
+ if ['translations', 'indicator_downloads', 'disaggregation', 'data_packages'].include? key
47
48
  abort_build = false
48
49
  elsif endpoint.include? '/untranslated/'
49
50
  abort_build = false
@@ -0,0 +1,72 @@
1
+ require "jekyll"
2
+ require_relative "helpers"
3
+
4
+ module JekyllOpenSdgPlugins
5
+ class MetadataSchemaToConfig < Jekyll::Generator
6
+ safe true
7
+ priority :lowest
8
+
9
+ def generate(site)
10
+
11
+ # Convert the metadata schema from the internal format into JSONSchema so
12
+ # it can be used to create config forms.
13
+
14
+ language_config = site.config['languages']
15
+ form_settings = site.config['indicator_metadata_form']
16
+ t = site.data['translations']
17
+ lang = language_config[0]
18
+
19
+ if form_settings && form_settings['enabled']
20
+ scopes = ['national', 'global']
21
+ if form_settings && form_settings.has_key?('scopes')
22
+ if form_settings['scopes'].kind_of?(Array) && form_settings['scopes'].length() > 0
23
+ scopes = form_settings['scopes']
24
+ end
25
+ end
26
+ exclude_fields = []
27
+ if form_settings && form_settings.has_key?('exclude_fields')
28
+ if form_settings['exclude_fields'].kind_of?(Array) && form_settings['exclude_fields'].length() > 0
29
+ exclude_fields = form_settings['exclude_fields']
30
+ end
31
+ end
32
+ if form_settings && form_settings.has_key?('language') && form_settings['language'] != ''
33
+ lang = form_settings['language']
34
+ end
35
+
36
+ schema = {
37
+ "type" => "object",
38
+ "title" => opensdg_translate_key('indicator.edit_metadata', t, lang),
39
+ "properties" => {},
40
+ }
41
+
42
+ site.data['schema'].each do |field|
43
+ field_name = field['name']
44
+ field_scope = field['field']['scope']
45
+ next unless scopes.include?(field_scope)
46
+ next if exclude_fields.include?(field_name)
47
+
48
+ to_translate = field_name
49
+ if field['field'].has_key?('translation_key')
50
+ to_translate = field['field']['translation_key']
51
+ elsif t[lang].has_key?('metadata_fields') && t[lang]['metadata_fields'].has_key?(field_name)
52
+ to_translate = 'metadata_fields.' + field_name
53
+ elsif field['field'].has_key?('label')
54
+ to_translate = field['field']['label']
55
+ end
56
+ field_label = opensdg_translate_key(to_translate, t, lang)
57
+
58
+ schema['properties'][field_name] = {
59
+ "type" => "string",
60
+ "format" => "markdown",
61
+ "title" => field_label,
62
+ "description" => 'Scope: ' + field_scope + ', Field: ' + field_name,
63
+ }
64
+ schema['additionalProperties'] = true
65
+ end
66
+
67
+ # Regardless place the schema in site data so it can be used in Jekyll templates.
68
+ site.data['schema-indicator-metadata'] = schema
69
+ end
70
+ end
71
+ end
72
+ 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",
@@ -207,142 +218,131 @@
207
218
  "items": {
208
219
  "type": "object",
209
220
  "title": "Graph annotation",
210
- "properties": {
211
- "preset": {
212
- "type": "string",
213
- "title": "Preset",
214
- "enum": ["target_line"],
215
- "description": "A preset bundle of configurations."
216
- },
217
- "value": {
218
- "type": "number",
219
- "minimum": 0,
220
- "title": "Value",
221
- "description": "The value at which to draw the line. For horizontal lines, this number corresponds to your actual data. For vertical lines, 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)."
222
- },
223
- "endValue": {
224
- "type": "number",
225
- "title": "End value",
226
- "description": "Optionally add a different ending value for the line."
227
- },
228
- "description": {
229
- "type": "string",
230
- "title": "Description",
231
- "description": "A description of the annotation to be read by screenreaders."
232
- },
233
- "unit": {
234
- "type": "string",
235
- "title": "Unit",
236
- "description": "The unit of measurement the annotation displays on."
237
- },
238
- "series": {
239
- "type": "string",
240
- "title": "Series",
241
- "description": "The series the annotation displays on."
242
- },
243
- "mode": {
244
- "type": "string",
245
- "title": "Mode",
246
- "description": "Whether the line will be vertical or horizontal.",
247
- "enum": ["horizontal", "vertical"]
248
- },
249
- "borderColor": {
250
- "type": "string",
251
- "format": "color",
252
- "title": "Line color",
253
- "description": "The color of the line.",
254
- "links": [
255
- {
256
- "rel": "More information on the border color setting",
257
- "href": "https://github.com/chartjs/chartjs-plugin-annotation/blob/master/README.md"
258
- }
259
- ]
260
- },
261
- "borderDash": {
262
- "type": "string",
263
- "title": "Line dash type",
264
- "description": "The type of line dash.",
265
- "links": [
266
- {
267
- "rel": "More information on the line dash setting",
268
- "href": "https://github.com/chartjs/chartjs-plugin-annotation/blob/master/README.md"
269
- }
270
- ]
271
- },
272
- "label": {
273
- "type": "object",
274
- "title": "Label",
275
- "description": "A text label for the annotation.",
221
+ "allOf": [
222
+ { "$ref": "#/definitions/series_unit_constraint" },
223
+ {
276
224
  "properties": {
277
- "position": {
278
- "type": "string",
279
- "title": "Position",
280
- "description": "Placement of the label along the line.",
281
- "enum": [
282
- "top",
283
- "bottom",
284
- "left",
285
- "right",
286
- "center"
287
- ]
225
+ "value": {
226
+ "type": "number",
227
+ "minimum": 0,
228
+ "title": "Value",
229
+ "description": "The value at which to draw the line. For horizontal lines, this number corresponds to your actual data. For vertical lines, 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)."
288
230
  },
289
- "content": {
290
- "type": "string",
291
- "minLength": 1,
292
- "title": "Content",
293
- "description": "Text of the line label."
231
+ "endValue": {
232
+ "type": "number",
233
+ "title": "End value",
234
+ "description": "Optionally add a different ending value for the line."
294
235
  },
295
- "fontColor": {
236
+ "description": {
296
237
  "type": "string",
297
- "format": "color",
298
- "title": "Label color",
299
- "description": "Color for the label text."
238
+ "title": "Description",
239
+ "description": "A description of the annotation to be read by screenreaders."
300
240
  },
301
- "backgroundColor": {
241
+ "mode": {
302
242
  "type": "string",
303
- "format": "color",
304
- "default": "#FFFFFFF",
305
- "title": "Background color",
306
- "description": "Background color for the label text."
307
- }
308
- }
309
- },
310
- "highContrast": {
311
- "type": "object",
312
- "title": "High contrast options",
313
- "description": "High-contrast overrides of certain color.",
314
- "properties": {
243
+ "title": "Mode",
244
+ "description": "Whether the line will be vertical or horizontal.",
245
+ "enum": ["horizontal", "vertical"]
246
+ },
315
247
  "borderColor": {
316
248
  "type": "string",
317
249
  "format": "color",
318
- "default": "#FFFFFF",
319
- "title": "High-contrast line color",
320
- "description": "The color of the line in high-contrast mode."
250
+ "title": "Line color",
251
+ "description": "The color of the line.",
252
+ "links": [
253
+ {
254
+ "rel": "More information on the border color setting",
255
+ "href": "https://github.com/chartjs/chartjs-plugin-annotation/blob/master/README.md"
256
+ }
257
+ ]
258
+ },
259
+ "borderDash": {
260
+ "type": "string",
261
+ "title": "Line dash type",
262
+ "description": "The type of line dash.",
263
+ "links": [
264
+ {
265
+ "rel": "More information on the line dash setting",
266
+ "href": "https://github.com/chartjs/chartjs-plugin-annotation/blob/master/README.md"
267
+ }
268
+ ]
321
269
  },
322
270
  "label": {
323
271
  "type": "object",
324
- "title": "High contrast label",
325
- "description": "High-contrast version of the label.",
272
+ "title": "Label",
273
+ "description": "A text label for the annotation.",
326
274
  "properties": {
275
+ "position": {
276
+ "type": "string",
277
+ "title": "Position",
278
+ "description": "Placement of the label along the line.",
279
+ "enum": [
280
+ "top",
281
+ "bottom",
282
+ "left",
283
+ "right",
284
+ "center"
285
+ ]
286
+ },
287
+ "content": {
288
+ "type": "string",
289
+ "minLength": 1,
290
+ "title": "Content",
291
+ "description": "Text of the line label."
292
+ },
327
293
  "fontColor": {
328
294
  "type": "string",
329
295
  "format": "color",
330
- "default": "#FFFFFF",
331
- "title": "High-contrast label color",
332
- "description": "Color for the label text in high-contrast mode."
296
+ "title": "Label color",
297
+ "description": "Color for the label text."
333
298
  },
334
299
  "backgroundColor": {
335
300
  "type": "string",
336
301
  "format": "color",
337
- "default": "#000000",
338
- "title": "High-contrast background color",
339
- "description": "Background color for the label text in high-contrast mode."
302
+ "default": "#FFFFFFF",
303
+ "title": "Background color",
304
+ "description": "Background color for the label text."
305
+ }
306
+ }
307
+ },
308
+ "highContrast": {
309
+ "type": "object",
310
+ "title": "High contrast options",
311
+ "description": "High-contrast overrides of certain color.",
312
+ "properties": {
313
+ "borderColor": {
314
+ "type": "string",
315
+ "format": "color",
316
+ "default": "#FFFFFF",
317
+ "title": "High-contrast line color",
318
+ "description": "The color of the line in high-contrast mode."
319
+ },
320
+ "label": {
321
+ "type": "object",
322
+ "title": "High contrast label",
323
+ "description": "High-contrast version of the label.",
324
+ "properties": {
325
+ "fontColor": {
326
+ "type": "string",
327
+ "format": "color",
328
+ "default": "#FFFFFF",
329
+ "title": "High-contrast label color",
330
+ "description": "Color for the label text in high-contrast mode."
331
+ },
332
+ "backgroundColor": {
333
+ "type": "string",
334
+ "format": "color",
335
+ "default": "#000000",
336
+ "title": "High-contrast background color",
337
+ "description": "Background color for the label text in high-contrast mode."
338
+ }
339
+ }
340
340
  }
341
341
  }
342
342
  }
343
343
  }
344
344
  }
345
- }
345
+ ]
346
346
  },
347
347
  "links": [
348
348
  {
@@ -359,30 +359,25 @@
359
359
  "items": {
360
360
  "type": "object",
361
361
  "title": "Graph limit",
362
- "properties": {
363
- "minimum": {
364
- "type": "number",
365
- "minimum": 0,
366
- "title": "Minimum",
367
- "description": "Minimum value for the y axis."
368
- },
369
- "maximum": {
370
- "type": "number",
371
- "minimum": 0,
372
- "title": "Maximum",
373
- "description": "Maximum value for the y axis."
374
- },
375
- "unit": {
376
- "type": "string",
377
- "title": "Unit",
378
- "description": "The unit of measurement the limits apply to."
379
- },
380
- "series": {
381
- "type": "string",
382
- "title": "Series",
383
- "description": "The series the limits apply to."
362
+ "allOf": [
363
+ { "$ref": "#/definitions/series_unit_constraint" },
364
+ {
365
+ "properties": {
366
+ "minimum": {
367
+ "type": "number",
368
+ "minimum": 0,
369
+ "title": "Minimum",
370
+ "description": "Minimum value for the y axis."
371
+ },
372
+ "maximum": {
373
+ "type": "number",
374
+ "minimum": 0,
375
+ "title": "Maximum",
376
+ "description": "Maximum value for the y axis."
377
+ }
378
+ }
384
379
  }
385
- }
380
+ ]
386
381
  },
387
382
  "links": [
388
383
  {
@@ -421,24 +416,19 @@
421
416
  "items": {
422
417
  "type": "object",
423
418
  "title": "Graph title",
424
- "properties": {
425
- "title": {
426
- "type": "string",
427
- "minLength": 1,
428
- "title": "Title",
429
- "description": "The graph title."
430
- },
431
- "unit": {
432
- "type": "string",
433
- "title": "Unit",
434
- "description": "The unit of measurement the title applies to."
435
- },
436
- "series": {
437
- "type": "string",
438
- "title": "Series",
439
- "description": "The series the title applies to."
419
+ "allOf": [
420
+ { "$ref": "#/definitions/series_unit_constraint" },
421
+ {
422
+ "properties": {
423
+ "title": {
424
+ "type": "string",
425
+ "minLength": 1,
426
+ "title": "Title",
427
+ "description": "The graph title."
428
+ }
429
+ }
440
430
  }
441
- }
431
+ ]
442
432
  }
443
433
  },
444
434
  "graph_type": {
@@ -453,6 +443,17 @@
453
443
  }
454
444
  ]
455
445
  },
446
+ "indicator_available": {
447
+ "type": "string",
448
+ "title": "Indicator available",
449
+ "description": "An optional sub-title for the indicator, which displays below the indicator name. Intended for cases where the available data is slightly different than the indicator name.",
450
+ "links": [
451
+ {
452
+ "rel": "More information on the indicator available setting",
453
+ "href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#recommended-special-fields"
454
+ }
455
+ ]
456
+ },
456
457
  "indicator_name": {
457
458
  "type": "string",
458
459
  "title": "Indicator name",
@@ -492,6 +493,39 @@
492
493
  "title": "Page content",
493
494
  "description": "Content which displays in the main content area of the indicator page."
494
495
  },
496
+ "permalink": {
497
+ "type": "string",
498
+ "title": "Permalink",
499
+ "description": "Overrides the normal path of the indicator page. Not recommended, execpt for 'standalone' indicators.",
500
+ "links": [
501
+ {
502
+ "rel": "More information the permalink setting",
503
+ "href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#standalone-indicators"
504
+ }
505
+ ]
506
+ },
507
+ "precision": {
508
+ "options": {"collapsed": true},
509
+ "type": "array",
510
+ "title": "Precision rules",
511
+ "description": "Control the number of decimal places for data in this indicator.",
512
+ "items": {
513
+ "type": "object",
514
+ "title": "Precision rule",
515
+ "allOf": [
516
+ { "$ref": "#/definitions/series_unit_constraint" },
517
+ {
518
+ "properties": {
519
+ "decimals": {
520
+ "type": "number",
521
+ "title": "Decimals",
522
+ "description": "The number of decimal places"
523
+ }
524
+ }
525
+ }
526
+ ]
527
+ }
528
+ },
495
529
  "reporting_status": {
496
530
  "type": "string",
497
531
  "title": "Reporting status",
@@ -504,6 +538,29 @@
504
538
  }
505
539
  ]
506
540
  },
541
+ "sort": {
542
+ "type": "string",
543
+ "title": "Sort order",
544
+ "description": "Override the default order in which this indicator is displayed in lists. This can be left blank, and it will be automatically determined.",
545
+ "links": [
546
+ {
547
+ "rel": "More information on the sort setting",
548
+ "href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#sorting-in-lists"
549
+ }
550
+ ]
551
+ },
552
+ "standalone": {
553
+ "title": "Standalone indicator",
554
+ "type": "boolean",
555
+ "description": "Whether the indicator is standalone (separate from the SDGs) or not.",
556
+ "format": "checkbox",
557
+ "links": [
558
+ {
559
+ "rel": "More information the standalone setting",
560
+ "href": "https://open-sdg.readthedocs.io/en/latest/metadata-format/#standalone-indicators"
561
+ }
562
+ ]
563
+ },
507
564
  "tags": {
508
565
  "options": {"collapsed": true},
509
566
  "type": "array",
@@ -521,5 +578,22 @@
521
578
  ]
522
579
  }
523
580
  },
524
- "additionalProperties": true
581
+ "additionalProperties": true,
582
+ "definitions": {
583
+ "series_unit_constraint": {
584
+ "type": "object",
585
+ "properties": {
586
+ "series": {
587
+ "type": "string",
588
+ "title": "Series",
589
+ "description": "Limit to this particular series"
590
+ },
591
+ "unit": {
592
+ "type": "string",
593
+ "title": "Unit",
594
+ "description": "Limit to this particular unit"
595
+ }
596
+ }
597
+ }
598
+ }
525
599
  }