jekyll 4.2.2 → 4.3.1

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 (54) 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/deprecator.rb +1 -1
  19. data/lib/jekyll/document.rb +2 -3
  20. data/lib/jekyll/drops/document_drop.rb +4 -0
  21. data/lib/jekyll/drops/excerpt_drop.rb +4 -0
  22. data/lib/jekyll/drops/theme_drop.rb +36 -0
  23. data/lib/jekyll/drops/unified_payload_drop.rb +6 -2
  24. data/lib/jekyll/entry_filter.rb +2 -6
  25. data/lib/jekyll/excerpt.rb +5 -6
  26. data/lib/jekyll/external.rb +17 -21
  27. data/lib/jekyll/filters.rb +11 -14
  28. data/lib/jekyll/frontmatter_defaults.rb +2 -4
  29. data/lib/jekyll/hooks.rb +2 -2
  30. data/lib/jekyll/layout.rb +8 -20
  31. data/lib/jekyll/mime.types +146 -73
  32. data/lib/jekyll/page.rb +2 -4
  33. data/lib/jekyll/path_manager.rb +7 -7
  34. data/lib/jekyll/plugin_manager.rb +12 -4
  35. data/lib/jekyll/profiler.rb +0 -3
  36. data/lib/jekyll/reader.rb +18 -1
  37. data/lib/jekyll/readers/data_reader.rb +45 -11
  38. data/lib/jekyll/renderer.rb +8 -10
  39. data/lib/jekyll/site.rb +52 -21
  40. data/lib/jekyll/static_file.rb +6 -9
  41. data/lib/jekyll/tags/highlight.rb +13 -9
  42. data/lib/jekyll/tags/include.rb +4 -4
  43. data/lib/jekyll/tags/post_url.rb +5 -5
  44. data/lib/jekyll/theme.rb +6 -2
  45. data/lib/jekyll/theme_builder.rb +1 -1
  46. data/lib/jekyll/url.rb +1 -1
  47. data/lib/jekyll/utils/ansi.rb +1 -1
  48. data/lib/jekyll/utils/win_tz.rb +18 -47
  49. data/lib/jekyll/utils.rb +10 -6
  50. data/lib/jekyll/version.rb +1 -1
  51. data/lib/jekyll.rb +1 -1
  52. data/lib/site_template/_config.yml +1 -1
  53. data/lib/theme_template/README.md.erb +1 -3
  54. metadata +59 -13
@@ -10,8 +10,7 @@ module Jekyll
10
10
  prog.command(:"new-theme") do |c|
11
11
  c.syntax "new-theme NAME"
12
12
  c.description "Creates a new Jekyll theme scaffold"
13
- c.option "code_of_conduct", \
14
- "-c", "--code-of-conduct", \
13
+ c.option "code_of_conduct", "-c", "--code-of-conduct",
15
14
  "Include a Code of Conduct. (defaults to false)"
16
15
 
17
16
  c.action do |args, opts|
@@ -30,8 +29,8 @@ module Jekyll
30
29
  Jekyll.logger.abort_with "Conflict:", "#{theme.path} already exists." if theme.path.exist?
31
30
 
32
31
  theme.create!
33
- Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}," \
34
- " is ready for you in #{theme.path.to_s.cyan}!"
32
+ Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}, " \
33
+ "is ready for you in #{theme.path.to_s.cyan}!"
35
34
  Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
36
35
  end
37
36
  end
@@ -8,9 +8,7 @@ module Jekyll
8
8
  module Commands
9
9
  class Serve
10
10
  class LiveReloadReactor
11
- attr_reader :started_event
12
- attr_reader :stopped_event
13
- attr_reader :thread
11
+ attr_reader :started_event, :stopped_event, :thread
14
12
 
15
13
  def initialize
16
14
  @websockets = []
@@ -74,8 +72,7 @@ module Jekyll
74
72
  :liveCSS => true
75
73
  )
76
74
 
