jekyll-open-sdg-plugins 1.0.0 → 1.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: c89259377d08cd8db1d38b04ab5de4d4de27ba7227a2c4746138105671e8e37e
4
- data.tar.gz: daec6e7ec6aac4c856091e49abce887f024d579e9215e71412515d25c079ca31
3
+ metadata.gz: 6e6f79d3292ae608202621743899fe24604ee67fc7bcc9ca90d26e91bf18e8d6
4
+ data.tar.gz: e09f66ec6f34a74e8b29d07f9dc75dcd2c3a4484daa3d02db45eb5140f2fd637
5
5
  SHA512:
6
- metadata.gz: 63721d734766ad0ed35c5a24331ea40adb1d46d3d9fea3aedf910efdd6029814df6d872e4cb73d178c630e65eb5790a7639ff21752345cd16ad103e7dd14474e
7
- data.tar.gz: cdd6d7dd52fc95cd927102db532cb1a9b4e506bb88b1272dfbdc11585125af1ff63ffc82990accb575bc863006f65f98c7f90eb190d4fdd4b5abd898d7b944cf
6
+ metadata.gz: d217ea0ac1fecaaf2e4d83f7d39d094be1f6d34277a52b5c34c0aa369effefb7589ec44e76d41d87ce437c84f0d1a6bcb47c657c04db751dac93fdbcb586bc19
7
+ data.tar.gz: 94d80452821f6793932b5be5342d6d99814caf52dd27cd5b27e000fe67b1893364d6da9c47bc1327743125e5b01c2a49431d4405f0c075a62dd77ff182a25819
@@ -1,16 +1,16 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- trim_trailing_whitespace = true
7
- insert_final_newline = true
8
-
9
- [*.{md,rb,gemspec},Makefile]
10
- charset = utf-8
11
-
12
- [Makefile]
13
- indent_style = tab
14
-
15
- [*.md]
16
- trim_trailing_whitespace = false
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ trim_trailing_whitespace = true
7
+ insert_final_newline = true
8
+
9
+ [*.{md,rb,gemspec},Makefile]
10
+ charset = utf-8
11
+
12
+ [Makefile]
13
+ indent_style = tab
14
+
15
+ [*.md]
16
+ trim_trailing_whitespace = false
@@ -0,0 +1,17 @@
1
+ name: Test PRs
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ test:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+ - name: Run all tests
17
+ run: make test
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
- _site
2
- .sass-cache
3
- .jekyll-metadata
4
- *.gem
1
+ _site
2
+ .sass-cache
3
+ .jekyll-metadata
4
+ *.gem
5
+ open-sdg/
6
+ open-sdg-site-starter/
@@ -0,0 +1,33 @@
1
+ .PHONY: clean build serve serve.detached
2
+ all: test
3
+
4
+ clean:
5
+ # Stop the detached Jekyll web server.
6
+ -pkill -f -9 jekyll
7
+ # Delete the builds.
8
+ rm -fr open-sdg-site-starter
9
+ rm -fr open-sdg
10
+
11
+ install: clean
12
+ git clone https://github.com/open-sdg/open-sdg-site-starter.git
13
+ git clone https://github.com/open-sdg/open-sdg.git
14
+ # Copy all the theme files into the site starter.
15
+ cp -r open-sdg/_includes/* open-sdg-site-starter/_includes/
16
+ cp -r open-sdg/_layouts/* open-sdg-site-starter/_layouts/
17
+ cp -r open-sdg/_sass/* open-sdg-site-starter/_sass/
18
+ cp -r open-sdg/assets/* open-sdg-site-starter/assets/
19
+ # Copy the required files into the site starter.
20
+ cp tests/_config.yml open-sdg-site-starter/
21
+ cp tests/Gemfile open-sdg-site-starter/
22
+ # Create a symlink to our plugin files.
23
+ ln -s ../lib/jekyll-open-sdg-plugins open-sdg-site-starter/_plugins
24
+ # Install Ruby dependencies.
25
+ cd open-sdg-site-starter && bundle install
26
+
27
+ build:
28
+ cd open-sdg-site-starter && bundle exec jekyll build
29
+
30
+ serve:
31
+ cd open-sdg-site-starter && bundle exec jekyll serve
32
+
33
+ test: install build
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # jekyll-open-sdg-plugins
2
-
3
- > 💎 Jekyll plugins for use with the Open SDG platform
4
-
5
- This plugin provides required Jekyll functionality for the [Open SDG](https://github.com/open-sdg/open-sdg) platform.
6
-
7
- The details on this functionality can be found throughout the [Open SDG documentation](https://open-sdg.readthedocs.io/en/latest/).
1
+ # jekyll-open-sdg-plugins
2
+
3
+ > 💎 Jekyll plugins for use with the Open SDG platform
4
+
5
+ This plugin provides required Jekyll functionality for the [Open SDG](https://github.com/open-sdg/open-sdg) platform.
6
+
7
+ The details on this functionality can be found throughout the [Open SDG documentation](https://open-sdg.readthedocs.io/en/latest/).
@@ -1,17 +1,17 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "jekyll-open-sdg-plugins/version"
4
- Gem::Specification.new do |spec|
5
- spec.name = "jekyll-open-sdg-plugins"
6
- spec.summary = "Jekyll plugins for use with the Open SDG platform"
7
- spec.description = "Jekyll plugins for use with the Open SDG platform"
8
- spec.version = JekyllOpenSdgPlugins::VERSION
9
- spec.authors = ["Brock Fanning"]
10
- spec.email = ["brockfanning@gmail.com"]
11
- spec.homepage = "https://github.com/open-sdg/jekyll-open-sdg-plugins"
12
- spec.licenses = ["MIT"]
13
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
14
- spec.require_paths = ["lib"]
15
- spec.add_dependency "jekyll", "~> 3.0"
16
- spec.add_dependency "deep_merge", "~> 1.2"
17
- end
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "jekyll-open-sdg-plugins/version"
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "jekyll-open-sdg-plugins"
6
+ spec.summary = "Jekyll plugins for use with the Open SDG platform"
7
+ spec.description = "Jekyll plugins for use with the Open SDG platform"
8
+ spec.version = JekyllOpenSdgPlugins::VERSION
9
+ spec.authors = ["Brock Fanning"]
10
+ spec.email = ["brockfanning@gmail.com"]
11
+ spec.homepage = "https://github.com/open-sdg/jekyll-open-sdg-plugins"
12
+ spec.licenses = ["MIT"]
13
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
14
+ spec.require_paths = ["lib"]
15
+ spec.add_dependency "jekyll", "~> 3.0"
16
+ spec.add_dependency "deep_merge", "~> 1.2"
17
+ end
@@ -1,13 +1,14 @@
1
- require_relative "jekyll-open-sdg-plugins/version"
2
- require_relative "jekyll-open-sdg-plugins/fetch_remote_data"
3
- require_relative "jekyll-open-sdg-plugins/translate_key"
4
- require_relative "jekyll-open-sdg-plugins/translate_date"
5
- require_relative "jekyll-open-sdg-plugins/translate_metadata_field"
6
- require_relative "jekyll-open-sdg-plugins/create_indicators"
7
- require_relative "jekyll-open-sdg-plugins/create_goals"
8
- require_relative "jekyll-open-sdg-plugins/create_pages"
9
- require_relative "jekyll-open-sdg-plugins/sdg_variables"
10
- require_relative "jekyll-open-sdg-plugins/search_index"
11
-
12
- module JekyllOpenSdgPlugins
13
- end
1
+ require_relative "jekyll-open-sdg-plugins/version"
2
+ require_relative "jekyll-open-sdg-plugins/site_configuration"
3
+ require_relative "jekyll-open-sdg-plugins/fetch_remote_data"
4
+ require_relative "jekyll-open-sdg-plugins/translate_key"
5
+ require_relative "jekyll-open-sdg-plugins/translate_date"
6
+ require_relative "jekyll-open-sdg-plugins/translate_metadata_field"
7
+ require_relative "jekyll-open-sdg-plugins/create_indicators"
8
+ require_relative "jekyll-open-sdg-plugins/create_goals"
9
+ require_relative "jekyll-open-sdg-plugins/create_pages"
10
+ require_relative "jekyll-open-sdg-plugins/sdg_variables"
11
+ require_relative "jekyll-open-sdg-plugins/search_index"
12
+
13
+ module JekyllOpenSdgPlugins
14
+ end
@@ -1,75 +1,75 @@
1
- require "jekyll"
2
- require_relative "helpers"
3
-
4
- module JekyllOpenSdgPlugins
5
- class CreateGoals < Jekyll::Generator
6
- safe true
7
- priority :normal
8
-
9
- def generate(site)
10
- # If site.create_goals is set, create goals per the metadata.
11
- if site.config['languages'] and site.config['create_goals']
12
- # Compile the list of goals.
13
- goals = {}
14
- # Are we using translated builds?
15
- metadata = {}
16
- if opensdg_translated_builds(site)
17
- # If we are using translated builds, the 'meta' data is underneath
18
- # language codes. We just use the first language.
19
- default_language = site.config['languages'][0]
20
- metadata = site.data[default_language]['meta']
21
- else
22
- # Otherwise the 'meta' data is not underneath any language code.
23
- metadata = site.data['meta']
24
- end
25
- metadata.each do |inid, indicator|
26
- goal = inid.split('-')[0].to_i
27
- goals[goal] = true
28
- end
29
- # Decide what layout to use for the goal pages.
30
- layout = 'goal'
31
- if site.config['create_goals'].key?('layout')
32
- layout = site.config['create_goals']['layout']
33
- end
34
- # See if we need to "map" any language codes.
35
- languages_public = Hash.new
36
- if site.config['languages_public']
37
- languages_public = site.config['languages_public']
38
- end
39
- # Loop through the languages.
40
- site.config['languages'].each_with_index do |language, index|
41
- # Get the "public language" (for URLs) which may be different.
42
- language_public = language
43
- if languages_public[language]
44
- language_public = languages_public[language]
45
- end
46
- # Loop through the goals.
47
- goals.sort.each do |goal, value|
48
- # Add the language subfolder for all except the default (first) language.
49
- dir = index == 0 ? goal.to_s : File.join(language_public, goal.to_s)
50
- # Create the goal page.
51
- site.collections['goals'].docs << GoalPage.new(site, site.source, dir, goal, language, layout)
52
- end
53
- end
54
- end
55
- end
56
- end
57
-
58
- # A Page subclass used in the `CreateGoals` class.
59
- class GoalPage < Jekyll::Page
60
- def initialize(site, base, dir, goal, language, layout)
61
- @site = site
62
- @base = base
63
- @dir = dir
64
- @name = 'index.html'
65
-
66
- self.process(@name)
67
- self.data = {}
68
- self.data['goal_number'] = goal.to_s
69
- self.data['language'] = language
70
- self.data['layout'] = layout
71
- # Backwards compatibility:
72
- self.data['sdg_goal'] = self.data['goal_number']
73
- end
74
- end
75
- end
1
+ require "jekyll"
2
+ require_relative "helpers"
3
+
4
+ module JekyllOpenSdgPlugins
5
+ class CreateGoals < Jekyll::Generator
6
+ safe true
7
+ priority :normal
8
+
9
+ def generate(site)
10
+ # If site.create_goals is set, create goals per the metadata.
11
+ if site.config['languages'] and site.config['create_goals']
12
+ # Compile the list of goals.
13
+ goals = {}
14
+ # Are we using translated builds?
15
+ metadata = {}
16
+ if opensdg_translated_builds(site)
17
+ # If we are using translated builds, the 'meta' data is underneath
18
+ # language codes. We just use the first language.
19
+ default_language = site.config['languages'][0]
20
+ metadata = site.data[default_language]['meta']
21
+ else
22
+ # Otherwise the 'meta' data is not underneath any language code.
23
+ metadata = site.data['meta']
24
+ end
25
+ metadata.each do |inid, indicator|
26
+ goal = inid.split('-')[0].to_i
27
+ goals[goal] = true
28
+ end
29
+ # Decide what layout to use for the goal pages.
30
+ layout = 'goal'
31
+ if site.config['create_goals'].key?('layout')
32
+ layout = site.config['create_goals']['layout']
33
+ end
34
+ # See if we need to "map" any language codes.
35
+ languages_public = Hash.new
36
+ if site.config['languages_public']
37
+ languages_public = opensdg_languages_public(site)
38
+ end
39
+ # Loop through the languages.
40
+ site.config['languages'].each_with_index do |language, index|
41
+ # Get the "public language" (for URLs) which may be different.
42
+ language_public = language
43
+ if languages_public[language]
44
+ language_public = languages_public[language]
45
+ end
46
+ # Loop through the goals.
47
+ goals.sort.each do |goal, value|
48
+ # Add the language subfolder for all except the default (first) language.
49
+ dir = index == 0 ? goal.to_s : File.join(language_public, goal.to_s)
50
+ # Create the goal page.
51
+ site.collections['goals'].docs << GoalPage.new(site, site.source, dir, goal, language, layout)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+ # A Page subclass used in the `CreateGoals` class.
59
+ class GoalPage < Jekyll::Page
60
+ def initialize(site, base, dir, goal, language, layout)
61
+ @site = site
62
+ @base = base
63
+ @dir = dir
64
+ @name = 'index.html'
65
+
66
+ self.process(@name)
67
+ self.data = {}
68
+ self.data['goal_number'] = goal.to_s
69
+ self.data['language'] = language
70
+ self.data['layout'] = layout
71
+ # Backwards compatibility:
72
+ self.data['sdg_goal'] = self.data['goal_number']
73
+ end
74
+ end
75
+ end
@@ -1,67 +1,67 @@
1
- require "jekyll"
2
- require_relative "helpers"
3
-
4
- module JekyllOpenSdgPlugins
5
- class CreateIndicators < Jekyll::Generator
6
- safe true
7
- priority :normal
8
-
9
- def generate(site)
10
- # If site.create_indicators is set, create indicators per the metadata.
11
- if site.config['languages'] and site.config['create_indicators']
12
- # Decide what layout to use for the indicator pages.
13
- layout = 'indicator'
14
- if site.config['create_indicators'].key?('layout')
15
- layout = site.config['create_indicators']['layout']
16
- end
17
- # See if we need to "map" any language codes.
18
- languages_public = Hash.new
19
- if site.config['languages_public']
20
- languages_public = site.config['languages_public']
21
- end
22
- # Loop through the languages.
23
- site.config['languages'].each_with_index do |language, index|
24
- # Get the "public language" (for URLs) which may be different.
25
- language_public = language
26
- if languages_public[language]
27
- language_public = languages_public[language]
28
- end
29
- metadata = {}
30
- if opensdg_translated_builds(site)
31
- # If we are using translated builds, the metadata is underneath a
32
- # language code.
33
- metadata = site.data[language]['meta']
34
- else
35
- # Otherwise the 'meta' data is not underneath any language code.
36
- metadata = site.data['meta']
37
- end
38
- # Loop through the indicators (using metadata as a list).
39
- metadata.each do |inid, meta|
40
- # Add the language subfolder for all except the default (first) language.
41
- dir = index == 0 ? inid : File.join(language_public, inid)
42
- # Create the indicator page.
43
- site.collections['indicators'].docs << IndicatorPage.new(site, site.source, dir, inid, language, layout)
44
- end
45
- end
46
- end
47
- end
48
- end
49
-
50
- # A Page subclass used in the `CreateIndicators` class.
51
- class IndicatorPage < Jekyll::Page
52
- def initialize(site, base, dir, inid, language, layout)
53
- @site = site
54
- @base = base
55
- @dir = dir
56
- @name = 'index.html'
57
-
58
- self.process(@name)
59
- self.data = {}
60
- self.data['indicator_number'] = inid.gsub('-', '.')
61
- self.data['layout'] = layout
62
- self.data['language'] = language
63
- # Backwards compatibility:
64
- self.data['indicator'] = self.data['indicator_number']
65
- end
66
- end
67
- end
1
+ require "jekyll"
2
+ require_relative "helpers"
3
+
4
+ module JekyllOpenSdgPlugins
5
+ class CreateIndicators < Jekyll::Generator
6
+ safe true
7
+ priority :normal
8
+
9
+ def generate(site)
10
+ # If site.create_indicators is set, create indicators per the metadata.
11
+ if site.config['languages'] and site.config['create_indicators']
12
+ # Decide what layout to use for the indicator pages.
13
+ layout = 'indicator'
14
+ if site.config['create_indicators'].key?('layout')
15
+ layout = site.config['create_indicators']['layout']
16
+ end
17
+ # See if we need to "map" any language codes.
18
+ languages_public = Hash.new
19
+ if site.config['languages_public']
20
+ languages_public = opensdg_languages_public(site)
21
+ end
22
+ # Loop through the languages.
23
+ site.config['languages'].each_with_index do |language, index|
24
+ # Get the "public language" (for URLs) which may be different.
25
+ language_public = language
26
+ if languages_public[language]
27
+ language_public = languages_public[language]
28
+ end
29
+ metadata = {}
30
+ if opensdg_translated_builds(site)
31
+ # If we are using translated builds, the metadata is underneath a
32
+ # language code.
33
+ metadata = site.data[language]['meta']
34
+ else
35
+ # Otherwise the 'meta' data is not underneath any language code.
36
+ metadata = site.data['meta']
37
+ end
38
+ # Loop through the indicators (using metadata as a list).
39
+ metadata.each do |inid, meta|
40
+ # Add the language subfolder for all except the default (first) language.
41
+ dir = index == 0 ? inid : File.join(language_public, inid)
42
+ # Create the indicator page.
43
+ site.collections['indicators'].docs << IndicatorPage.new(site, site.source, dir, inid, language, layout)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ # A Page subclass used in the `CreateIndicators` class.
51
+ class IndicatorPage < Jekyll::Page
52
+ def initialize(site, base, dir, inid, language, layout)
53
+ @site = site
54
+ @base = base
55
+ @dir = dir
56
+ @name = 'index.html'
57
+
58
+ self.process(@name)
59
+ self.data = {}
60
+ self.data['indicator_number'] = inid.gsub('-', '.')
61
+ self.data['layout'] = layout
62
+ self.data['language'] = language
63
+ # Backwards compatibility:
64
+ self.data['indicator'] = self.data['indicator_number']
65
+ end
66
+ end
67
+ end