Skip to content

Commit a11e5a4

Browse files
authored
Merge pull request #22 from ashmaroli/refactor-patches
Refactor patches to Jekyll module
2 parents 9428bf9 + b754f57 commit a11e5a4

File tree

5 files changed

+29
-97
lines changed

5 files changed

+29
-97
lines changed

lib/jekyll-data.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ module JekyllData
99
end
1010

1111
# Monkey-patches
12-
require_relative "jekyll/theme"
1312
require_relative "jekyll/build_options"
14-
require_relative "jekyll/unified_payload_drop"
13+
require_relative "jekyll/data_path"
14+
require_relative "jekyll/theme_drop"
1515

1616
# ----------------------------------------------------------------------------
1717
# Modify the current site instance if it uses a gem-based theme else have this

lib/jekyll/data_path.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Jekyll
2+
class Theme
3+
def data_path
4+
path_for "_data".freeze
5+
end
6+
end
7+
end

lib/jekyll/theme.rb

Lines changed: 0 additions & 66 deletions
This file was deleted.

lib/jekyll/theme_drop.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# encoding: UTF-8
2+
3+
module Jekyll
4+
module Drops
5+
class UnifiedPayloadDrop < Drop
6+
def site
7+
@site_drop ||= JekyllData::ThemedSiteDrop.new(@obj)
8+
end
9+
10+
# Register a namespace to easily call subkeys under <theme-name> key
11+
# in the _config.yml within a theme-gem via its bundled templates.
12+
# e.g. with this drop, theme-specific variables usually called like
13+
# {{ site.minima.date_format }} can be shortened to simply
14+
# {{ theme.date_format }}.
15+
def theme
16+
@theme_drop ||= site[site.theme.name]
17+
end
18+
end
19+
end
20+
end

lib/jekyll/unified_payload_drop.rb

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)