77
- Jekyll.logger.debug "LiveReload:", "Reloading #{p.url}"
78
- Jekyll.logger.debug "", json_message
75
+ Jekyll.logger.debug "LiveReload:", "Reloading URL #{p.url.inspect}"
79
76
  @websockets.each { |ws| ws.send(json_message) }
80
77
  end
81
78
  end
@@ -113,7 +110,7 @@ module Jekyll
113
110
 
114
111
  def log_error(error)
115
112
  Jekyll.logger.error "LiveReload experienced an error. " \
116
- "Run with --trace for more information."
113
+ "Run with --trace for more information."
117
114
  raise error
118
115
  end
119
116
  end
@@ -0,0 +1,71 @@
1
+ {
2
+ "application/javascript": "UTF-8",
3
+ "application/json": "UTF-8",
4
+ "application/manifest+json": "UTF-8",
5
+ "application/vnd.syncml+xml": "UTF-8",
6
+ "application/vnd.syncml.dm+wbxml": "UTF-8",
7
+ "application/vnd.syncml.dm+xml": "UTF-8",
8
+ "application/vnd.syncml.dmddf+xml": "UTF-8",
9
+ "application/vnd.wap.wbxml": "UTF-8",
10
+ "text/cache-manifest": "UTF-8",
11
+ "text/calendar": "UTF-8",
12
+ "text/coffeescript": "UTF-8",
13
+ "text/css": "UTF-8",
14
+ "text/csv": "UTF-8",
15
+ "text/html": "UTF-8",
16
+ "text/jade": "UTF-8",
17
+ "text/jsx": "UTF-8",
18
+ "text/less": "UTF-8",
19
+ "text/markdown": "UTF-8",
20
+ "text/mathml": "UTF-8",
21
+ "text/mdx": "UTF-8",
22
+ "text/n3": "UTF-8",
23
+ "text/plain": "UTF-8",
24
+ "text/prs.lines.tag": "UTF-8",
25
+ "text/richtext": "UTF-8",
26
+ "text/sgml": "UTF-8",
27
+ "text/shex": "UTF-8",
28
+ "text/slim": "UTF-8",
29
+ "text/spdx": "UTF-8",
30
+ "text/stylus": "UTF-8",
31
+ "text/tab-separated-values": "UTF-8",
32
+ "text/troff": "UTF-8",
33
+ "text/turtle": "UTF-8",
34
+ "text/uri-list": "UTF-8",
35
+ "text/vcard": "UTF-8",
36
+ "text/vnd.curl": "UTF-8",
37
+ "text/vnd.curl.dcurl": "UTF-8",
38
+ "text/vnd.curl.mcurl": "UTF-8",
39
+ "text/vnd.curl.scurl": "UTF-8",
40
+ "text/vnd.familysearch.gedcom": "UTF-8",
41
+ "text/vnd.fly": "UTF-8",
42
+ "text/vnd.fmi.flexstor": "UTF-8",
43
+ "text/vnd.graphviz": "UTF-8",
44
+ "text/vnd.in3d.3dml": "UTF-8",
45
+ "text/vnd.in3d.spot": "UTF-8",
46
+ "text/vnd.sun.j2me.app-descriptor": "UTF-8",
47
+ "text/vnd.wap.wml": "UTF-8",
48
+ "text/vnd.wap.wmlscript": "UTF-8",
49
+ "text/vtt": "UTF-8",
50
+ "text/x-asm": "UTF-8",
51
+ "text/x-c": "UTF-8",
52
+ "text/x-component": "UTF-8",
53
+ "text/x-fortran": "UTF-8",
54
+ "text/x-handlebars-template": "UTF-8",
55
+ "text/x-java-source": "UTF-8",
56
+ "text/x-lua": "UTF-8",
57
+ "text/x-markdown": "UTF-8",
58
+ "text/x-nfo": "UTF-8",
59
+ "text/x-opml": "UTF-8",
60
+ "text/x-pascal": "UTF-8",
61
+ "text/x-processing": "UTF-8",
62
+ "text/x-sass": "UTF-8",
63
+ "text/x-scss": "UTF-8",
64
+ "text/x-setext": "UTF-8",
65
+ "text/x-sfv": "UTF-8",
66
+ "text/x-suse-ymp": "UTF-8",
67
+ "text/x-uuencode": "UTF-8",
68
+ "text/x-vcalendar": "UTF-8",
69
+ "text/x-vcard": "UTF-8",
70
+ "text/yaml": "UTF-8"
71
+ }
@@ -101,7 +101,7 @@ module Jekyll
101
101
  @template ||= ERB.new(<<~TEMPLATE)
