jekyll 4.2.2 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +150 -26
  3. data/README.markdown +16 -19
  4. data/lib/jekyll/cache.rb +3 -7
  5. data/lib/jekyll/cleaner.rb +1 -1
  6. data/lib/jekyll/collection.rb +1 -0
  7. data/lib/jekyll/commands/build.rb +2 -13
  8. data/lib/jekyll/commands/clean.rb +1 -2
  9. data/lib/jekyll/commands/doctor.rb +13 -13
  10. data/lib/jekyll/commands/new.rb +5 -9
  11. data/lib/jekyll/commands/new_theme.rb +3 -4
  12. data/lib/jekyll/commands/serve/live_reload_reactor.rb +3 -6
  13. data/lib/jekyll/commands/serve/mime_types_charset.json +71 -0
  14. data/lib/jekyll/commands/serve/servlet.rb +13 -9
  15. data/lib/jekyll/commands/serve.rb +23 -18
  16. data/lib/jekyll/configuration.rb +2 -2
  17. data/lib/jekyll/converters/markdown/kramdown_parser.rb +13 -15
  18. data/lib/jekyll/data_entry.rb +83 -0
  19. data/lib/jekyll/data_hash.rb +61 -0
  20. data/lib/jekyll/deprecator.rb +1 -1
  21. data/lib/jekyll/document.rb +2 -3
  22. data/lib/jekyll/drops/document_drop.rb +1 -0
  23. data/lib/jekyll/drops/excerpt_drop.rb +4 -0
  24. data/lib/jekyll/drops/site_drop.rb +6 -1
  25. data/lib/jekyll/drops/theme_drop.rb +36 -0
  26. data/lib/jekyll/drops/unified_payload_drop.rb +6 -2
  27. data/lib/jekyll/entry_filter.rb +2 -6
  28. data/lib/jekyll/excerpt.rb +5 -6
  29. data/lib/jekyll/external.rb +17 -21
  30. data/lib/jekyll/filters.rb +11 -14
  31. data/lib/jekyll/frontmatter_defaults.rb +2 -4
  32. data/lib/jekyll/hooks.rb +2 -2
  33. data/lib/jekyll/layout.rb +8 -20
  34. data/lib/jekyll/mime.types +146 -73
  35. data/lib/jekyll/page.rb +2 -4
  36. data/lib/jekyll/path_manager.rb +7 -7
  37. data/lib/jekyll/plugin_manager.rb +12 -4
  38. data/lib/jekyll/profiler.rb +0 -3
  39. data/lib/jekyll/reader.rb +18 -1
  40. data/lib/jekyll/readers/data_reader.rb +51 -14
  41. data/lib/jekyll/renderer.rb +8 -10
  42. data/lib/jekyll/site.rb +52 -21
  43. data/lib/jekyll/static_file.rb +6 -9
  44. data/lib/jekyll/tags/highlight.rb +13 -9
  45. data/lib/jekyll/tags/include.rb +4 -4
  46. data/lib/jekyll/tags/post_url.rb +5 -5
  47. data/lib/jekyll/theme.rb +6 -2
  48. data/lib/jekyll/theme_builder.rb +1 -1
  49. data/lib/jekyll/url.rb +1 -1
  50. data/lib/jekyll/utils/ansi.rb +1 -1
  51. data/lib/jekyll/utils/win_tz.rb +18 -47
  52. data/lib/jekyll/utils.rb +18 -7
  53. data/lib/jekyll/version.rb +1 -1
  54. data/lib/jekyll.rb +3 -1
  55. data/lib/site_template/_config.yml +1 -1
  56. data/lib/theme_template/README.md.erb +1 -3
  57. metadata +61 -13
@@ -4,8 +4,7 @@ module Jekyll
4
4
  class Excerpt
5
5
  extend Forwardable
6
6
 
7
- attr_accessor :doc
8
- attr_accessor :content, :ext
7
+ attr_accessor :content, :doc, :ext
9
8
  attr_writer :output
10
9
 
11
10
  def_delegators :@doc,
@@ -139,7 +138,7 @@ module Jekyll
139
138
  return head if tail.empty?
140
139
 
141
140
  head = sanctify_liquid_tags(head) if head.include?("{%")
