jekyll 4.1.1 → 4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +153 -4
- data/README.markdown +2 -6
- data/lib/blank_template/_layouts/default.html +1 -1
- data/lib/jekyll/cleaner.rb +1 -1
- data/lib/jekyll/commands/doctor.rb +19 -15
- data/lib/jekyll/commands/new.rb +3 -0
- data/lib/jekyll/commands/new_theme.rb +0 -2
- data/lib/jekyll/configuration.rb +11 -14
- data/lib/jekyll/convertible.rb +9 -6
- data/lib/jekyll/document.rb +20 -12
- data/lib/jekyll/drops/collection_drop.rb +3 -3
- data/lib/jekyll/drops/document_drop.rb +4 -15
- data/lib/jekyll/drops/drop.rb +98 -20
- data/lib/jekyll/drops/site_drop.rb +3 -3
- data/lib/jekyll/drops/static_file_drop.rb +4 -4
- data/lib/jekyll/drops/url_drop.rb +2 -2
- data/lib/jekyll/filters/url_filters.rb +5 -2
- data/lib/jekyll/filters.rb +6 -9
- data/lib/jekyll/frontmatter_defaults.rb +2 -2
- data/lib/jekyll/hooks.rb +20 -16
- data/lib/jekyll/layout.rb +5 -0
- data/lib/jekyll/page.rb +20 -13
- data/lib/jekyll/path_manager.rb +53 -10
- data/lib/jekyll/reader.rb +11 -6
- data/lib/jekyll/readers/data_reader.rb +3 -0
- data/lib/jekyll/readers/post_reader.rb +1 -1
- data/lib/jekyll/related_posts.rb +1 -1
- data/lib/jekyll/renderer.rb +8 -4
- data/lib/jekyll/site.rb +17 -2
- data/lib/jekyll/static_file.rb +2 -2
- data/lib/jekyll/tags/include.rb +31 -32
- data/lib/jekyll/tags/link.rb +2 -1
- data/lib/jekyll/tags/post_url.rb +3 -4
- data/lib/jekyll/url.rb +8 -5
- data/lib/jekyll/utils/platforms.rb +34 -49
- data/lib/jekyll/version.rb +1 -1
- data/lib/jekyll.rb +2 -16
- metadata +7 -7
data/lib/jekyll/site.rb
CHANGED
@@ -117,6 +117,7 @@ module Jekyll
|
|
117
117
|
|
118
118
|
Jekyll::Cache.clear_if_config_changed config
|
119
119
|
Jekyll::Hooks.trigger :site, :after_reset, self
|
120
|
+
nil
|
120
121
|
end
|
121
122
|
# rubocop:enable Metrics/MethodLength
|
122
123
|
# rubocop:enable Metrics/AbcSize
|
@@ -180,6 +181,7 @@ module Jekyll
|
|
180
181
|
reader.read
|
181
182
|
limit_posts!
|
182
183
|
Jekyll::Hooks.trigger :site, :post_read, self
|
184
|
+
nil
|
183
185
|
end
|
184
186
|
|
185
187
|
# Run each of the Generators.
|
@@ -192,6 +194,7 @@ module Jekyll
|
|
192
194
|
Jekyll.logger.debug "Generating:",
|
193
195
|
"#{generator.class} finished in #{Time.now - start} seconds."
|
194
196
|
end
|
197
|
+
nil
|
195
198
|
end
|
196
199
|
|
197
200
|
# Render the site to the destination.
|
@@ -208,6 +211,7 @@ module Jekyll
|
|
208
211
|
render_pages(payload)
|
209
212
|
|
210
213
|
Jekyll::Hooks.trigger :site, :post_render, self, payload
|
214
|
+
nil
|
211
215
|
end
|
212
216
|
|
213
217
|
# Remove orphaned files and empty directories in destination.
|
@@ -215,17 +219,20 @@ module Jekyll
|
|
215
219
|
# Returns nothing.
|
216
220
|
def cleanup
|
217
221
|
site_cleaner.cleanup!
|
222
|
+
nil
|
218
223
|
end
|
219
224
|
|
220
225
|
# Write static files, pages, and posts.
|
221
226
|
#
|
222
227
|
# Returns nothing.
|
223
228
|
def write
|
229
|
+
Jekyll::Commands::Doctor.conflicting_urls(self)
|
224
230
|
each_site_file do |item|
|
225
231
|
item.write(dest) if regenerator.regenerate?(item)
|
226
232
|
end
|
227
233
|
regenerator.write_metadata
|
228
234
|
Jekyll::Hooks.trigger :site, :post_write, self
|
235
|
+
nil
|
229
236
|
end
|
230
237
|
|
231
238
|
def posts
|
@@ -309,8 +316,9 @@ module Jekyll
|
|
309
316
|
# passed in as argument.
|
310
317
|
|
311
318
|
def instantiate_subclasses(klass)
|
312
|
-
klass.descendants.select { |c| !safe || c.safe }.
|
313
|
-
|
319
|
+
klass.descendants.select { |c| !safe || c.safe }.tap do |result|
|
320
|
+
result.sort!
|
321
|
+
result.map! { |c| c.new(config) }
|
314
322
|
end
|
315
323
|
end
|
316
324
|
|
@@ -434,6 +442,13 @@ module Jekyll
|
|
434
442
|
@collections_path ||= dir_str.empty? ? source : in_source_dir(dir_str)
|
435
443
|
end
|
436
444
|
|
445
|
+
# Public
|
446
|
+
#
|
447
|
+
# Returns the object as a debug String.
|
448
|
+
def inspect
|
449
|
+
"#<#{self.class} @source=#{@source}>"
|
450
|
+
end
|
451
|
+
|
437
452
|
private
|
438
453
|
|
439
454
|
def load_theme_configuration(config)
|
data/lib/jekyll/static_file.rb
CHANGED
@@ -55,8 +55,8 @@ module Jekyll
|
|
55
55
|
#
|
56
56
|
# Returns destination file path.
|
57
57
|
def destination(dest)
|
58
|
-
|
59
|
-
@site.in_dest_dir(dest, Jekyll::URL.unescape_path(url))
|
58
|
+
@destination ||= {}
|
59
|
+
@destination[dest] ||= @site.in_dest_dir(dest, Jekyll::URL.unescape_path(url))
|
60
60
|
end
|
61
61
|
|
62
62
|
def destination_rel_dir
|
data/lib/jekyll/tags/include.rb
CHANGED
@@ -36,20 +36,16 @@ module Jekyll
|
|
36
36
|
|
37
37
|
def parse_params(context)
|
38
38
|
params = {}
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
elsif match[3]
|
47
|
-
match[3].gsub("\\'", "'")
|
48
|
-
elsif match[4]
|
49
|
-
context[match[4]]
|
39
|
+
@params.scan(VALID_SYNTAX) do |key, d_quoted, s_quoted, variable|
|
40
|
+
value = if d_quoted
|
41
|
+
d_quoted.include?('\\"') ? d_quoted.gsub('\\"', '"') : d_quoted
|
42
|
+
elsif s_quoted
|
43
|
+
s_quoted.include?("\\'") ? s_quoted.gsub("\\'", "'") : s_quoted
|
44
|
+
elsif variable
|
45
|
+
context[variable]
|
50
46
|
end
|
51
47
|
|
52
|
-
params[
|
48
|
+
params[key] = value
|
53
49
|
end
|
54
50
|
params
|
55
51
|
end
|
@@ -205,7 +201,7 @@ module Jekyll
|
|
205
201
|
@site.inclusions[file] ||= locate_include_file(file)
|
206
202
|
inclusion = @site.inclusions[file]
|
207
203
|
|
208
|
-
add_include_to_dependency(inclusion, context) if @site.incremental
|
204
|
+
add_include_to_dependency(inclusion, context) if @site.config["incremental"]
|
209
205
|
|
210
206
|
context.stack do
|
211
207
|
context["include"] = parse_params(context) if @params
|
@@ -238,12 +234,17 @@ module Jekyll
|
|
238
234
|
end
|
239
235
|
|
240
236
|
def add_include_to_dependency(inclusion, context)
|
241
|
-
|
237
|
+
page = context.registers[:page]
|
238
|
+
return unless page&.key?("path")
|
239
|
+
|
240
|
+
absolute_path = \
|
241
|
+
if page["collection"]
|
242
|
+
@site.in_source_dir(@site.config["collections_dir"], page["path"])
|
243
|
+
else
|
244
|
+
@site.in_source_dir(page["path"])
|
245
|
+
end
|
242
246
|
|
243
|
-
@site.regenerator.add_dependency(
|
244
|
-
@site.in_source_dir(context.registers[:page]["path"]),
|
245
|
-
inclusion.path
|
246
|
-
)
|
247
|
+
@site.regenerator.add_dependency(absolute_path, inclusion.path)
|
247
248
|
end
|
248
249
|
end
|
249
250
|
|
@@ -253,20 +254,18 @@ module Jekyll
|
|
253
254
|
end
|
254
255
|
|
255
256
|
def page_path(context)
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
site.in_source_dir File.dirname(resource_path)
|
269
|
-
end
|
257
|
+
page, site = context.registers.values_at(:page, :site)
|
258
|
+
return site.source unless page
|
259
|
+
|
260
|
+
site.in_source_dir File.dirname(resource_path(page, site))
|
261
|
+
end
|
262
|
+
|
263
|
+
private
|
264
|
+
|
265
|
+
def resource_path(page, site)
|
266
|
+
path = page["path"]
|
267
|
+
path = File.join(site.config["collections_dir"], path) if page["collection"]
|
268
|
+
path.sub(%r!/#excerpt\z!, "")
|
270
269
|
end
|
271
270
|
end
|
272
271
|
end
|
data/lib/jekyll/tags/link.rb
CHANGED
@@ -21,11 +21,12 @@ module Jekyll
|
|
21
21
|
@context = context
|
22
22
|
site = context.registers[:site]
|
23
23
|
relative_path = Liquid::Template.parse(@relative_path).render(context)
|
24
|
+
relative_path_with_leading_slash = PathManager.join("", relative_path)
|
24
25
|
|
25
26
|
site.each_site_file do |item|
|
26
27
|
return relative_url(item) if item.relative_path == relative_path
|
27
28
|
# This takes care of the case for static files that have a leading /
|
28
|
-
return relative_url(item) if item.relative_path ==
|
29
|
+
return relative_url(item) if item.relative_path == relative_path_with_leading_slash
|
29
30
|
end
|
30
31
|
|
31
32
|
raise ArgumentError, <<~MSG
|
data/lib/jekyll/tags/post_url.rb
CHANGED
@@ -16,9 +16,8 @@ module Jekyll
|
|
16
16
|
"'#{name}' does not contain valid date and/or title."
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
@name_regex = %r!^_posts/#{path}#{
|
21
|
-
^#{path}_posts/?#{date}-#{escaped_slug}\.[^.]+!x
|
19
|
+
basename_pattern = "#{date}-#{Regexp.escape(slug)}\\.[^.]+"
|
20
|
+
@name_regex = %r!^_posts/#{path}#{basename_pattern}|^#{path}_posts/?#{basename_pattern}!
|
22
21
|
end
|
23
22
|
|
24
23
|
def post_date
|
@@ -51,7 +50,7 @@ module Jekyll
|
|
51
50
|
if path.nil? || path == ""
|
52
51
|
other.data["slug"]
|
53
52
|
else
|
54
|
-
path
|
53
|
+
"#{path}/#{other.data["slug"]}"
|
55
54
|
end
|
56
55
|
end
|
57
56
|
end
|
data/lib/jekyll/url.rb
CHANGED
@@ -94,7 +94,8 @@ module Jekyll
|
|
94
94
|
|
95
95
|
def generate_url_from_drop(template)
|
96
96
|
template.gsub(%r!:([a-z_]+)!) do |match|
|
97
|
-
|
97
|
+
name = Regexp.last_match(1)
|
98
|
+
pool = name.end_with?("_") ? [name, name.chomp!("_")] : [name]
|
98
99
|
|
99
100
|
winner = pool.find { |key| @placeholders.key?(key) }
|
100
101
|
if winner.nil?
|
@@ -107,15 +108,17 @@ module Jekyll
|
|
107
108
|
value = "" if value.nil?
|
108
109
|
replacement = self.class.escape_path(value)
|
109
110
|
|
110
|
-
match.sub(":#{winner}", replacement)
|
111
|
-
end
|
111
|
+
match.sub!(":#{winner}", replacement)
|
112
|
+
end
|
112
113
|
end
|
113
114
|
|
114
115
|
# Returns a sanitized String URL, stripping "../../" and multiples of "/",
|
115
116
|
# as well as the beginning "/" so we can enforce and ensure it.
|
116
|
-
|
117
117
|
def sanitize_url(str)
|
118
|
-
"/#{str}".gsub("..", "/").
|
118
|
+
"/#{str}".gsub("..", "/").tap do |result|
|
119
|
+
result.gsub!("./", "")
|
120
|
+
result.squeeze!("/")
|
121
|
+
end
|
119
122
|
end
|
120
123
|
|
121
124
|
# Escapes a path to be a valid URL path segment
|
@@ -5,78 +5,63 @@ module Jekyll
|
|
5
5
|
module Platforms
|
6
6
|
extend self
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
def jruby?
|
9
|
+
RUBY_ENGINE == "jruby"
|
10
|
+
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
::RUBY_ENGINE == v
|
15
|
-
end
|
12
|
+
def mri?
|
13
|
+
RUBY_ENGINE == "ruby"
|
16
14
|
end
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# /proc/version returns nothing to us.
|
22
|
-
# --
|
16
|
+
def windows?
|
17
|
+
vanilla_windows? || bash_on_windows?
|
18
|
+
end
|
23
19
|
|
20
|
+
# Not a Windows Subsystem for Linux (WSL)
|
24
21
|
def vanilla_windows?
|
25
|
-
|
26
|
-
!proc_version
|
22
|
+
rbconfig_host.match?(%r!mswin|mingw|cygwin!) && proc_version.empty?
|
27
23
|
end
|
24
|
+
alias_method :really_windows?, :vanilla_windows?
|
28
25
|
|
29
|
-
#
|
30
|
-
# XXX: Remove in 4.0
|
31
|
-
# --
|
32
|
-
|
33
|
-
alias_method :really_windows?, \
|
34
|
-
:vanilla_windows?
|
35
|
-
|
36
|
-
#
|
37
|
-
|
26
|
+
# Determine if Windows Subsystem for Linux (WSL)
|
38
27
|
def bash_on_windows?
|
39
|
-
|
40
|
-
proc_version =~ %r!microsoft!i
|
28
|
+
linux_os? && microsoft_proc_version?
|
41
29
|
end
|
42
30
|
|
43
|
-
#
|
44
|
-
|
45
|
-
def windows?
|
46
|
-
vanilla_windows? || bash_on_windows?
|
47
|
-
end
|
48
|
-
|
49
|
-
#
|
50
|
-
|
51
31
|
def linux?
|
52
|
-
|
53
|
-
proc_version !~ %r!microsoft!i
|
32
|
+
linux_os? && !microsoft_proc_version?
|
54
33
|
end
|
55
34
|
|
56
|
-
|
57
|
-
|
58
|
-
# where we kick off certain tests based on the platform.
|
59
|
-
|
60
|
-
{ :osx? => %r!darwin|mac os!, :unix? => %r!solaris|bsd! }.each do |k, v|
|
61
|
-
define_method k do
|
62
|
-
!!(
|
63
|
-
RbConfig::CONFIG["host_os"] =~ v
|
64
|
-
)
|
65
|
-
end
|
35
|
+
def osx?
|
36
|
+
rbconfig_host.match?(%r!darwin|mac os!)
|
66
37
|
end
|
67
38
|
|
68
|
-
|
39
|
+
def unix?
|
40
|
+
rbconfig_host.match?(%r!solaris|bsd!)
|
41
|
+
end
|
69
42
|
|
70
43
|
private
|
71
44
|
|
72
45
|
def proc_version
|
73
|
-
@proc_version ||=
|
46
|
+
@proc_version ||= \
|
74
47
|
begin
|
75
|
-
File.read("/proc/version")
|
48
|
+
File.read("/proc/version").downcase
|
76
49
|
rescue Errno::ENOENT, Errno::EACCES
|
77
|
-
|
50
|
+
""
|
78
51
|
end
|
79
52
|
end
|
53
|
+
|
54
|
+
def rbconfig_host
|
55
|
+
@rbconfig_host ||= RbConfig::CONFIG["host_os"].downcase
|
56
|
+
end
|
57
|
+
|
58
|
+
def linux_os?
|
59
|
+
rbconfig_host.include?("linux")
|
60
|
+
end
|
61
|
+
|
62
|
+
def microsoft_proc_version?
|
63
|
+
proc_version.include?("microsoft")
|
64
|
+
end
|
80
65
|
end
|
81
66
|
end
|
82
67
|
end
|
data/lib/jekyll/version.rb
CHANGED
data/lib/jekyll.rb
CHANGED
@@ -173,23 +173,9 @@ module Jekyll
|
|
173
173
|
# Returns the sanitized path.
|
174
174
|
def sanitized_path(base_directory, questionable_path)
|
175
175
|
return base_directory if base_directory.eql?(questionable_path)
|
176
|
+
return base_directory if questionable_path.nil?
|
176
177
|
|
177
|
-
|
178
|
-
clean_path.insert(0, "/") if clean_path.start_with?("~")
|
179
|
-
clean_path = File.expand_path(clean_path, "/")
|
180
|
-
|
181
|
-
return clean_path if clean_path.eql?(base_directory)
|
182
|
-
|
183
|
-
# remove any remaining extra leading slashes not stripped away by calling
|
184
|
-
# `File.expand_path` above.
|
185
|
-
clean_path.squeeze!("/")
|
186
|
-
|
187
|
-
if clean_path.start_with?(base_directory.sub(%r!\z!, "/"))
|
188
|
-
clean_path
|
189
|
-
else
|
190
|
-
clean_path.sub!(%r!\A\w:/!, "/")
|
191
|
-
File.join(base_directory, clean_path)
|
192
|
-
end
|
178
|
+
+Jekyll::PathManager.sanitized_path(base_directory, questionable_path)
|
193
179
|
end
|
194
180
|
|
195
181
|
# Conditional optimizations
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -102,14 +102,14 @@ dependencies:
|
|
102
102
|
requirements:
|
103
103
|
- - "~>"
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: '2.
|
105
|
+
version: '2.3'
|
106
106
|
type: :runtime
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: '2.
|
112
|
+
version: '2.3'
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: kramdown-parser-gfm
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,14 +200,14 @@ dependencies:
|
|
200
200
|
requirements:
|
201
201
|
- - "~>"
|
202
202
|
- !ruby/object:Gem::Version
|
203
|
-
version: '
|
203
|
+
version: '2.0'
|
204
204
|
type: :runtime
|
205
205
|
prerelease: false
|
206
206
|
version_requirements: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
208
|
- - "~>"
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version: '
|
210
|
+
version: '2.0'
|
211
211
|
description: Jekyll is a simple, blog aware, static site generator.
|
212
212
|
email:
|
213
213
|
- maintainers@jekyllrb.com
|
@@ -364,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
364
364
|
- !ruby/object:Gem::Version
|
365
365
|
version: 2.7.0
|
366
366
|
requirements: []
|
367
|
-
rubygems_version: 3.1.
|
367
|
+
rubygems_version: 3.1.6
|
368
368
|
signing_key:
|
369
369
|
specification_version: 4
|
370
370
|
summary: A simple, blog aware, static site generator.
|