102
102
  <script>
103
103
  document.write(
104
- '<script src="http://' +
104
+ '<script src="' + location.protocol + '//' +
105
105
  (location.host || 'localhost').split(':')[0] +
106
106
  ':<%=@options["livereload_port"] %>/livereload.js?snipver=1<%= livereload_args %>"' +
107
107
  '></' +
@@ -128,12 +128,13 @@ module Jekyll
128
128
  class Servlet < WEBrick::HTTPServlet::FileHandler
129
129
  DEFAULTS = {
130
130
  "Cache-Control" => "private, max-age=0, proxy-revalidate, " \
131
- "no-store, no-cache, must-revalidate",
131
+ "no-store, no-cache, must-revalidate",
132
132
  }.freeze
133
133
 
134
134
  def initialize(server, root, callbacks)
135
135
  # So we can access them easily.
136
136
  @jekyll_opts = server.config[:JekyllOptions]
137
+ @mime_types_charset = server.config[:MimeTypesCharset]
137
138
  set_defaults
138
139
  super
139
140
  end
@@ -173,7 +174,7 @@ module Jekyll
173
174
  end
174
175
  end
175
176
 
176
- validate_and_ensure_charset(req, res)
177
+ conditionally_inject_charset(res)
177
178
  res.header.merge!(@headers)
178
179
  rtn
179
180
  end
@@ -181,13 +182,16 @@ module Jekyll
181
182
 
182
183
  private
183
184
 
184
- def validate_and_ensure_charset(_req, res)
185
- key = res.header.keys.grep(%r!content-type!i).first
186
- typ = res.header[key]
185
+ # Inject charset based on Jekyll config only if our mime-types database contains
186
+ # the charset metadata.
187
+ #
188
+ # Refer `script/vendor-mimes` in the repository for further details.
189
+ def conditionally_inject_charset(res)
190
+ typ = res.header["content-type"]
191
+ return unless @mime_types_charset.key?(typ)
192
+ return if %r!;\s*charset=!.match?(typ)
187
193
 
188
- unless %r!;\s*charset=!.match?(typ)
189
- res.header[key] = "#{typ}; charset=#{@jekyll_opts["encoding"]}"
190
- end
194
+ res.header["content-type"] = "#{typ}; charset=#{@jekyll_opts["encoding"]}"
191
195
  end
192
196
 
193
197
  def set_defaults
@@ -21,11 +21,11 @@ module Jekyll
21
21
  "ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
22
22
  "port" => ["-P", "--port [PORT]", "Port to listen on"],
23
23
  "show_dir_listing" => ["--show-dir-listing",
24
- "Show a directory listing instead of loading" \
25
- " your index file.",],
24
+ "Show a directory listing instead of loading " \
25
+ "your index file.",],
26
26
  "skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
27
- "Skips the initial site build which occurs before" \
28
- " the server is started.",],
27
+ "Skips the initial site build which occurs before " \
28
+ "the server is started.",],
29
29
  "livereload" => ["-l", "--livereload",
30
30
  "Use LiveReload to automatically refresh browsers",],
