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 +4 -4
- data/lib/jekyll-open-sdg-plugins.rb +1 -0
- data/lib/jekyll-open-sdg-plugins/create_goals.rb +3 -0
- data/lib/jekyll-open-sdg-plugins/create_indicators.rb +135 -19
- data/lib/jekyll-open-sdg-plugins/create_pages.rb +20 -5
- data/lib/jekyll-open-sdg-plugins/fetch_remote_data.rb +3 -2
- data/lib/jekyll-open-sdg-plugins/metadata_schema_to_config.rb +72 -0
- data/lib/jekyll-open-sdg-plugins/schema-indicator-config.json +226 -152
- data/lib/jekyll-open-sdg-plugins/schema-site-config.json +280 -33
- data/lib/jekyll-open-sdg-plugins/sdg_variables.rb +78 -9
- data/lib/jekyll-open-sdg-plugins/site_configuration.rb +9 -0
- data/lib/jekyll-open-sdg-plugins/translate_date.rb +25 -1
- data/lib/jekyll-open-sdg-plugins/version.rb +1 -1
- data/tests/_config.yml +10 -0
- metadata +3 -2
@@ -31,6 +31,15 @@ module JekyllOpenSdgPlugins
|
|
31
31
|
hash_to_hash(site.data['site_config_prod'], site.config)
|
32
32
|
end
|
33
33
|
|
34
|
+
# Look for environment variables for some settings.
|
35
|
+
env_settings = [
|
36
|
+
'REPOSITORY_URL_SITE',
|
37
|
+
]
|
38
|
+
env_settings.each do |setting|
|
39
|
+
if ENV.has_key?(setting)
|
40
|
+
site.config[setting.downcase] = ENV[setting]
|
41
|
+
end
|
42
|
+
end
|
34
43
|
end
|
35
44
|
|
36
45
|
# Copy properties from a hash onto another hash.
|
@@ -8,6 +8,8 @@ module Jekyll
|
|
8
8
|
# language of the current page and a date format given.
|
9
9
|
def t_date(date, format_type)
|
10
10
|
|
11
|
+
original = date
|
12
|
+
|
11
13
|
# Determine the language of the current page.
|
12
14
|
config = @context.registers[:site].config
|
13
15
|
translations = @context.registers[:site].data['translations']
|
@@ -57,7 +59,29 @@ module Jekyll
|
|
57
59
|
|
58
60
|
# Support timestamps.
|
59
61
|
if date.is_a? Integer
|
60
|
-
|
62
|
+
# Convert milliseconds to seconds if necessary.
|
63
|
+
if date > 9000000000
|
64
|
+
date = date / 1000
|
65
|
+
end
|
66
|
+
begin
|
67
|
+
date = Time.at(date).utc
|
68
|
+
rescue => err
|
69
|
+
return original
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Support other strings.
|
74
|
+
if date.is_a? String
|
75
|
+
begin
|
76
|
+
date = Time.parse(date).utc
|
77
|
+
rescue => err
|
78
|
+
return original
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Avoid nil errors.
|
83
|
+
unless date.is_a? Time
|
84
|
+
return original
|
61
85
|
end
|
62
86
|
|
63
87
|
# Convert the date into English.
|
data/tests/_config.yml
CHANGED
@@ -9,6 +9,7 @@ data_edit_url: http://prose.io/#open-sdg/open-sdg-data-starter/edit/develop/data
|
|
9
9
|
metadata_edit_url: http://prose.io/#open-sdg/open-sdg-data-starter/edit/develop/meta/[id].md
|
10
10
|
languages:
|
11
11
|
- en
|
12
|
+
- es
|
12
13
|
|
13
14
|
title: Indicators For The Sustainable Development Goals
|
14
15
|
url: ""
|
@@ -145,3 +146,12 @@ exclude:
|
|
145
146
|
# max_zoom: 10
|
146
147
|
# subfolder: my-geojson-subfolder
|
147
148
|
# label: My map layer label (can be a translation key)
|
149
|
+
|
150
|
+
site_config_form:
|
151
|
+
repository_link: https://github.com/open-sdg/open-sdg-site-starter
|
152
|
+
indicator_config_form:
|
153
|
+
repository_link: https://github.com/open-sdg/open-sdg-data-starter/tree/develop/meta
|
154
|
+
indicator_metadata_form:
|
155
|
+
repository_link: https://github.com/open-sdg/open-sdg-data-starter/tree/develop/meta
|
156
|
+
scopes:
|
157
|
+
- national
|
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
|
+
version: 1.4.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:
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/jekyll-open-sdg-plugins/create_pages.rb
|
73
73
|
- lib/jekyll-open-sdg-plugins/fetch_remote_data.rb
|
74
74
|
- lib/jekyll-open-sdg-plugins/helpers.rb
|
75
|
+
- lib/jekyll-open-sdg-plugins/metadata_schema_to_config.rb
|
75
76
|
- lib/jekyll-open-sdg-plugins/schema-indicator-config.json
|
76
77
|
- lib/jekyll-open-sdg-plugins/schema-site-config.json
|
77
78
|
- lib/jekyll-open-sdg-plugins/sdg_variables.rb
|