142
- definitions = extract_markdown_link_reference_defintions(head, tail)
141
+ definitions = extract_markdown_link_reference_definitions(head, tail)
143
142
  return head if definitions.empty?
144
143
 
145
144
  head << "\n\n" << definitions.join("\n")
@@ -165,7 +164,7 @@ module Jekyll
165
164
  head
166
165
  end
167
166
 
168
- def extract_markdown_link_reference_defintions(head, tail)
167
+ def extract_markdown_link_reference_definitions(head, tail)
169
168
  [].tap do |definitions|
170
169
  tail.scan(MKDWN_LINK_REF_REGEX).each do |segments|
171
170
  definitions << segments.join if head.include?(segments[0])
@@ -191,8 +190,8 @@ module Jekyll
191
190
 
192
191
  def print_build_warning
193
192
  Jekyll.logger.warn "Warning:", "Excerpt modified in #{doc.relative_path}!"
194
- Jekyll.logger.warn "", "Found a Liquid block containing the excerpt separator" \
195
- " #{doc.excerpt_separator.inspect}. "
193
+ Jekyll.logger.warn "", "Found a Liquid block containing the excerpt separator " \
194
+ "#{doc.excerpt_separator.inspect}."
196
195
  Jekyll.logger.warn "", "The block has been modified with the appropriate closing tag."
197
196
  Jekyll.logger.warn "", "Feel free to define a custom excerpt or excerpt_separator in the"
198
197
  Jekyll.logger.warn "", "document's Front Matter if the generated excerpt is unsatisfactory."
@@ -22,13 +22,11 @@ module Jekyll
22
22
  #
23
23
  def require_if_present(names)
24
24
  Array(names).each do |name|
25
- begin
26
- require name
27
- rescue LoadError
28
- Jekyll.logger.debug "Couldn't load #{name}. Skipping."
29
- yield(name, version_constraint(name)) if block_given?
30
- false
31
- end
25
+ require name
26
+ rescue LoadError
27
+ Jekyll.logger.debug "Couldn't load #{name}. Skipping."
28
+ yield(name, version_constraint(name)) if block_given?
29
+ false
32
30
  end
33
31
  end
34
32
 
@@ -55,23 +53,21 @@ module Jekyll
55
53
  #
56
54
  def require_with_graceful_fail(names)
57
55
  Array(names).each do |name|
58
- begin
59
- Jekyll.logger.debug "Requiring:", name.to_s
60
- require name
61
- rescue LoadError => e
62
- Jekyll.logger.error "Dependency Error:", <<~MSG
63
- Yikes! It looks like you don't have #{name} or one of its dependencies installed.
64
- In order to use Jekyll as currently configured, you'll need to install this gem.
56
+ Jekyll.logger.debug "Requiring:", name.to_s
57
+ require name
58
+ rescue LoadError => e
59
+ Jekyll.logger.error "Dependency Error:", <<~MSG
60
+ Yikes! It looks like you don't have #{name} or one of its dependencies installed.
61
+ In order to use Jekyll as currently configured, you'll need to install this gem.
65
62
 
66
- If you've run Jekyll with `bundle exec`, ensure that you have included the #{name}
67
- gem in your Gemfile as well.
63
+ If you've run Jekyll with `bundle exec`, ensure that you have included the #{name}
64
+ gem in your Gemfile as well.
68
65
 
69
- The full error message from Ruby is: '#{e.message}'
66
+ The full error message from Ruby is: '#{e.message}'
70
67
 
71
- If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
72
- MSG
73
- raise Jekyll::Errors::MissingDependencyException, name
74
- end
68
+ If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
69
+ MSG
70
+ raise Jekyll::Errors::MissingDependencyException, name
75
71
  end
76
72
  end
77
73
  end
@@ -193,12 +193,10 @@ module Jekyll
193
193
  @where_filter_cache[input_id] ||= {}
194
194
  @where_filter_cache[input_id][property] ||= {}
195
195
 
196
- # stash or retrive results to return
197
- @where_filter_cache[input_id][property][value] ||= begin
198
- input.select do |object|
199
- compare_property_vs_target(item_property(object, property), value)
200
- end.to_a
201
- end
196
+ # stash or retrieve results to return
197
+ @where_filter_cache[input_id][property][value] ||= input.select do |object|
198
+ compare_property_vs_target(item_property(object, property), value)
199
+ end.to_a
202
200
  end