31
31
  "livereload_ignore" => ["--livereload-ignore ignore GLOB1[,GLOB2[,...]]",
@@ -113,8 +113,8 @@ module Jekyll
113
113
  def validate_options(opts)
114
114
  if opts["livereload"]
115
115
  if opts["detach"]
116
- Jekyll.logger.warn "Warning:", "--detach and --livereload are mutually exclusive." \
117
- " Choosing --livereload"
116
+ Jekyll.logger.warn "Warning:", "--detach and --livereload are mutually exclusive. " \
117
+ "Choosing --livereload"
118
118
  opts["detach"] = false
119
119
  end
120
120
  if opts["ssl_cert"] || opts["ssl_key"]
@@ -132,9 +132,9 @@ module Jekyll
132
132
  livereload_max_delay
133
133
  livereload_ignore
134
134
  livereload_port).any? { |o| opts[o] }
135
- Jekyll.logger.abort_with "--livereload-min-delay, "\
136
- "--livereload-max-delay, --livereload-ignore, and "\
137
- "--livereload-port require the --livereload option."
135
+ Jekyll.logger.abort_with "--livereload-min-delay, --livereload-max-delay, " \
136
+ "--livereload-ignore, and --livereload-port require " \
137
+ "the --livereload option."
138
138
  end
139
139
  end
140
140
 
@@ -144,9 +144,9 @@ module Jekyll
144
144
  @reload_reactor = LiveReloadReactor.new
145
145
 
146
146
  Jekyll::Hooks.register(:site, :post_render) do |site|
147
- regenerator = Jekyll::Regenerator.new(site)
148
- @changed_pages = site.pages.select do |p|
149
- regenerator.regenerate?(p)
147
+ @changed_pages = []
148
+ site.each_site_file do |item|
149
+ @changed_pages << item if site.regenerator.regenerate?(item)
150
150
  end
151
151
  end
152
152
 
@@ -174,7 +174,8 @@ module Jekyll
174
174
  # Do a base pre-setup of WEBRick so that everything is in place
175
175
  # when we get ready to party, checking for an setting up an error page
176
176
  # and making sure our destination exists.
177
-
177
+ #
178
+ # rubocop:disable Security/IoMethods
178
179
  def setup(destination)
179
180
  require_relative "serve/servlet"
180
181
 
@@ -188,12 +189,14 @@ module Jekyll
188
189
  end
189
190
  end
190
191
  end
192
+ # rubocop:enable Security/IoMethods
191
193
 
192
194
  def webrick_opts(opts)
