jekyll-assets 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +13 -9
- data/README.md +36 -10
- data/Rakefile +40 -0
- data/lib/jekyll/assets.rb +13 -10
- data/lib/jekyll/assets/addons.rb +7 -6
- data/lib/jekyll/assets/addons/processors/liquid.rb +31 -0
- data/lib/jekyll/assets/addons/proxies/magick.rb +10 -8
- data/lib/jekyll/assets/config.rb +11 -8
- data/lib/jekyll/assets/env.rb +33 -17
- data/lib/jekyll/assets/hook.rb +17 -18
- data/lib/jekyll/assets/hooks.rb +13 -14
- data/lib/jekyll/assets/hooks/context_patches.rb +2 -2
- data/lib/jekyll/assets/hooks/helpers.rb +1 -1
- data/lib/jekyll/assets/hooks/jekyll/{asset_drops.rb → drops.rb} +1 -1
- data/lib/jekyll/assets/hooks/jekyll/setup.rb +13 -0
- data/lib/jekyll/assets/hooks/jekyll/{write_assets.rb → write.rb} +0 -0
- data/lib/jekyll/assets/hooks/sources.rb +2 -1
- data/lib/jekyll/assets/liquid.rb +3 -3
- data/lib/jekyll/assets/liquid/drop.rb +3 -3
- data/lib/jekyll/assets/liquid/filters.rb +5 -12
- data/lib/jekyll/assets/liquid/tag.rb +31 -37
- data/lib/jekyll/assets/liquid/tag/defaults.rb +2 -3
- data/lib/jekyll/assets/liquid/tag/defaults/image.rb +5 -5
- data/lib/jekyll/assets/liquid/tag/parser.rb +47 -55
- data/lib/jekyll/assets/liquid/tag/proxied_asset.rb +6 -10
- data/lib/jekyll/assets/liquid/tag/proxies.rb +19 -32
- data/lib/jekyll/assets/logger.rb +7 -6
- data/lib/jekyll/assets/patches.rb +4 -4
- data/lib/jekyll/assets/patches/kernel.rb +1 -1
- data/lib/jekyll/assets/version.rb +1 -1
- metadata +14 -14
- data/lib/jekyll/assets/hooks/jekyll/ignore.rb +0 -9
- data/lib/jekyll/assets/hooks/jekyll/initialize.rb +0 -7
data/lib/jekyll/assets/hook.rb
CHANGED
@@ -7,19 +7,18 @@ module Jekyll
|
|
7
7
|
class Hook
|
8
8
|
class UnknownHookError < RuntimeError
|
9
9
|
def initialize(base: nil, point: nil)
|
10
|
-
|
11
|
-
return super "Unknown hook point '#{point}' given."
|
10
|
+
super "Unknown hook #{base ? "base" : "point"} '#{base || point}'"
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
|
-
|
14
|
+
HOOK_ALIASES = {
|
16
15
|
:env => {
|
17
16
|
:post_init => :init,
|
18
|
-
|
17
|
+
:pre_init => :init
|
19
18
|
}
|
20
19
|
}
|
21
20
|
|
22
|
-
|
21
|
+
HOOK_POINTS = {
|
23
22
|
:env => [
|
24
23
|
:init
|
25
24
|
]
|
@@ -33,10 +32,10 @@ module Jekyll
|
|
33
32
|
# proc we got and then you can do as you please (such as instance eval)
|
34
33
|
# but if you do not give us one then we simply pass the args.
|
35
34
|
|
36
|
-
def self.trigger(base,
|
35
|
+
def self.trigger(base, point_, *args, &block)
|
37
36
|
raise ArgumentError, "Do not give args with a block" if args.size > 0 && block_given?
|
38
|
-
if all.
|
39
|
-
Set.new.merge(point(base,
|
37
|
+
if all.key?(base) && all[base].key?(point_)
|
38
|
+
Set.new.merge(point(base, point_, :early)).merge(point(base, point_)).map do |v|
|
40
39
|
block_given?? block.call(v) : v.call(*args)
|
41
40
|
end
|
42
41
|
end
|
@@ -44,25 +43,25 @@ module Jekyll
|
|
44
43
|
|
45
44
|
#
|
46
45
|
|
47
|
-
def self.point(base, point,
|
46
|
+
def self.point(base, point, when_ = :late)
|
48
47
|
point = all[base][point] ||= {
|
49
|
-
|
50
|
-
:
|
48
|
+
:early => Set.new,
|
49
|
+
:late => Set.new
|
51
50
|
}
|
52
51
|
|
53
|
-
point[
|
52
|
+
point[when_]
|
54
53
|
end
|
55
54
|
|
56
55
|
#
|
57
56
|
|
58
|
-
def self.register(base, point,
|
59
|
-
raise UnknownHookError
|
60
|
-
point =
|
61
|
-
raise UnknownHookError
|
57
|
+
def self.register(base, point, when_ = :late, &block)
|
58
|
+
raise UnknownHookError, base: base unless HOOK_POINTS.key?(base)
|
59
|
+
point = HOOK_ALIASES[base][point] if HOOK_ALIASES.fetch(base, {}).key?(point)
|
60
|
+
raise UnknownHookError, point: point unless HOOK_POINTS[base].include?(point)
|
62
61
|
all[base] ||= {}
|
63
62
|
|
64
|
-
point(base, point,
|
65
|
-
add(block)
|
63
|
+
point(base, point, when_) \
|
64
|
+
.add(block)
|
66
65
|
end
|
67
66
|
end
|
68
67
|
end
|
data/lib/jekyll/assets/hooks.rb
CHANGED
@@ -2,18 +2,17 @@
|
|
2
2
|
# Copyright: 2012-2015 - MIT License
|
3
3
|
# Encoding: utf-8
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
require_relative "hooks/jekyll/ignore"
|
5
|
+
require "jekyll/assets/hooks/jekyll/drops"
|
6
|
+
require "jekyll/assets/hooks/jekyll/setup"
|
7
|
+
require "jekyll/assets/hooks/jekyll/write"
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
require "jekyll/assets/hooks/compression"
|
10
|
+
require "jekyll/assets/hooks/configuration"
|
11
|
+
require "jekyll/assets/hooks/context_patches"
|
12
|
+
require "jekyll/assets/hooks/disable_erb"
|
13
|
+
require "jekyll/assets/hooks/helpers"
|
14
|
+
require "jekyll/assets/hooks/logger"
|
15
|
+
require "jekyll/assets/hooks/sources"
|
16
|
+
require "jekyll/assets/hooks/sprockets"
|
17
|
+
require "jekyll/assets/hooks/version"
|
18
|
+
require "jekyll/assets/hooks/cache"
|
@@ -5,13 +5,13 @@
|
|
5
5
|
Jekyll::Assets::Hook.register :env, :init do
|
6
6
|
context_class.class_eval do
|
7
7
|
alias_method :_old_asset_path, :asset_path
|
8
|
-
def asset_path(asset,
|
8
|
+
def asset_path(asset, _ = {})
|
9
9
|
out = _old_asset_path asset
|
10
10
|
|
11
11
|
return unless out
|
12
12
|
path = environment.find_asset(resolve(asset))
|
13
13
|
environment.parent.used.add(path)
|
14
|
-
|
14
|
+
out
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Frozen-string-literal: true
|
2
|
+
# Copyright: 2012-2015 - MIT License
|
3
|
+
# Encoding: utf-8
|
4
|
+
|
5
|
+
Jekyll::Hooks.register :site, :after_reset do |jekyll|
|
6
|
+
Jekyll::Assets::Env.new(jekyll)
|
7
|
+
|
8
|
+
jekyll.sprockets.excludes.each do |exclude|
|
9
|
+
unless jekyll.config["exclude"].grep(%r!\A#{Regexp.escape(exclude)}/?!).size > 0
|
10
|
+
jekyll.config["exclude"] << exclude
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
File without changes
|
data/lib/jekyll/assets/liquid.rb
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
module Jekyll
|
6
6
|
module Assets
|
7
7
|
module Liquid
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
require "jekyll/assets/liquid/tag"
|
9
|
+
require "jekyll/assets/liquid/filters"
|
10
|
+
require "jekyll/assets/liquid/drop"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright: 2012-2015 - MIT License
|
3
3
|
# Encoding: utf-8
|
4
4
|
|
5
|
-
|
5
|
+
autoload :FastImage, "fastimage"
|
6
6
|
|
7
7
|
module Jekyll
|
8
8
|
module Assets
|
@@ -44,14 +44,14 @@ module Jekyll
|
|
44
44
|
|
45
45
|
private
|
46
46
|
def image?
|
47
|
-
%(image/png image/jpeg image/gif).include?(
|
47
|
+
%W(image/png image/jpeg image/gif).include?(
|
48
48
|
asset.content_type
|
49
49
|
)
|
50
50
|
end
|
51
51
|
|
52
52
|
private
|
53
53
|
def asset
|
54
|
-
|
54
|
+
@asset ||= @jekyll.sprockets.find_asset(@path)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -6,20 +6,13 @@ module Jekyll
|
|
6
6
|
module Assets
|
7
7
|
module Liquid
|
8
8
|
module Filters
|
9
|
-
|
10
|
-
|
11
|
-
image
|
12
|
-
asset_path
|
13
|
-
stylesheet
|
14
|
-
javascript
|
15
|
-
style
|
16
|
-
img
|
17
|
-
js
|
18
|
-
)
|
9
|
+
ACCEPTABLE_FILTERS = %W(css image asset_path stylesheet
|
10
|
+
javascript style img js)
|
19
11
|
|
20
|
-
|
12
|
+
ACCEPTABLE_FILTERS.each do |val|
|
21
13
|
define_method val do |path, args = ""|
|
22
|
-
Tag.send(:new, val, "#{path} #{args}", "")
|
14
|
+
tag = Tag.send(:new, val, "#{path} #{args}", "")
|
15
|
+
tag.render(@context)
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -2,21 +2,18 @@
|
|
2
2
|
# Copyright: 2012-2015 - MIT License
|
3
3
|
# Encoding: utf-8
|
4
4
|
|
5
|
-
require "fastimage"
|
6
|
-
|
7
5
|
module Jekyll
|
8
6
|
module Assets
|
9
7
|
module Liquid
|
10
8
|
class Tag < ::Liquid::Tag
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
autoload :Proxies, "jekyll/assets/liquid/tag/proxies"
|
10
|
+
autoload :ProxiedAsset, "jekyll/assets/liquid/tag/proxied_asset"
|
11
|
+
autoload :Defaults, "jekyll/assets/liquid/tag/defaults"
|
12
|
+
autoload :Parser, "jekyll/assets/liquid/tag/parser"
|
15
13
|
attr_reader :args
|
16
14
|
|
17
15
|
class << self
|
18
|
-
public
|
19
|
-
:new
|
16
|
+
public :new
|
20
17
|
end
|
21
18
|
|
22
19
|
class AssetNotFoundError < StandardError
|
@@ -38,15 +35,15 @@ module Jekyll
|
|
38
35
|
asset
|
39
36
|
css
|
40
37
|
js
|
41
|
-
)
|
38
|
+
).freeze
|
42
39
|
|
43
40
|
#
|
44
41
|
|
45
42
|
Tags = {
|
46
|
-
"css" => %
|
47
|
-
"js" => %
|
48
|
-
"img" => %
|
49
|
-
}
|
43
|
+
"css" => %{<link type="text/css" rel="stylesheet" href="%s"%s>},
|
44
|
+
"js" => %{<script type="text/javascript" src="%s"%s></script>},
|
45
|
+
"img" => %{<img src="%s"%s>}
|
46
|
+
}.freeze
|
50
47
|
|
51
48
|
#
|
52
49
|
|
@@ -55,7 +52,7 @@ module Jekyll
|
|
55
52
|
"stylesheet" => "css",
|
56
53
|
"javascript" => "js",
|
57
54
|
"style" => "css"
|
58
|
-
}
|
55
|
+
}.freeze
|
59
56
|
|
60
57
|
#
|
61
58
|
|
@@ -74,25 +71,24 @@ module Jekyll
|
|
74
71
|
# because of a single asset change.
|
75
72
|
|
76
73
|
def render(context)
|
77
|
-
args =
|
74
|
+
args = @args.parse_liquid(context)
|
78
75
|
site = context.registers[:site]
|
79
76
|
page = context.registers.fetch(:page, {})
|
80
77
|
sprockets = site.sprockets
|
81
78
|
page = page["path"]
|
82
79
|
|
83
|
-
asset = find_asset(sprockets)
|
80
|
+
asset = find_asset(args, sprockets)
|
84
81
|
add_as_jekyll_dependency(site, sprockets, page, asset)
|
85
82
|
process_tag(args, sprockets, asset)
|
86
83
|
rescue => e
|
87
|
-
capture_and_out_error
|
88
|
-
site, e
|
84
|
+
capture_and_out_error site, e
|
89
85
|
end
|
90
86
|
|
91
87
|
#
|
92
88
|
|
93
89
|
private
|
94
90
|
def from_alias(tag)
|
95
|
-
Alias.
|
91
|
+
Alias.key?(tag) ? Alias[tag] : tag
|
96
92
|
end
|
97
93
|
|
98
94
|
#
|
@@ -109,20 +105,18 @@ module Jekyll
|
|
109
105
|
private
|
110
106
|
def build_html(args, sprockets, asset, path = get_path(sprockets, asset))
|
111
107
|
if @tag == "asset_path"
|
112
|
-
|
108
|
+
path
|
113
109
|
|
114
110
|
elsif @tag == "asset" || @tag == "asset_source"
|
115
|
-
|
111
|
+
asset.to_s
|
116
112
|
|
117
|
-
elsif args.
|
118
|
-
|
119
|
-
|
120
|
-
]
|
113
|
+
elsif args.key?(:data) && args[:data].key?(:uri)
|
114
|
+
format(Tags[@tag], asset.data_uri, \
|
115
|
+
args.to_html)
|
121
116
|
|
122
117
|
else
|
123
|
-
|
124
|
-
|
125
|
-
]
|
118
|
+
format(Tags[@tag], path, \
|
119
|
+
args.to_html)
|
126
120
|
end
|
127
121
|
end
|
128
122
|
|
@@ -130,8 +124,7 @@ module Jekyll
|
|
130
124
|
|
131
125
|
private
|
132
126
|
def get_path(sprockets, asset)
|
133
|
-
sprockets.prefix_path(sprockets.digest?? asset.digest_path :
|
134
|
-
asset.logical_path)
|
127
|
+
sprockets.prefix_path(sprockets.digest?? asset.digest_path : asset.logical_path)
|
135
128
|
end
|
136
129
|
|
137
130
|
#
|
@@ -148,14 +141,15 @@ module Jekyll
|
|
148
141
|
#
|
149
142
|
|
150
143
|
private
|
151
|
-
def find_asset(sprockets)
|
152
|
-
file
|
153
|
-
|
154
|
-
|
144
|
+
def find_asset(args, sprockets)
|
145
|
+
file = args[:file]
|
146
|
+
sprockets_ = args[:sprockets] ||= {}
|
147
|
+
if !(out = sprockets.find_asset(file, sprockets_))
|
148
|
+
raise AssetNotFoundError, args[:file]
|
155
149
|
else
|
156
150
|
out.liquid_tags << self
|
157
|
-
!args.
|
158
|
-
out,
|
151
|
+
!args.proxies?? out : ProxiedAsset.new( \
|
152
|
+
out, args, sprockets, self)
|
159
153
|
end
|
160
154
|
end
|
161
155
|
|
@@ -168,7 +162,7 @@ module Jekyll
|
|
168
162
|
def capture_and_out_error(site, error)
|
169
163
|
if error.is_a?(Sass::SyntaxError)
|
170
164
|
file = error.sass_filename.gsub(/#{Regexp.escape(site.source)}\//, "")
|
171
|
-
Jekyll.logger.error(%
|
165
|
+
Jekyll.logger.error(%{Error in #{file}:#{error.sass_line} #{error}})
|
172
166
|
else
|
173
167
|
Jekyll.logger.error \
|
174
168
|
"", error.to_s
|
@@ -3,14 +3,13 @@ module Jekyll
|
|
3
3
|
module Liquid
|
4
4
|
class Tag
|
5
5
|
module Defaults
|
6
|
-
|
7
|
-
|
6
|
+
autoload :Image, "jekyll/assets/liquid/tag/defaults/image"
|
8
7
|
# TODO: In 3.0 env needs to be enforced, right now it's not
|
9
8
|
# because it's maintain 2.0 API.
|
10
9
|
|
11
10
|
module_function
|
12
11
|
def set_defaults_for!(tag, args, asset, env = nil)
|
13
|
-
constants.select { |const| const_get(const).
|
12
|
+
constants.select { |const| const_get(const).for?(tag) }.each do |const|
|
14
13
|
const_get(const).new(args, asset, env).set!
|
15
14
|
end
|
16
15
|
end
|
@@ -8,7 +8,7 @@ module Jekyll
|
|
8
8
|
class Tag
|
9
9
|
module Defaults
|
10
10
|
class Image
|
11
|
-
def self.
|
11
|
+
def self.for?(tag)
|
12
12
|
tag == "img" || tag == "image"
|
13
13
|
end
|
14
14
|
|
@@ -16,9 +16,9 @@ module Jekyll
|
|
16
16
|
# for now it's not enforced to maintain the 2.0 API.
|
17
17
|
|
18
18
|
def initialize(args, asset, env = nil)
|
19
|
+
@args = args
|
19
20
|
@asset = asset
|
20
|
-
@env
|
21
|
-
@args = args
|
21
|
+
@env = env
|
22
22
|
end
|
23
23
|
|
24
24
|
#
|
@@ -34,8 +34,8 @@ module Jekyll
|
|
34
34
|
def set_img_alt
|
35
35
|
if !@env || @env.asset_config["features"]["automatic_img_alt"]
|
36
36
|
@args[:html] ||= {}
|
37
|
-
|
38
|
-
|
37
|
+
unless @args[:html].key?("alt")
|
38
|
+
@args[:html]["alt"] = @asset.logical_path
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -2,9 +2,6 @@
|
|
2
2
|
# Copyright: 2012-2015 - MIT License
|
3
3
|
# Encoding: utf-8
|
4
4
|
|
5
|
-
require_relative "proxies"
|
6
|
-
require "forwardable"
|
7
|
-
|
8
5
|
module Jekyll
|
9
6
|
module Assets
|
10
7
|
module Liquid
|
@@ -23,7 +20,7 @@ module Jekyll
|
|
23
20
|
extend Forwardable
|
24
21
|
|
25
22
|
def_delegator :@args, :each
|
26
|
-
def_delegator :@args, :
|
23
|
+
def_delegator :@args, :key?
|
27
24
|
def_delegator :@args, :fetch
|
28
25
|
def_delegator :@args, :store
|
29
26
|
def_delegator :@args, :to_h
|
@@ -32,7 +29,7 @@ module Jekyll
|
|
32
29
|
|
33
30
|
#
|
34
31
|
|
35
|
-
|
32
|
+
ACCEPT = {
|
36
33
|
"css" => "text/css", "js" => "application/javascript"
|
37
34
|
}
|
38
35
|
|
@@ -54,53 +51,38 @@ module Jekyll
|
|
54
51
|
|
55
52
|
#
|
56
53
|
|
57
|
-
def initialize(args, tag)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
54
|
+
def initialize(args, tag, processed: false, raw_args: nil)
|
55
|
+
if processed && raw_args
|
56
|
+
@args = args
|
57
|
+
@raw_args = raw_args
|
58
|
+
@tag = tag
|
63
59
|
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
elsif processed && !raw_args
|
61
|
+
raise ArgumentError, "You must provide raw_args if you pre-process." \
|
62
|
+
"Please provide the raw args."
|
67
63
|
|
68
|
-
|
69
|
-
|
64
|
+
else
|
65
|
+
@tag = tag
|
66
|
+
@raw_args = args
|
67
|
+
parse_raw
|
68
|
+
set_accept
|
69
|
+
end
|
70
70
|
end
|
71
71
|
|
72
72
|
#
|
73
73
|
|
74
|
-
def
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
hash.inject({}) do |hash_, (key, val)|
|
81
|
-
val = liquid.parse(val).render(context) if val.is_a?(String)
|
82
|
-
val = parse_liquid(val, context) if val.is_a?(Hash)
|
83
|
-
hash_.update(
|
84
|
-
key => val
|
85
|
-
)
|
86
|
-
end
|
74
|
+
def parse_liquid(context)
|
75
|
+
return self unless context.is_a?(Object::Liquid::Context)
|
76
|
+
liquid = context.registers[:site].liquid_renderer.file("(jekyll:assets)")
|
77
|
+
out = parse_hash_liquid(to_h, liquid, context)
|
78
|
+
self.class.new(out, @tag, raw_args: @raw_args, \
|
79
|
+
processed: true)
|
87
80
|
end
|
88
81
|
|
89
|
-
# TODO: In 3.0 this needs to be put on the class, but because
|
90
|
-
# we need to work around the way that Liquid currently works in
|
91
|
-
# 2.0.1 it needs to stay.
|
92
|
-
|
93
82
|
def to_html
|
94
|
-
self.
|
95
|
-
|
96
|
-
|
97
|
-
#
|
98
|
-
|
99
|
-
def self.to_html(hash)
|
100
|
-
hash.fetch(:html, {}).map do |key, val|
|
101
|
-
%Q{ #{key}="#{val}"}
|
102
|
-
end. \
|
103
|
-
join
|
83
|
+
(self[:html] || {}).map do |key, val|
|
84
|
+
%{ #{key}="#{val}"}
|
85
|
+
end.join
|
104
86
|
end
|
105
87
|
|
106
88
|
#
|
@@ -114,22 +96,32 @@ module Jekyll
|
|
114
96
|
|
115
97
|
#
|
116
98
|
|
117
|
-
def
|
99
|
+
def proxies?
|
118
100
|
proxies.any?
|
119
101
|
end
|
120
102
|
|
121
103
|
#
|
122
104
|
|
105
|
+
private
|
106
|
+
def parse_hash_liquid(hash_, liquid, context)
|
107
|
+
hash_.each_with_object({}) do |(key, val), hash|
|
108
|
+
val = liquid.parse(val).render(context) if val.is_a?(String)
|
109
|
+
val = parse_hash_liquid(val, liquid, context) if val.is_a?(Hash)
|
110
|
+
hash[key] = val
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
#
|
115
|
+
|
123
116
|
private
|
124
117
|
def parse_raw
|
125
|
-
@args = from_shellwords.each_with_index.
|
118
|
+
@args = from_shellwords.each_with_index.each_with_object({}) do |(key, index), hash|
|
126
119
|
if index == 0 then hash.store(:file, key)
|
127
120
|
elsif key =~ /:/ && (key = key.split(/(?<!\\):/))
|
128
121
|
parse_col hash, key
|
129
122
|
|
130
123
|
else
|
131
|
-
(hash[:html] ||= {})[key] =
|
132
|
-
true
|
124
|
+
(hash[:html] ||= {})[key] = true
|
133
125
|
end
|
134
126
|
|
135
127
|
hash
|
@@ -141,17 +133,17 @@ module Jekyll
|
|
141
133
|
private
|
142
134
|
def parse_col(hash, key)
|
143
135
|
key.push(key.delete_at(-1).gsub(/\\:/, ":"))
|
144
|
-
if key.size == 3
|
145
|
-
|
146
|
-
|
147
|
-
end
|
136
|
+
return as_proxy hash, key if key.size == 3
|
137
|
+
return as_bool_or_html hash, key if key.size == 2
|
138
|
+
raise UnescapedColonError
|
148
139
|
end
|
149
140
|
|
150
141
|
#
|
151
142
|
|
152
143
|
private
|
153
144
|
def as_bool_or_html(hash, key)
|
154
|
-
okey = key
|
145
|
+
okey = key
|
146
|
+
key, sub_key = key
|
155
147
|
if Proxies.has?(key, @tag, "@#{sub_key}")
|
156
148
|
(hash[key.to_sym] ||= {})[sub_key.to_sym] = true
|
157
149
|
else
|
@@ -178,11 +170,11 @@ module Jekyll
|
|
178
170
|
|
179
171
|
private
|
180
172
|
def set_accept
|
181
|
-
if
|
182
|
-
!@args[:sprockets].
|
173
|
+
if ACCEPT.key?(@tag) && (!@args.key?(:sprockets) || \
|
174
|
+
!@args[:sprockets].key?(:accept))
|
183
175
|
|
184
176
|
(@args[:sprockets] ||= {})[:accept] = \
|
185
|
-
|
177
|
+
ACCEPT[@tag]
|
186
178
|
end
|
187
179
|
end
|
188
180
|
|