jekyll-data-revised 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/jekyll-data.rb +9 -4
- data/lib/jekyll-data/reader.rb +1 -2
- data/lib/jekyll-data/theme_configuration.rb +1 -1
- data/lib/jekyll-data/theme_data_reader.rb +0 -2
- data/lib/jekyll-data/themed_site_drop.rb +3 -2
- data/lib/jekyll-data/version.rb +1 -3
- data/lib/jekyll/build_options.rb +0 -2
- data/lib/jekyll/data_path.rb +1 -3
- data/lib/jekyll/theme_drop.rb +6 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8235a1de5929de3afae76827b3d20547fd0ff9837b8aa7d4d3a553a007efc8dd
|
4
|
+
data.tar.gz: 5eae835b1f3023ce3e242a8d3e1cadac9a9e2a56d0b335aba3ed3b0587f627bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d000fd359099279f80bf071947e8dab18d4d450109c3848fe76186b5f3f180ed4c39bda9d43103378cd8332b901a1b667b8a3bb71fedd9f8f7dbb0b6ac9182a
|
7
|
+
data.tar.gz: 5758af8fe853e8948ce9fb0a620c9dabcbe6b8c596199c8505ea0cd583dfa38adf8a18e89026e296de0a9f2034ed1f52865fdc4f861bf9e56f2dfc288c7c01f7
|
data/README.md
CHANGED
@@ -29,6 +29,8 @@ end
|
|
29
29
|
|
30
30
|
## Usage
|
31
31
|
|
32
|
+
**Note:** *This plugin will only run in conjunction with a gem-based Jekyll-theme.*
|
33
|
+
|
32
34
|
As long as the plugin-gem has been installed properly, and is included in the Gemfile's `:jekyll_plugins` group, data files supported by Jekyll and present in the `_data` directory at the root of your theme-gem will be read. Their contents will be added to the site's internal data hash, provided, an identical data hash doesn't already exist at the site-source.
|
33
35
|
|
34
36
|
If the theme-gem also includes a `_config.yml` at its root, then it will be read as well. The resulting config hash will be mixed into the site's existing config hash, filling in where the *keys* are not already defined. In other words, the config file at `source` will override corresponding identical keys in a `_config.yml` within the theme-gem which would in turn override corresponding `DEFAULTS` from Jekyll:
|
data/lib/jekyll-data.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
require "jekyll"
|
4
2
|
require "jekyll-data/version"
|
5
3
|
|
@@ -16,7 +14,8 @@ require_relative "jekyll/data_path"
|
|
16
14
|
require_relative "jekyll/theme_drop"
|
17
15
|
|
18
16
|
# ----------------------------------------------------------------------------
|
19
|
-
# Modify the current site instance
|
17
|
+
# Modify the current site instance if it uses a gem-based theme else have this
|
18
|
+
# plugin disabled.
|
20
19
|
#
|
21
20
|
# if a '_config.yml' is present at the root of theme-gem, it is evaluated and
|
22
21
|
# the extracted hash data is incorprated into the site's config hash.
|
@@ -25,6 +24,12 @@ Jekyll::Hooks.register :site, :after_reset do |site|
|
|
25
24
|
if site.theme
|
26
25
|
file = site.in_theme_dir("_config.yml")
|
27
26
|
JekyllData::ThemeConfiguration.reconfigure(site) if File.exist?(file)
|
27
|
+
else
|
28
|
+
Jekyll.logger.abort_with(
|
29
|
+
"JekyllData:",
|
30
|
+
"Error! This plugin only works with gem-based jekyll-themes. " \
|
31
|
+
"Please disable this plugin to proceed."
|
32
|
+
)
|
28
33
|
end
|
29
34
|
end
|
30
35
|
|
@@ -38,7 +43,7 @@ end
|
|
38
43
|
Jekyll::Hooks.register :site, :after_init do |site|
|
39
44
|
if site.theme
|
40
45
|
file = site.in_theme_dir("_config.yml")
|
41
|
-
Jekyll.logger.
|
46
|
+
Jekyll.logger.info "Theme Config file:", file if File.exist?(file)
|
42
47
|
site.reader = JekyllData::Reader.new(site)
|
43
48
|
end
|
44
49
|
end
|
data/lib/jekyll-data/reader.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# encoding: UTF-8
|
2
2
|
|
3
3
|
module JekyllData
|
4
4
|
class ThemedSiteDrop < Jekyll::Drops::SiteDrop
|
@@ -9,6 +9,7 @@ module JekyllData
|
|
9
9
|
def_delegator :@obj, :site_data, :data
|
10
10
|
def_delegators :@obj, :theme
|
11
11
|
|
12
|
-
private
|
12
|
+
private
|
13
|
+
def_delegator :@obj, :config, :fallback_data
|
13
14
|
end
|
14
15
|
end
|
data/lib/jekyll-data/version.rb
CHANGED
data/lib/jekyll/build_options.rb
CHANGED
data/lib/jekyll/data_path.rb
CHANGED
data/lib/jekyll/theme_drop.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# encoding: UTF-8
|
2
2
|
|
3
3
|
module Jekyll
|
4
4
|
module Drops
|
5
5
|
class UnifiedPayloadDrop < Drop
|
6
|
+
def site
|
7
|
+
@site_drop ||= JekyllData::ThemedSiteDrop.new(@obj)
|
8
|
+
end
|
9
|
+
|
6
10
|
# Register a namespace to easily call subkeys under <theme-name> key
|
7
11
|
# in the _config.yml within a theme-gem via its bundled templates.
|
8
12
|
# e.g. with this drop, theme-specific variables usually called like
|
9
13
|
# {{ site.minima.date_format }} can be shortened to simply
|
10
14
|
# {{ theme.date_format }}.
|
11
15
|
def theme
|
12
|
-
@theme_drop ||=
|
13
|
-
config = site.send(:fallback_data)
|
14
|
-
config[config["theme"]]
|
15
|
-
end
|
16
|
+
@theme_drop ||= site[site.theme.name]
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-data-revised
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashwin Maroli
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.
|
95
|
+
version: 0.47.1
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 0.
|
102
|
+
version: 0.47.1
|
103
103
|
description:
|
104
104
|
email:
|
105
105
|
- ashmaroli@gmail.com
|