193
195
  opts = {
194
196
  :JekyllOptions => opts,
195
197
  :DoNotReverseLookup => true,
196
198
  :MimeTypes => mime_types,
199
+ :MimeTypesCharset => mime_types_charset,
197
200
  :DocumentRoot => opts["destination"],
198
201
  :StartCallback => start_callback(opts["detach"]),
199
202
  :StopCallback => stop_callback(opts["detach"]),
@@ -262,8 +265,7 @@ module Jekyll
262
265
  return system "xdg-open", address if Utils::Platforms.linux?
263
266
  return system "open", address if Utils::Platforms.osx?
264
267
 
265
- Jekyll.logger.error "Refusing to launch browser; " \
266
- "Platform launcher unknown."
268
+ Jekyll.logger.error "Refusing to launch browser. Platform launcher unknown."
267
269
  end
268
270
 
269
271
  # Keep in our area with a thread or detach the server as requested
@@ -276,9 +278,8 @@ module Jekyll
276
278
  end
277
279
 
278
280
  Process.detach(pid)
279
- Jekyll.logger.info "Server detached with pid '#{pid}'.", \
280
- "Run `pkill -f jekyll' or `kill -9 #{pid}'" \
281
- " to stop the server."
281
+ Jekyll.logger.info "Server detached with pid '#{pid}'.",
282
+ "Run `pkill -f jekyll' or `kill -9 #{pid}' to stop the server."
282
283
  else
283
284
  t = Thread.new { server.start }
284
285
  trap("INT") { server.shutdown }
@@ -353,6 +354,10 @@ module Jekyll
353
354
  WEBrick::HTTPUtils.load_mime_types(file)
354
355
  end
355
356
 
357
+ def mime_types_charset
358
+ SafeYAML.load_file(File.expand_path("serve/mime_types_charset.json", __dir__))
359
+ end
360
+
356
361
  def read_file(source_dir, file_path)
357
362
  File.read(Jekyll.sanitized_path(source_dir, file_path))
358
363
  end
@@ -304,8 +304,8 @@ module Jekyll
304
304
  return if config["plugins"].is_a?(Array)
305
305
 
306
306
  Jekyll.logger.error "'plugins' should be set as an array of gem-names, but was: " \
307
- "#{config["plugins"].inspect}. Use 'plugins_dir' instead to set the directory " \
308
- "for your non-gemified Ruby plugins."
307
+ "#{config["plugins"].inspect}. Use 'plugins_dir' instead to set " \
308
+ "the directory for your non-gemified Ruby plugins."
309
309
  raise Jekyll::Errors::InvalidConfigurationError,
310
310
  "'plugins' should be set as an array, but was: #{config["plugins"].inspect}."
311
311
  end
@@ -1,4 +1,4 @@
1
- # Frozen-string-literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Kramdown
4
4
  # A Kramdown::Document subclass meant to optimize memory usage from initializing
@@ -125,14 +125,14 @@ module Jekyll
125
125
  Jekyll::External.require_with_graceful_fail("kramdown-syntax-coderay")
126
126
  end
127
127
 
128
- # `mathjax` emgine is bundled within kramdown-2.x and will be handled by
128
+ # `mathjax` engine is bundled within kramdown-2.x and will be handled by
129
129
  # kramdown itself.
130
130
  if (math_engine = @config["math_engine"]) && math_engine != "mathjax"
131
131
  Jekyll::External.require_with_graceful_fail("kramdown-math-#{math_engine}")
132
132
  end
133
133
  end
134
134
 
135
- # config[kramdown][syntax_higlighter] >
135
+ # config[kramdown][syntax_highlighter] >
136
136
  # config[kramdown][enable_coderay] >
137
137
  # config[highlighter]
138
138
  # Where `enable_coderay` is now deprecated because Kramdown
@@ -146,23 +146,21 @@ module Jekyll
146
146
  ]
147
147
  end
148
148
 
149
- @highlighter = begin
150
- if @config.key?("enable_coderay") && @config["enable_coderay"]
151
- Jekyll::Deprecator.deprecation_message(
152
- "You are using 'enable_coderay', " \
153
- "use syntax_highlighter: coderay in your configuration file."
154
- )
149
+ @highlighter = if @config.key?("enable_coderay") && @config["enable_coderay"]
150
+ Jekyll::Deprecator.deprecation_message(
151
+ "You are using 'enable_coderay', " \
152
+ "use syntax_highlighter: coderay in your configuration file."
153
+ )
155
154
 
156
- "coderay"
157
- else
158
- @main_fallback_highlighter
159
- end
160
- end
155
+ "coderay"
156
+ else
157
+ @main_fallback_highlighter
158
+ end
161
159
  end
162
160
 
163
161
  def strip_coderay_prefix(hash)
164
162
  hash.each_with_object({}) do |(key, val), hsh|
165
- cleaned_key = key.to_s.gsub(%r!\Acoderay_!, "")
163
+ cleaned_key = key.to_s.delete_prefix("coderay_")
166
164
 
167
165
  if key != cleaned_key
