jekyll-open-sdg-plugins 1.0.0.rc21 → 1.2.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.
@@ -0,0 +1,52 @@
1
+ require "jekyll"
2
+ require_relative "helpers"
3
+ require "json"
4
+ require "json_schemer"
5
+
6
+ module JekyllOpenSdgPlugins
7
+ class ValidateIndicatorConfig < Jekyll::Generator
8
+ safe true
9
+ priority :lowest
10
+
11
+ def generate(site)
12
+
13
+ schema_path = File.join(File.dirname(__FILE__), 'schema-indicator-config.json')
14
+ json_from_file = File.read(schema_path)
15
+ schema = JSON.parse(json_from_file)
16
+ schemer = JSONSchemer.schema(schema)
17
+
18
+ # Perform validation if the "validate_indicator_config" flag is true.
19
+ if site.config.has_key?('validate_indicator_config') && site.config['validate_indicator_config']
20
+ # We don't care too much what language we use, just get the first one.
21
+ language = 'en'
22
+ if site.config.has_key?('languages')
23
+ language = site.config['languages'][0]
24
+ end
25
+ metadata = {}
26
+ if opensdg_translated_builds(site)
27
+ metadata = site.data[language]['meta']
28
+ else
29
+ metadata = site.data['meta']
30
+ end
31
+ # Loop through the indicators (using metadata as a list).
32
+ validation_failed = false
33
+ metadata.each do |inid, meta|
34
+ unless schemer.valid?(meta)
35
+ validation_failed = true
36
+ opensdg_notice('Indicator ' + inid + ' configuration invalid:')
37
+ errors = schemer.validate(meta).to_a
38
+ errors.each { |error| opensdg_validation_error(error) }
39
+ end
40
+ end
41
+ if validation_failed
42
+ opensdg_notice "Some indicator configuration was not valid. See feedback above."
43
+ raise "Invalid indicator configuration"
44
+ end
45
+ end
46
+
47
+ # Regardless place the schema in site data so it can be used in Jekyll templates.
48
+ site.data['schema-indicator-config'] = schema
49
+
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,34 @@
1
+ require "jekyll"
2
+ require_relative "helpers"
3
+ require "json"
4
+ require "json_schemer"
5
+
6
+ module JekyllOpenSdgPlugins
7
+ class ValidateSiteConfig < Jekyll::Generator
8
+ safe true
9
+ priority :highest
10
+
11
+ def generate(site)
12
+
13
+ schema_path = File.join(File.dirname(__FILE__), 'schema-site-config.json')
14
+ json_from_file = File.read(schema_path)
15
+ schema = JSON.parse(json_from_file)
16
+ schemer = JSONSchemer.schema(schema)
17
+
18
+ # Perform validation if the "validate_site_config" flag is true.
19
+ if site.config.has_key?('validate_site_config') && site.config['validate_site_config']
20
+ unless schemer.valid?(site.config)
21
+ opensdg_notice('Site configuration invalid:')
22
+ errors = schemer.validate(site.config).to_a
23
+ errors.each { |error| opensdg_validation_error(error) }
24
+ opensdg_notice "The site configuration is not valid. See feedback above."
25
+ raise "Invalid site configuration"
26
+ end
27
+ end
28
+
29
+ # Regardless place the schema in site data so it can be used in Jekyll templates.
30
+ site.data['schema-site-config'] = schema
31
+
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
- module JekyllOpenSdgPlugins
2
- VERSION = "1.0.0.rc21".freeze
3
- end
1
+ module JekyllOpenSdgPlugins
2
+ VERSION = "1.2.0-beta1".freeze
3
+ end
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "jekyll", "3.8.4"
4
+ gem "html-proofer"
5
+ gem "jekyll-remote-theme"
6
+ gem "deep_merge"
7
+ gem "json_schemer"
@@ -0,0 +1,147 @@
1
+ # Jekyll configuration for Open SDG platform
2
+
3
+ validate_site_config: true
4
+ validate_indicator_config: true
5
+
6
+ baseurl: "/open-sdg-site-starter"
7
+ remote_data_prefix: "https://open-sdg.org/open-sdg-data-starter"
8
+ data_edit_url: http://prose.io/#open-sdg/open-sdg-data-starter/edit/develop/data/indicator_[id].csv
9
+ metadata_edit_url: http://prose.io/#open-sdg/open-sdg-data-starter/edit/develop/meta/[id].md
10
+ languages:
11
+ - en
12
+
13
+ title: Indicators For The Sustainable Development Goals
14
+ url: ""
15
+ data_dir: data
16
+ environment: staging
17
+
18
+ create_indicators:
19
+ layout: indicator
20
+ create_goals:
21
+ layout: goal-by-target-vertical
22
+ create_pages:
23
+ - folder: /
24
+ layout: frontpage-alt
25
+ - folder: /goals
26
+ layout: goals
27
+ - folder: /reporting-status
28
+ layout: reportingstatus
29
+ - filename: indicators.json
30
+ folder: /
31
+ layout: indicator-json
32
+ - folder: /search
33
+ layout: search
34
+
35
+ analytics:
36
+ ga_prod: ''
37
+
38
+ # Replace the email addresses below.
39
+ email_contacts:
40
+ questions: test@example.com
41
+ suggestions: test@example.com
42
+ functional: test@example.com
43
+
44
+ # International Support
45
+ # Eg name: Australia and adjective: Australian
46
+ country:
47
+ name: Australia
48
+ adjective: Australian
49
+
50
+ # Optionally set a title/body for the frontpage banner. The defaults below point to a standard
51
+ # translation, but feel free to change it as needed.
52
+ frontpage_introduction_banner:
53
+ title: frontpage.intro_title
54
+ description: frontpage.intro_body
55
+
56
+ frontpage_goals_grid:
57
+ title: Our data for Sustainable Development Goal indicators
58
+ description: Click on each goal for our Sustainable Development Goal global indicator data.
59
+
60
+ frontpage_cards:
61
+ - title: frontpage.download_all
62
+ include: components/download-all-data.html
63
+ - title: Lorem ipsum
64
+ content: |
65
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi mollis
66
+ cursus est sed dapibus.
67
+ button_label: Read more
68
+ button_link: https://example.com
69
+ - title: Nam vestibulum
70
+ content: |
71
+ Nam vestibulum, purus quis porttitor imperdiet, nisl sem mollis nisl, a
72
+ interdum risus enim vitae tortor. Donec feugiat accumsan rutrum.
73
+ button_label: Read more
74
+ button_link: https://example.com
75
+
76
+ # Pages
77
+ collections:
78
+ pages:
79
+ output: true
80
+ permalink: /:path/
81
+ posts:
82
+ output: true
83
+ permalink: /news/:year/:month/:day/:title.html
84
+ indicators:
85
+ output: true
86
+ goals:
87
+ output: true
88
+
89
+ # Menu
90
+ menu:
91
+ # Use these to customise the main navigation.
92
+ - path: /goals
93
+ # The "translation_key" refers to the key in the SDG Translations repository.
94
+ translation_key: general.goals
95
+ - path: /reporting-status
96
+ translation_key: menu.reporting_status
97
+ - path: /about
98
+ translation_key: menu.about
99
+ - path: /guidance
100
+ translation_key: menu.guidance
101
+ - path: /faq
102
+ translation_key: menu.faq
103
+ - path: /news
104
+ translation_key: menu.updates
105
+
106
+ footer_menu:
107
+ - path: mailto:my-email-address@example.com
108
+ translation_key: menu.contact_us
109
+ - path: https://twitter.com/MyTwitterAccount
110
+ translation_key: general.twitter
111
+ - path: https://facebook.com/MyFacebookAccount
112
+ translation_key: general.facebook
113
+ - path: /about/cookies-and-privacy/
114
+ translation_key: menu.cookies
115
+
116
+ # Configure the text (or "translation key") to be used on the
117
+ # non-global metadata tab.
118
+ non_global_metadata: indicator.national_metadata
119
+
120
+ # Set a base for all goal image URLs. Note that the full goal image path will be
121
+ # the base below, completed with: /[language]/[number].png (eg, /fr/6.png).
122
+ goal_image_base: https://open-sdg.org/sdg-translations/assets/img/goals
123
+
124
+ # Exclude some files/folders.
125
+ exclude:
126
+ - vendor
127
+ - scripts
128
+ - remotedata
129
+ - Gemfile
130
+ - Gemfile.lock
131
+ - README
132
+ - README.md
133
+ - LICENSE
134
+
135
+ # Optionally uncomment and update the settings below to control the mapping functionality.
136
+ # These are only a few of the possible settings. For more details, see:
137
+ # https://open-sdg.readthedocs.io/en/latest/maps/
138
+ #map_options:
139
+ # minZoom: 5
140
+ # tileURL: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
141
+ # tileOptions:
142
+ # attribution: 'My map attribution'
143
+ #map_layers:
144
+ # - min_zoom: 5
145
+ # max_zoom: 10
146
+ # subfolder: my-geojson-subfolder
147
+ # label: My map layer label (can be a translation key)
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.0.0.rc21
4
+ version: 1.2.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: 2020-02-14 00:00:00.000000000 Z
11
+ date: 2020-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json_schemer
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.2'
41
55
  description: Jekyll plugins for use with the Open SDG platform
