jekyll 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +48 -19
- data/lib/jekyll.rb +3 -0
- data/lib/jekyll/collection.rb +1 -1
- data/lib/jekyll/command.rb +4 -2
- data/lib/jekyll/commands/new.rb +2 -2
- data/lib/jekyll/commands/serve.rb +9 -1
- data/lib/jekyll/configuration.rb +1 -1
- data/lib/jekyll/converters/identity.rb +2 -2
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +70 -1
- data/lib/jekyll/convertible.rb +15 -15
- data/lib/jekyll/document.rb +18 -4
- data/lib/jekyll/drops/document_drop.rb +12 -0
- data/lib/jekyll/drops/page_drop.rb +18 -0
- data/lib/jekyll/drops/url_drop.rb +8 -0
- data/lib/jekyll/entry_filter.rb +19 -6
- data/lib/jekyll/excerpt.rb +1 -1
- data/lib/jekyll/filters.rb +99 -14
- data/lib/jekyll/filters/url_filters.rb +41 -14
- data/lib/jekyll/frontmatter_defaults.rb +12 -17
- data/lib/jekyll/hooks.rb +2 -5
- data/lib/jekyll/inclusion.rb +32 -0
- data/lib/jekyll/liquid_renderer.rb +18 -15
- data/lib/jekyll/liquid_renderer/table.rb +1 -21
- data/lib/jekyll/page.rb +43 -0
- data/lib/jekyll/page_excerpt.rb +26 -0
- data/lib/jekyll/profiler.rb +58 -0
- data/lib/jekyll/readers/collection_reader.rb +1 -0
- data/lib/jekyll/readers/data_reader.rb +1 -0
- data/lib/jekyll/readers/layout_reader.rb +1 -0
- data/lib/jekyll/readers/page_reader.rb +1 -0
- data/lib/jekyll/readers/post_reader.rb +1 -0
- data/lib/jekyll/readers/static_file_reader.rb +1 -0
- data/lib/jekyll/readers/theme_assets_reader.rb +1 -0
- data/lib/jekyll/renderer.rb +9 -15
- data/lib/jekyll/site.rb +14 -5
- data/lib/jekyll/static_file.rb +14 -9
- data/lib/jekyll/tags/include.rb +58 -3
- data/lib/jekyll/theme.rb +6 -0
- data/lib/jekyll/utils.rb +4 -4
- data/lib/jekyll/utils/win_tz.rb +1 -1
- data/lib/jekyll/version.rb +1 -1
- data/lib/theme_template/theme.gemspec.erb +1 -4
- metadata +14 -31
data/lib/jekyll/static_file.rb
CHANGED
@@ -4,7 +4,7 @@ module Jekyll
|
|
4
4
|
class StaticFile
|
5
5
|
extend Forwardable
|
6
6
|
|
7
|
-
attr_reader :relative_path, :extname, :name
|
7
|
+
attr_reader :relative_path, :extname, :name
|
8
8
|
|
9
9
|
def_delegator :to_liquid, :to_json, :to_json
|
10
10
|
|
@@ -25,7 +25,7 @@ module Jekyll
|
|
25
25
|
# base - The String path to the <source>.
|
26
26
|
# dir - The String path between <source> and the file.
|
27
27
|
# name - The String filename of the file.
|
28
|
-
# rubocop: disable ParameterLists
|
28
|
+
# rubocop: disable Metrics/ParameterLists
|
29
29
|
def initialize(site, base, dir, name, collection = nil)
|
30
30
|
@site = site
|
31
31
|
@base = base
|
@@ -34,17 +34,18 @@ module Jekyll
|
|
34
34
|
@collection = collection
|
35
35
|
@relative_path = File.join(*[@dir, @name].compact)
|
36
36
|
@extname = File.extname(@name)
|
37
|
-
@data = @site.frontmatter_defaults.all(relative_path, type)
|
38
37
|
end
|
39
|
-
# rubocop: enable ParameterLists
|
38
|
+
# rubocop: enable Metrics/ParameterLists
|
40
39
|
|
41
40
|
# Returns source file path.
|
42
41
|
def path
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
@path ||= begin
|
43
|
+
# Static file is from a collection inside custom collections directory
|
44
|
+
if !@collection.nil? && !@site.config["collections_dir"].empty?
|
45
|
+
File.join(*[@base, @site.config["collections_dir"], @dir, @name].compact)
|
46
|
+
else
|
47
|
+
File.join(*[@base, @dir, @name].compact)
|
48
|
+
end
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
@@ -111,6 +112,10 @@ module Jekyll
|
|
111
112
|
true
|
112
113
|
end
|
113
114
|
|
115
|
+
def data
|
116
|
+
@data ||= @site.frontmatter_defaults.all(relative_path, type)
|
117
|
+
end
|
118
|
+
|
114
119
|
def to_liquid
|
115
120
|
@to_liquid ||= Drops::StaticFileDrop.new(self)
|
116
121
|
end
|
data/lib/jekyll/tags/include.rb
CHANGED
@@ -18,12 +18,13 @@ module Jekyll
|
|
18
18
|
|
19
19
|
def initialize(tag_name, markup, tokens)
|
20
20
|
super
|
21
|
-
|
21
|
+
markup = markup.strip
|
22
|
+
matched = markup.match(VARIABLE_SYNTAX)
|
22
23
|
if matched
|
23
24
|
@file = matched["variable"].strip
|
24
25
|
@params = matched["params"].strip
|
25
26
|
else
|
26
|
-
@file, @params = markup.
|
27
|
+
@file, @params = markup.split(%r!\s+!, 2)
|
27
28
|
end
|
28
29
|
validate_params if @params
|
29
30
|
@tag_name = tag_name
|
@@ -192,6 +193,60 @@ module Jekyll
|
|
192
193
|
end
|
193
194
|
end
|
194
195
|
|
196
|
+
# Do not inherit from this class.
|
197
|
+
# TODO: Merge into the `Jekyll::Tags::IncludeTag` in v5.0
|
198
|
+
class OptimizedIncludeTag < IncludeTag
|
199
|
+
def render(context)
|
200
|
+
@site ||= context.registers[:site]
|
201
|
+
|
202
|
+
file = render_variable(context) || @file
|
203
|
+
validate_file_name(file)
|
204
|
+
|
205
|
+
@site.inclusions[file] ||= locate_include_file(file)
|
206
|
+
inclusion = @site.inclusions[file]
|
207
|
+
|
208
|
+
add_include_to_dependency(inclusion, context) if @site.incremental?
|
209
|
+
|
210
|
+
context.stack do
|
211
|
+
context["include"] = parse_params(context) if @params
|
212
|
+
inclusion.render(context)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
private
|
217
|
+
|
218
|
+
def locate_include_file(file)
|
219
|
+
@site.includes_load_paths.each do |dir|
|
220
|
+
path = PathManager.join(dir, file)
|
221
|
+
return Inclusion.new(@site, dir, file) if valid_include_file?(path, dir)
|
222
|
+
end
|
223
|
+
raise IOError, could_not_locate_message(file, @site.includes_load_paths, @site.safe)
|
224
|
+
end
|
225
|
+
|
226
|
+
def valid_include_file?(path, dir)
|
227
|
+
File.file?(path) && !outside_scope?(path, dir)
|
228
|
+
end
|
229
|
+
|
230
|
+
def outside_scope?(path, dir)
|
231
|
+
@site.safe && !realpath_prefixed_with?(path, dir)
|
232
|
+
end
|
233
|
+
|
234
|
+
def realpath_prefixed_with?(path, dir)
|
235
|
+
File.realpath(path).start_with?(dir)
|
236
|
+
rescue StandardError
|
237
|
+
false
|
238
|
+
end
|
239
|
+
|
240
|
+
def add_include_to_dependency(inclusion, context)
|
241
|
+
return unless context.registers[:page]&.key?("path")
|
242
|
+
|
243
|
+
@site.regenerator.add_dependency(
|
244
|
+
@site.in_source_dir(context.registers[:page]["path"]),
|
245
|
+
inclusion.path
|
246
|
+
)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
195
250
|
class IncludeRelativeTag < IncludeTag
|
196
251
|
def tag_includes_dirs(context)
|
197
252
|
Array(page_path(context)).freeze
|
@@ -217,5 +272,5 @@ module Jekyll
|
|
217
272
|
end
|
218
273
|
end
|
219
274
|
|
220
|
-
Liquid::Template.register_tag("include", Jekyll::Tags::
|
275
|
+
Liquid::Template.register_tag("include", Jekyll::Tags::OptimizedIncludeTag)
|
221
276
|
Liquid::Template.register_tag("include_relative", Jekyll::Tags::IncludeRelativeTag)
|
data/lib/jekyll/theme.rb
CHANGED
@@ -4,6 +4,7 @@ module Jekyll
|
|
4
4
|
class Theme
|
5
5
|
extend Forwardable
|
6
6
|
attr_reader :name
|
7
|
+
|
7
8
|
def_delegator :gemspec, :version, :version
|
8
9
|
|
9
10
|
def initialize(name)
|
@@ -21,6 +22,11 @@ module Jekyll
|
|
21
22
|
"or includes a symbolic link loop"
|
22
23
|
end
|
23
24
|
|
25
|
+
# The name of theme directory
|
26
|
+
def basename
|
27
|
+
@basename ||= File.basename(root)
|
28
|
+
end
|
29
|
+
|
24
30
|
def includes_path
|
25
31
|
@includes_path ||= path_for "_includes"
|
26
32
|
end
|
data/lib/jekyll/utils.rb
CHANGED
@@ -13,8 +13,8 @@ module Jekyll
|
|
13
13
|
# Constants for use in #slugify
|
14
14
|
SLUGIFY_MODES = %w(raw default pretty ascii latin).freeze
|
15
15
|
SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze
|
16
|
-
SLUGIFY_DEFAULT_REGEXP = Regexp.new("[
|
17
|
-
SLUGIFY_PRETTY_REGEXP = Regexp.new("[
|
16
|
+
SLUGIFY_DEFAULT_REGEXP = Regexp.new("[^\\p{M}\\p{L}\\p{Nd}]+").freeze
|
17
|
+
SLUGIFY_PRETTY_REGEXP = Regexp.new("[^\\p{M}\\p{L}\\p{Nd}._~!$&'()+,;=@]+").freeze
|
18
18
|
SLUGIFY_ASCII_REGEXP = Regexp.new("[^[A-Za-z0-9]]+").freeze
|
19
19
|
|
20
20
|
# Takes a slug and turns it into a simple title.
|
@@ -136,7 +136,7 @@ module Jekyll
|
|
136
136
|
# Determines whether a given file has
|
137
137
|
#
|
138
138
|
# Returns true if the YAML front matter is present.
|
139
|
-
# rubocop: disable PredicateName
|
139
|
+
# rubocop: disable Naming/PredicateName
|
140
140
|
def has_yaml_header?(file)
|
141
141
|
File.open(file, "rb", &:readline).match? %r!\A---\s*\r?\n!
|
142
142
|
rescue EOFError
|
@@ -151,7 +151,7 @@ module Jekyll
|
|
151
151
|
|
152
152
|
content.include?("{%") || content.include?("{{")
|
153
153
|
end
|
154
|
-
# rubocop: enable PredicateName
|
154
|
+
# rubocop: enable Naming/PredicateName
|
155
155
|
|
156
156
|
# Slugify a filename or title.
|
157
157
|
#
|
data/lib/jekyll/utils/win_tz.rb
CHANGED
@@ -30,7 +30,7 @@ module Jekyll
|
|
30
30
|
#
|
31
31
|
# Format the hour as a two-digit number.
|
32
32
|
# Establish the minutes based on modulo expression.
|
33
|
-
hh = format("
|
33
|
+
hh = format("%<hour>02d", :hour => absolute_hour(difference).ceil)
|
34
34
|
mm = modulo.zero? ? "00" : "30"
|
35
35
|
|
36
36
|
Jekyll.logger.debug "Timezone:", "#{timezone} #{offset}#{hh}:#{mm}"
|
data/lib/jekyll/version.rb
CHANGED
@@ -10,10 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
11
11
|
spec.license = "MIT"
|
12
12
|
|
13
|
-
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(<%= theme_directories.join("|") %>|LICENSE|README)!i) }
|
13
|
+
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(<%= theme_directories.join("|") %>|LICENSE|README|_config\.yml)!i) }
|
14
14
|
|
15
15
|
spec.add_runtime_dependency "jekyll", "~> <%= jekyll_version_with_minor %>"
|
16
|
-
|
17
|
-
spec.add_development_dependency "bundler", "~> 1.16"
|
18
|
-
spec.add_development_dependency "rake", "~> 12.0"
|
19
16
|
end
|
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.0
|
4
|
+
version: 4.1.0
|
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: 2020-05-
|
13
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -58,22 +58,16 @@ dependencies:
|
|
58
58
|
name: i18n
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 0.9.5
|
64
|
-
- - "<"
|
61
|
+
- - "~>"
|
65
62
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
63
|
+
version: '1.0'
|
67
64
|
type: :runtime
|
68
65
|
prerelease: false
|
69
66
|
version_requirements: !ruby/object:Gem::Requirement
|
70
67
|
requirements:
|
71
|
-
- - "
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: 0.9.5
|
74
|
-
- - "<"
|
68
|
+
- - "~>"
|
75
69
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
70
|
+
version: '1.0'
|
77
71
|
- !ruby/object:Gem::Dependency
|
78
72
|
name: jekyll-sass-converter
|
79
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,14 +144,14 @@ dependencies:
|
|
150
144
|
requirements:
|
151
145
|
- - "~>"
|
152
146
|
- !ruby/object:Gem::Version
|
153
|
-
version: 0.
|
147
|
+
version: 0.4.0
|
154
148
|
type: :runtime
|
155
149
|
prerelease: false
|
156
150
|
version_requirements: !ruby/object:Gem::Requirement
|
157
151
|
requirements:
|
158
152
|
- - "~>"
|
159
153
|
- !ruby/object:Gem::Version
|
160
|
-
version: 0.
|
154
|
+
version: 0.4.0
|
161
155
|
- !ruby/object:Gem::Dependency
|
162
156
|
name: pathutil
|
163
157
|
requirement: !ruby/object:Gem::Requirement
|
@@ -263,6 +257,7 @@ files:
|
|
263
257
|
- lib/jekyll/drops/drop.rb
|
264
258
|
- lib/jekyll/drops/excerpt_drop.rb
|
265
259
|
- lib/jekyll/drops/jekyll_drop.rb
|
260
|
+
- lib/jekyll/drops/page_drop.rb
|
266
261
|
- lib/jekyll/drops/site_drop.rb
|
267
262
|
- lib/jekyll/drops/static_file_drop.rb
|
268
263
|
- lib/jekyll/drops/unified_payload_drop.rb
|
@@ -278,6 +273,7 @@ files:
|
|
278
273
|
- lib/jekyll/frontmatter_defaults.rb
|
279
274
|
- lib/jekyll/generator.rb
|
280
275
|
- lib/jekyll/hooks.rb
|
276
|
+
- lib/jekyll/inclusion.rb
|
281
277
|
- lib/jekyll/layout.rb
|
282
278
|
- lib/jekyll/liquid_extensions.rb
|
283
279
|
- lib/jekyll/liquid_renderer.rb
|
@@ -286,10 +282,12 @@ files:
|
|
286
282
|
- lib/jekyll/log_adapter.rb
|
287
283
|
- lib/jekyll/mime.types
|
288
284
|
- lib/jekyll/page.rb
|
285
|
+
- lib/jekyll/page_excerpt.rb
|
289
286
|
- lib/jekyll/page_without_a_file.rb
|
290
287
|
- lib/jekyll/path_manager.rb
|
291
288
|
- lib/jekyll/plugin.rb
|
292
289
|
- lib/jekyll/plugin_manager.rb
|
290
|
+
- lib/jekyll/profiler.rb
|
293
291
|
- lib/jekyll/publisher.rb
|
294
292
|
- lib/jekyll/reader.rb
|
295
293
|
- lib/jekyll/readers/collection_reader.rb
|
@@ -347,26 +345,11 @@ homepage: https://jekyllrb.com
|
|
347
345
|
licenses:
|
348
346
|
- MIT
|
349
347
|
metadata:
|
348
|
+
source_code_uri: https://github.com/jekyll/jekyll
|
350
349
|
bug_tracker_uri: https://github.com/jekyll/jekyll/issues
|
351
350
|
changelog_uri: https://github.com/jekyll/jekyll/releases
|
352
351
|
homepage_uri: https://jekyllrb.com
|
353
|
-
|
354
|
-
post_install_message: |
|
355
|
-
-------------------------------------------------------------------------------------
|
356
|
-
Jekyll 4.0 comes with some major changes, notably:
|
357
|
-
|
358
|
-
* Our `link` tag now comes with the `relative_url` filter incorporated into it.
|
359
|
-
You should no longer prepend `{{ site.baseurl }}` to `{% link foo.md %}`
|
360
|
-
For further details: https://github.com/jekyll/jekyll/pull/6727
|
361
|
-
|
362
|
-
* Our `post_url` tag now comes with the `relative_url` filter incorporated into it.
|
363
|
-
You shouldn't prepend `{{ site.baseurl }}` to `{% post_url 2019-03-27-hello %}`
|
364
|
-
For further details: https://github.com/jekyll/jekyll/pull/7589
|
365
|
-
|
366
|
-
* Support for deprecated configuration options has been removed. We will no longer
|
367
|
-
output a warning and gracefully assign their values to the newer counterparts
|
368
|
-
internally.
|
369
|
-
-------------------------------------------------------------------------------------
|
352
|
+
post_install_message:
|
370
353
|
rdoc_options:
|
371
354
|
- "--charset=UTF-8"
|
372
355
|
require_paths:
|