168
166
  Jekyll::Deprecator.deprecation_message(
@@ -15,7 +15,7 @@ module Jekyll
15
15
  '--watch'."
16
16
  arg_is_present? args, "--no-auto", "To disable auto-replication, simply leave off \
17
17
  the '--watch' switch."
18
- arg_is_present? args, "--pygments", "The 'pygments'settings has been removed in \
18
+ arg_is_present? args, "--pygments", "The 'pygments' settings has been removed in \
19
19
  favour of 'highlighter'."
20
20
  arg_is_present? args, "--paginate", "The 'paginate' setting can only be set in \
21
21
  your config files."
@@ -406,9 +406,8 @@ module Jekyll
406
406
  # Override of method_missing to check in @data for the key.
407
407
  def method_missing(method, *args, &blck)
408
408
  if data.key?(method.to_s)
409
- Jekyll::Deprecator.deprecation_message "Document##{method} is now a key "\
410
- "in the #data hash."
411
- Jekyll::Deprecator.deprecation_message "Called by #{caller(0..0)}."
409
+ Jekyll::Deprecator.deprecation_message "Document##{method} is now a key in the #data hash."
410
+ Jekyll.logger.warn "", "Called by #{caller(1..1)[0]}."
412
411
  data[method.to_s]
413
412
  else
414
413
  super
@@ -25,6 +25,10 @@ module Jekyll
25
25
  fallback_data["excerpt"].to_s
26
26
  end
27
27
 
28
+ def name
29
+ fallback_data["name"] || @obj.basename
30
+ end
31
+
28
32
  def <=>(other)
29
33
  return nil unless other.is_a? DocumentDrop
30
34
 
@@ -14,6 +14,10 @@ module Jekyll
14
14
  def excerpt
15
15
  nil
16
16
  end
17
+
18
+ def name
19
+ @obj.doc.data["name"] || @obj.doc.basename
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Drops
5
+ class ThemeDrop < Drop
6
+ delegate_methods :root
7
+ delegate_method_as :runtime_dependencies, :dependencies
8
+
9
+ def authors
10
+ @authors ||= gemspec.authors.join(", ")
11
+ end
12
+
13
+ def version
14
+ @version ||= gemspec.version.to_s
15
+ end
16
+
17
+ def description
18
+ @description ||= gemspec.description || gemspec.summary
19
+ end
20
+
21
+ def metadata
22
+ @metadata ||= gemspec.metadata
23
+ end
24
+
25
+ private
26
+
27
+ def gemspec
28
+ @gemspec ||= @obj.send(:gemspec)
29
+ end
30
+
31
+ def fallback_data
32
+ @fallback_data ||= {}
33
+ end
34
+ end
35
+ end
36
+ end
@@ -5,8 +5,8 @@ module Jekyll
5
5
  class UnifiedPayloadDrop < Drop
6
6
  mutable true
7
7
 
8
- attr_accessor :page, :layout, :content, :paginator
9
- attr_accessor :highlighter_prefix, :highlighter_suffix
8
+ attr_accessor :content, :page, :layout, :paginator,
9
+ :highlighter_prefix, :highlighter_suffix
10
10
 
11
11
  def jekyll
12
12
  JekyllDrop.global
@@ -16,6 +16,10 @@ module Jekyll
16
16
  @site_drop ||= SiteDrop.new(@obj)
17
17
  end
18
18
 
19
+ def theme
20
+ @theme_drop ||= ThemeDrop.new(@obj.theme) if @obj.theme
21
+ end
22
+
19
23
  private
20
24
 
21
25
  def fallback_data
@@ -86,14 +86,10 @@ module Jekyll
86
86
  end
87
87
 
88
88
  # --
89
- # NOTE: Pathutil#in_path? gets the realpath.
90
- # @param [<Anything>] entry the entry you want to validate.
91
- # Check if a path is outside of our given root.
89
+ # Check if given path is outside of current site's configured source directory.
92
90
  # --
93
91
  def symlink_outside_site_source?(entry)
94
- !Pathutil.new(entry).in_path?(
95
- site.in_source_dir
96
- )
92
+ !File.realpath(entry).start_with?(site.in_source_dir)
97
93
  end
98
94
 
99
95
  # Check if an entry matches a specific pattern.
@@ -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