203
201
 
204
202
  # Filters an array of objects against an expression
@@ -246,14 +244,13 @@ module Jekyll
246
244
  @find_filter_cache[input_id] ||= {}
247
245
  @find_filter_cache[input_id][property] ||= {}
248
246
 
249
- # stash or retrive results to return
247
+ # stash or retrieve results to return
250
248
  # Since `enum.find` can return nil or false, we use a placeholder string "<__NO MATCH__>"
251
249
  # to validate caching.
252
- result = @find_filter_cache[input_id][property][value] ||= begin
253
- input.find do |object|
254
- compare_property_vs_target(item_property(object, property), value)
255
- end || "<__NO MATCH__>"
256
- end
250
+ result = @find_filter_cache[input_id][property][value] ||= input.find do |object|
251
+ compare_property_vs_target(item_property(object, property), value)
252
+ end || "<__NO MATCH__>"
253
+
257
254
  return nil if result == "<__NO MATCH__>"
258
255
 
259
256
  result
@@ -314,7 +311,7 @@ module Jekyll
314
311
  order = + 1
315
312
  else
316
313
  raise ArgumentError, "Invalid nils order: " \
317
- "'#{nils}' is not a valid nils order. It must be 'first' or 'last'."
314
+ "'#{nils}' is not a valid nils order. It must be 'first' or 'last'."
318
315
  end
319
316
 
320
317
  sort_input(input, property, order)
@@ -481,7 +478,7 @@ module Jekyll
481
478
  end
482
479
 
483
480
  # ----------- The following set of code was *adapted* from Liquid::If
484
- # ----------- ref: https://git.io/vp6K6
481
+ # ----------- ref: https://github.com/Shopify/liquid/blob/ffb0ace30315bbcf3548a0383fab531452060ae8/lib/liquid/tags/if.rb#L84-L107
485
482
 
486
483
  # Parse a string to a Liquid Condition
487
484
  def parse_condition(exp)
@@ -198,10 +198,8 @@ module Jekyll
198
198
  def matching_sets(path, type)
199
199
  @matched_set_cache ||= {}
200
200
  @matched_set_cache[path] ||= {}
201
- @matched_set_cache[path][type] ||= begin
202
- valid_sets.select do |set|
203
- !set.key?("scope") || applies?(set["scope"], path, type)
204
- end
201
+ @matched_set_cache[path][type] ||= valid_sets.select do |set|
202
+ !set.key?("scope") || applies?(set["scope"], path, type)
205
203
  end
206
204
  end
207
205
 
data/lib/jekyll/hooks.rb CHANGED
@@ -78,8 +78,8 @@ module Jekyll
78
78
  }
79
79
 
80
80
  unless @registry[owner][event]
81
- raise NotAvailable, "Invalid hook. #{owner} supports only the " \
82
- "following hooks #{@registry[owner].keys.inspect}"
81
+ raise NotAvailable, "Invalid hook. #{owner} supports only the following hooks " \
82
+ "#{@registry[owner].keys.inspect}"
83
83
  end
84
84
 
85
85
  raise Uncallable, "Hooks must respond to :call" unless block.respond_to? :call
data/lib/jekyll/layout.rb CHANGED
@@ -4,26 +4,14 @@ module Jekyll
4
4
  class Layout
5
5
  include Convertible
6
6
 
7
- # Gets the Site object.
8
- attr_reader :site
9
-
10
- # Gets the name of this layout.
11
- attr_reader :name
12
-
13
- # Gets the path to this layout.
14
- attr_reader :path
15
-
16
- # Gets the path to this layout relative to its base
17
- attr_reader :relative_path
18
-
19
- # Gets/Sets the extension of this layout.
20
- attr_accessor :ext
21
-
22
- # Gets/Sets the Hash that holds the metadata for this layout.
23
- attr_accessor :data
24
-
25
- # Gets/Sets the content of this layout.
26
- attr_accessor :content
7
+ attr_accessor :content, # content of layout
8
+ :data, # the Hash that holds the metadata for this layout
9
+ :ext # extension of layout
10
+
11
+ attr_reader :name, # name of layout
12
+ :path, # path to layout
13
+ :site, # the Site object
14
+ :relative_path # path to layout relative to its base
27
15
 
28
16
  # Initialize a new Layout.
29
17
  #