42
56
  email:
43
57
  - brockfanning@gmail.com
@@ -46,8 +60,10 @@ extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
48
62
  - ".editorconfig"
63
+ - ".github/workflows/test-pull-requests.yml"
49
64
  - ".gitignore"
50
65
  - LICENSE
66
+ - Makefile
51
67
  - README.md
52
68
  - jekyll-open-sdg-plugins.gemspec
53
69
  - lib/jekyll-open-sdg-plugins.rb
@@ -56,12 +72,19 @@ files:
56
72
  - lib/jekyll-open-sdg-plugins/create_pages.rb
57
73
  - lib/jekyll-open-sdg-plugins/fetch_remote_data.rb
58
74
  - lib/jekyll-open-sdg-plugins/helpers.rb
75
+ - lib/jekyll-open-sdg-plugins/schema-indicator-config.json
76
+ - lib/jekyll-open-sdg-plugins/schema-site-config.json
59
77
  - lib/jekyll-open-sdg-plugins/sdg_variables.rb
60
78
  - lib/jekyll-open-sdg-plugins/search_index.rb
79
+ - lib/jekyll-open-sdg-plugins/site_configuration.rb
61
80
  - lib/jekyll-open-sdg-plugins/translate_date.rb
62
81
  - lib/jekyll-open-sdg-plugins/translate_key.rb
63
82
  - lib/jekyll-open-sdg-plugins/translate_metadata_field.rb
83
+ - lib/jekyll-open-sdg-plugins/validate_indicator_config.rb
84
+ - lib/jekyll-open-sdg-plugins/validate_site_config.rb
64
85
  - lib/jekyll-open-sdg-plugins/version.rb
86
+ - tests/Gemfile
87
+ - tests/_config.yml
65
88
  homepage: https://github.com/open-sdg/jekyll-open-sdg-plugins
66
89
  licenses:
67
90
  - MIT
@@ -81,8 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
104
  - !ruby/object:Gem::Version
82
105
  version: 1.3.1
83
106
  requirements: []
84
- rubyforge_project:
85
- rubygems_version: 2.7.1
107
+ rubygems_version: 3.1.4
86
108
  signing_key:
87
109
  specification_version: 4
88
110
  summary: Jekyll plugins for use with the Open SDG platform