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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b74631944252558b9ad068a1df651f0890577d11c6ac24d06050fe76e9a41d60
4
- data.tar.gz: c34826fe92efe4fe968692fa3517c4f8ddf600b9c99af1776d305804e313a1fe
3
+ metadata.gz: 6f122205829d592889ffa17acbd3356da8f0de5a0ea22eb5e81fe52ec5751c02
4
+ data.tar.gz: fe9218747458a630880fa1b359141b07e34ad412f8ca0c4916b48060086c1814
5
5
  SHA512:
6
- metadata.gz: d89ea1ca35864a53aa21d21847ef357d33a28f8e094bc4c39bc519c2895ea6e8a87d86669252af4b9431a23634209bf38e909ea7b0686ba22bcac898a43488cc
7
- data.tar.gz: 950488593a4b255d8196baf07dfdd04a85bd062cf7b612531b6253eb4118d77ab8209290f535621dd2dc6aec2a73f8079092d243aaa002411e855b6264a5c33a
6
+ metadata.gz: ac4e6dff52be311677418ea2bf0e84d709fed2fb652f88aaf0fb42ec034702ea50f5f4b84876c79db6f0e801f0c9c3059ff011f10654f8274c39108c2b98ed25
7
+ data.tar.gz: e570481ff2b899ba49c2cbd61a94f0ccd7ae9799f487251ca0eb72200edcf3df7e3aa528036fb873f842c0ca816ad640fb129a08a6cfedec7e4e7d9a40fa3151
data/.rubocop.yml CHANGED
@@ -10,6 +10,7 @@ Jekyll/NoPutsAllowed:
10
10
  - rake/*.rake
11
11
 
12
12
  AllCops:
13
+ SuggestExtensions: false
13
14
  TargetRubyVersion: 2.4
14
15
  Include:
15
16
  - lib/**/*.rb
@@ -22,6 +23,8 @@ AllCops:
22
23
  - vendor/**/*
23
24
  - tmp/**/*
24
25
 
26
+ Layout/BeginEndAlignment:
27
+ Enabled: true
25
28
  Layout/EmptyComment:
26
29
  Enabled: false
27
30
  Layout/EmptyLinesAroundAttributeAccessor:
@@ -50,26 +53,84 @@ Layout/MultilineOperationIndentation:
50
53
  EnforcedStyle: indented
51
54
  Layout/SpaceAroundMethodCallOperator:
52
55
  Enabled: true
56
+ Layout/SpaceInsideHashLiteralBraces:
57
+ Enabled: true
58
+ Exclude:
59
+ - test/**/*.rb
53
60
 
54
- Lint/NestedPercentLiteral:
61
+ Lint/BinaryOperatorWithIdenticalOperands:
62
+ Enabled: true
63
+ Lint/ConstantDefinitionInBlock:
64
+ Enabled: true
55
65
  Exclude:
56
- - test/test_site.rb
66
+ - test/**/*.rb
57
67
  Lint/DeprecatedOpenSSLConstant:
58
68
  Enabled: true
69
+ Lint/DuplicateBranch:
70
+ Enabled: true
71
+ Lint/DuplicateElsifCondition:
72
+ Enabled: true
73
+ Lint/DuplicateRegexpCharacterClassElement:
74
+ Enabled: true
75
+ Lint/DuplicateRescueException:
76
+ Enabled: true
77
+ Lint/DuplicateRequire:
78
+ Enabled: true
79
+ Lint/EmptyBlock:
80
+ Enabled: true
81
+ Lint/EmptyClass:
82
+ Enabled: true
83
+ Lint/EmptyConditionalBody:
84
+ Enabled: true
85
+ Lint/EmptyFile:
86
+ Enabled: true
87
+ Lint/FloatComparison:
88
+ Enabled: true
89
+ Lint/HashCompareByIdentity:
90
+ Enabled: true
91
+ Lint/IdentityComparison:
92
+ Enabled: true
93
+ Lint/MissingSuper:
94
+ Enabled: false
59
95
  Lint/MixedRegexpCaptureTypes:
60
96
  Enabled: false
97
+ Lint/NestedPercentLiteral:
98
+ Exclude:
99
+ - test/test_site.rb
100
+ Lint/NoReturnInBeginEndBlocks:
101
+ Enabled: true
102
+ Lint/OutOfRangeRegexpRef:
103
+ Enabled: true
61
104
  Lint/RaiseException:
62
105
  Enabled: true
106
+ Lint/RedundantSafeNavigation:
107
+ Enabled: true
108
+ Lint/SelfAssignment:
109
+ Enabled: true
63
110
  Lint/StructNewOverride:
64
111
  Enabled: true
112
+ Lint/ToEnumArguments:
113
+ Enabled: false
114
+ Lint/TopLevelReturnWithArgument:
115
+ Enabled: true
116
+ Lint/TrailingCommaInAttributeDeclaration:
117
+ Enabled: true
118
+ Lint/UnmodifiedReduceAccumulator:
119
+ Enabled: true
65
120
  Lint/UnreachableCode:
66
121
  Severity: error
122
+ Lint/UnreachableLoop:
123
+ Enabled: true
124
+ Lint/UselessMethodDefinition:
125
+ Enabled: true
126
+ Lint/UselessTimes:
127
+ Enabled: true
67
128
  Lint/Void:
68
129
  Exclude:
69
130
  - lib/jekyll/site.rb
70
131
 
71
132
  Metrics/AbcSize:
72
- Max: 21
133
+ Max: 23
73
134
  Metrics/BlockLength:
74
135
  Exclude:
75
136
  - test/**/*.rb
@@ -100,7 +161,7 @@ Metrics/ModuleLength:
100
161
  Metrics/ParameterLists:
101
162
  Max: 4
102
163
  Metrics/PerceivedComplexity:
103
- Max: 8
164
+ Max: 13
104
165
 
105
166
  Naming/FileName:
106
167
  Enabled: false
@@ -114,6 +175,39 @@ Naming/MemoizedInstanceVariableName:
114
175
  - lib/jekyll/drops/unified_payload_drop.rb
115
176
  - lib/jekyll/page_without_a_file.rb
116
177
 
178
+ Performance/AncestorsInclude:
179
+ Enabled: false
180
+ Performance/ArraySemiInfiniteRangeSlice:
181
+ Enabled: true
182
+ Performance/BigDecimalWithNumericArgument:
183
+ Enabled: true
184
+ Performance/BlockGivenWithExplicitBlock:
185
+ Enabled: true
186
+ Performance/ChainArrayAllocation:
187
+ Enabled: true
188
+ Performance/CollectionLiteralInLoop:
189
+ Enabled: true
190
+ Performance/ConstantRegexp:
191
+ Enabled: true
192
+ Performance/MethodObjectAsBlock:
193
+ Enabled: true
194
+ Performance/RedundantSortBlock:
195
+ Enabled: true
196
+ Performance/RedundantStringChars:
197
+ Enabled: true
198
+ Performance/ReverseFirst:
199
+ Enabled: true
200
+ Performance/SortReverse:
201
+ Enabled: false
202
+ Performance/Squeeze:
203
+ Enabled: true
204
+ Performance/StringInclude:
205
+ Enabled: true
206
+ Exclude:
207
+ - lib/jekyll/utils/platforms.rb
208
+ Performance/Sum:
209
+ Enabled: true
210
+
117
211
  Security/MarshalLoad:
118
212
  Exclude:
119
213
  - !ruby/regexp /test\/.*.rb$/
@@ -123,21 +217,41 @@ Security/YAMLLoad:
123
217
  - !ruby/regexp /features\/.*.rb/
124
218
  - !ruby/regexp /test\/.*.rb$/
125
219
 
220
+ Style/ArgumentsForwarding:
221
+ Enabled: false
222
+ Style/ArrayCoercion:
223
+ Enabled: true
126
224
  Style/AccessModifierDeclarations:
127
225
  Enabled: false
226
+ Style/AccessorGrouping:
227
+ Enabled: false
128
228
  Style/Alias:
129
229
  EnforcedStyle: prefer_alias_method
130
230
  Style/AndOr:
131
231
  Severity: error
232
+ Style/BisectedAttrAccessor:
233
+ Enabled: true
234
+ Style/CaseLikeIf:
235
+ Enabled: true
132
236
  Style/ClassAndModuleChildren:
133
237
  Exclude:
134
238
  - test/**/*.rb
239
+ Style/ClassEqualityComparison:
240
+ Enabled: true
241
+ Style/CollectionCompact:
242
+ Enabled: true
243
+ Style/CombinableLoops:
244
+ Enabled: true
135
245
  Style/Documentation:
136
246
  Enabled: false
247
+ Style/DocumentDynamicEvalDefinition:
248
+ Enabled: true
137
249
  Style/DoubleNegation:
138
250
  Enabled: false
139
251
  Style/ExponentialNotation:
140
252
  Enabled: true
253
+ Style/ExplicitBlockArgument:
254
+ Enabled: false
141
255
  Style/FormatStringToken:
142
256
  Exclude:
143
257
  - lib/jekyll/utils/ansi.rb
@@ -145,10 +259,16 @@ Style/FormatStringToken:
145
259
  - lib/jekyll/profiler.rb
146
260
  Style/FrozenStringLiteralComment:
147
261
  EnforcedStyle: always
262
+ Style/GlobalStdStream:
263
+ Enabled: true
148
264
  Style/GuardClause:
149
265
  Enabled: false
266
+ Style/HashAsLastArrayItem:
267
+ Enabled: true
150
268
  Style/HashEachMethods:
151
269
  Enabled: true
270
+ Style/HashLikeCase:
271
+ Enabled: true
152
272
  Style/HashSyntax:
153
273
  EnforcedStyle: hash_rockets
154
274
  Severity: error
@@ -156,6 +276,8 @@ Style/HashTransformKeys:
156
276
  Enabled: false
157
277
  Style/HashTransformValues:
158
278
  Enabled: true
279
+ Style/KeywordParametersOrder:
280
+ Enabled: true
159
281
  Style/MixinUsage:
160
282
  Exclude:
161
283
  - test/helper.rb
@@ -163,6 +285,12 @@ Style/ModuleFunction:
163
285
  Enabled: false
164
286
  Style/MultilineTernaryOperator:
165
287
  Severity: error
288
+ Style/NegatedIfElseCondition:
289
+ Enabled: true
290
+ Style/NilLambda:
291
+ Enabled: true
292
+ Style/OptionalBooleanParameter:
293
+ Enabled: true
166
294
  Style/PercentLiteralDelimiters:
167
295
  PreferredDelimiters:
168
296
  "%q": "{}"
@@ -172,12 +300,22 @@ Style/PercentLiteralDelimiters:
172
300
  "%w": "()"
173
301
  "%W": "()"
174
302
  "%x": "()"
303
+ Style/RedundantArgument:
304
+ Enabled: true
305
+ Style/RedundantAssignment:
306
+ Enabled: true
307
+ Style/RedundantBegin:
308
+ Enabled: false
175
309
  Style/RedundantFetchBlock:
176
310
  Enabled: false
311
+ Style/RedundantFileExtensionInRequire:
312
+ Enabled: true
177
313
  Style/RedundantRegexpCharacterClass:
178
314
  Enabled: true
179
315
  Style/RedundantRegexpEscape:
180
316
  Enabled: true
317
+ Style/RedundantSelfAssignment:
318
+ Enabled: true
181
319
  Style/RegexpLiteral:
182
320
  EnforcedStyle: percent_r
183
321
  Style/RescueModifier:
@@ -187,12 +325,23 @@ Style/SafeNavigation:
187
325
  - lib/jekyll/document.rb
188
326
  Style/SignalException:
189
327
  EnforcedStyle: only_raise
328
+ Style/SingleArgumentDig:
329
+ Enabled: true
190
330
  Style/SlicingWithRange:
191
331
  Enabled: false
332
+ Style/SoleNestedConditional:
333
+ Enabled: true
192
334
  Style/StringLiterals:
193
335
  EnforcedStyle: double_quotes
336
+ Style/StringConcatenation:
337
+ Enabled: true
338
+ Exclude:
339
+ - lib/jekyll/commands/*.rb
340
+ - test/**/*.rb
194
341
  Style/StringLiteralsInInterpolation:
195
342
  EnforcedStyle: double_quotes
343
+ Style/SwapValues:
344
+ Enabled: true
196
345
  Style/SymbolArray:
197
346
  EnforcedStyle: brackets
198
347
  Style/TrailingCommaInArrayLiteral:
data/README.markdown CHANGED
@@ -1,19 +1,15 @@
1
1
  # [Jekyll](https://jekyllrb.com/)
2
2
 
3
3
  [![Gem Version](https://img.shields.io/gem/v/jekyll.svg)][ruby-gems]
4
- [![Linux Build Status](https://img.shields.io/travis/jekyll/jekyll/master.svg?label=Linux%20build)][travis]
4
+ [![Linux Build Status](https://github.com/jekyll/jekyll/workflows/Continuous%20Integration/badge.svg)][ci-workflow]
5
5
  [![Windows Build status](https://img.shields.io/appveyor/ci/jekyll/jekyll/master.svg?label=Windows%20build)][appveyor]
6
- [![Maintainability](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/maintainability)][codeclimate]
7
- [![Test Coverage](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/test_coverage)][coverage]
8
6
  [![Security](https://hakiri.io/github/jekyll/jekyll/master.svg)][hakiri]
9
7
  [![Backers on Open Collective](https://opencollective.com/jekyll/backers/badge.svg)](#backers)
10
8
  [![Sponsors on Open Collective](https://opencollective.com/jekyll/sponsors/badge.svg)](#sponsors)
11
9
 
12
10
  [ruby-gems]: https://rubygems.org/gems/jekyll
13
- [codeclimate]: https://codeclimate.com/github/jekyll/jekyll
14
- [coverage]: https://codeclimate.com/github/jekyll/jekyll/coverage
15
11
  [hakiri]: https://hakiri.io/github/jekyll/jekyll/master
16
- [travis]: https://travis-ci.org/jekyll/jekyll
12
+ [ci-workflow]: https://github.com/jekyll/jekyll/actions?query=workflow%3A%22Continuous+Integration%22+branch%3Amaster
17
13
  [appveyor]: https://ci.appveyor.com/project/jekyll/jekyll/branch/master
18
14
 
19
15
  Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Jekyll takes your content, renders Markdown and Liquid templates, and spits out a complete, static website ready to be served by Apache, Nginx or another web server. Jekyll is the engine behind [GitHub Pages](https://pages.github.com), which you can use to host sites right from your GitHub repositories.
@@ -7,6 +7,6 @@
7
7
  <link rel="stylesheet" href="{{ "/assets/css/main.css" | relative_url }}">
8
8
  </head>
9
9
  <body>
10
- {{ content}}
10
+ {{ content }}
11
11
  </body>
12
12
  </html>
@@ -44,7 +44,7 @@ module Jekyll
44
44
  dirs = keep_dirs
45
45
 
46
46
  Utils.safe_glob(site.in_dest_dir, ["**", "*"], File::FNM_DOTMATCH).each do |file|
47
- next if file =~ HIDDEN_FILE_REGEX || file =~ regex || dirs.include?(file)
47
+ next if HIDDEN_FILE_REGEX.match?(file) || regex.match?(file) || dirs.include?(file)
48
48
 
49
49
  files << file
50
50
  end
@@ -67,15 +67,16 @@ module Jekyll
67
67
 
68
68
  def conflicting_urls(site)
69
69
  conflicting_urls = false
70
- urls = {}
71
- urls = collect_urls(urls, site.pages, site.dest)
72
- urls = collect_urls(urls, site.posts.docs, site.dest)
73
- urls.each do |url, paths|
70
+ destination_map(site).each do |dest, paths|
74
71
  next unless paths.size > 1
75
72
 
76
73
  conflicting_urls = true
77
- Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" \
78
- " for the following pages: #{paths.join(", ")}"
74
+ Jekyll.logger.warn "Conflict:",
75
+ "The following destination is shared by multiple files."
76
+ Jekyll.logger.warn "", "The written file may end up with unexpected contents."
77
+ Jekyll.logger.warn "", dest.to_s.cyan
78
+ paths.each { |path| Jekyll.logger.warn "", " - #{path}" }
79
+ Jekyll.logger.warn ""
79
80
  end
80
81
  conflicting_urls
81
82
  end
@@ -84,7 +85,7 @@ module Jekyll
84
85
  return true unless Utils::Platforms.osx?
85
86
 
86
87
  if Dir.pwd != `pwd`.strip
87
- Jekyll.logger.error " " + <<-STR.strip.gsub(%r!\n\s+!, "\n ")
88
+ Jekyll.logger.error <<~STR
88
89
  We have detected that there might be trouble using fsevent on your
89
90
  operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug)
90
91
  for possible work arounds or you can work around it immediately
@@ -122,16 +123,19 @@ module Jekyll
122
123
 
123
124
  private
124
125
 
125
- def collect_urls(urls, things, destination)
126
- things.each do |thing|
127
- dest = thing.destination(destination)
128
- if urls[dest]
129
- urls[dest] << thing.path
130
- else
131
- urls[dest] = [thing.path]
126
+ def destination_map(site)
127
+ {}.tap do |result|
128
+ site.each_site_file do |thing|
129
+ next if allow_used_permalink?(thing)
130
+
131
+ dest_path = thing.destination(site.dest)
132
+ (result[dest_path] ||= []) << thing.path
132
133
  end
133
134
  end
134
- urls
135
+ end
136
+
137
+ def allow_used_permalink?(item)
138
+ defined?(JekyllRedirectFrom) && item.is_a?(JekyllRedirectFrom::RedirectPage)
135
139
  end
136
140
 
137
141
  def case_insensitive_urls(things, destination)
@@ -99,6 +99,9 @@ module Jekyll
99
99
  # Performance-booster for watching directories on Windows
100
100
  gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
101
101
 
102
+ # Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
103
+ # do not have a Java counterpart.
104
+ gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
102
105
  RUBY
103
106
  end
104
107
 
@@ -20,7 +20,6 @@ module Jekyll
20
20
  end
21
21
  end
22
22
 
23
- # rubocop:disable Metrics/AbcSize
24
23
  def process(args, opts)
25
24
  if !args || args.empty?
26
25
  raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name."
@@ -35,7 +34,6 @@ module Jekyll
35
34
  " is ready for you in #{theme.path.to_s.cyan}!"
36
35
  Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
37
36
  end
38
- # rubocop:enable Metrics/AbcSize
39
37
  end
40
38
  end
41
39
  end
@@ -269,21 +269,18 @@ module Jekyll
269
269
 
270
270
  private
271
271
 
272
+ STYLE_TO_PERMALINK = {
273
+ :none => "/:categories/:title:output_ext",
274
+ :date => "/:categories/:year/:month/:day/:title:output_ext",
275
+ :ordinal => "/:categories/:year/:y_day/:title:output_ext",
276
+ :pretty => "/:categories/:year/:month/:day/:title/",
277
+ :weekdate => "/:categories/:year/W:week/:short_day/:title:output_ext",
278
+ }.freeze
279
+
280
+ private_constant :STYLE_TO_PERMALINK
281
+
272
282
  def style_to_permalink(permalink_style)
273
- case permalink_style.to_sym
274
- when :pretty
275
- "/:categories/:year/:month/:day/:title/"
276
- when :none
277
- "/:categories/:title:output_ext"
278
- when :date
279
- "/:categories/:year/:month/:day/:title:output_ext"
280
- when :ordinal
281
- "/:categories/:year/:y_day/:title:output_ext"
282
- when :weekdate
283
- "/:categories/:year/W:week/:short_day/:title:output_ext"
284
- else
285
- permalink_style.to_s
286
- end
283
+ STYLE_TO_PERMALINK[permalink_style.to_sym] || permalink_style.to_s
287
284
  end
288
285
 
289
286
  def check_include_exclude(config)
@@ -35,13 +35,13 @@ module Jekyll
35
35
  # Returns nothing.
36
36
  # rubocop:disable Metrics/AbcSize
37
37
  def read_yaml(base, name, opts = {})
38
- filename = File.join(base, name)
38
+ filename = @path || site.in_source_dir(base, name)
39
+ Jekyll.logger.debug "Reading:", relative_path
39
40
 
40
41
  begin
41
- self.content = File.read(@path || site.in_source_dir(base, name),
42
- **Utils.merged_file_read_opts(site, opts))
42
+ self.content = File.read(filename, **Utils.merged_file_read_opts(site, opts))
43
43
  if content =~ Document::YAML_FRONT_MATTER_REGEXP
44
- self.content = $POSTMATCH
44
+ self.content = Regexp.last_match.post_match
45
45
  self.data = SafeYAML.load(Regexp.last_match(1))
46
46
  end
47
47
  rescue Psych::SyntaxError => e
@@ -69,7 +69,7 @@ module Jekyll
69
69
  end
70
70
 
71
71
  def validate_permalink!(filename)
72
- if self.data["permalink"]&.to_s&.empty?
72
+ if self.data["permalink"] == ""
73
73
  raise Errors::InvalidPermalinkError, "Invalid permalink in #{filename}"
74
74
  end
75
75
  end
@@ -117,7 +117,6 @@ module Jekyll
117
117
  hsh[attribute] = send(attribute)
118
118
  end
119
119
 
120
- defaults = site.frontmatter_defaults.all(relative_path, type)
121
120
  Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data)
122
121
  end
123
122
 
@@ -247,6 +246,10 @@ module Jekyll
247
246
 
248
247
  private
249
248
 
249
+ def defaults
250
+ @defaults ||= site.frontmatter_defaults.all(relative_path, type)
251
+ end
252
+
250
253
  def no_layout?
251
254
  data["layout"] == "none"
252
255
  end
@@ -257,14 +257,16 @@ module Jekyll
257
257
  #
258
258
  # Returns the full path to the output file of this document.
259
259
  def destination(base_directory)
260
- dest = site.in_dest_dir(base_directory)
261
- path = site.in_dest_dir(dest, URL.unescape_path(url))
262
- if url.end_with? "/"
263
- path = File.join(path, "index.html")
264
- else
265
- path << output_ext unless path.end_with? output_ext
260
+ @destination ||= {}
261
+ @destination[base_directory] ||= begin
262
+ path = site.in_dest_dir(base_directory, URL.unescape_path(url))
263
+ if url.end_with? "/"
264
+ path = File.join(path, "index.html")
265
+ else
266
+ path << output_ext unless path.end_with? output_ext
267
+ end
268
+ path
266
269
  end
267
- path
268
270
  end
269
271
 
270
272
  # Write the generated Document file to the destination directory.
@@ -351,9 +353,14 @@ module Jekyll
351
353
  # True if the document has a collection and if that collection's #write?
352
354
  # method returns true, and if the site's Publisher will publish the document.
353
355
  # False otherwise.
356
+ #
357
+ # rubocop:disable Naming/MemoizedInstanceVariableName
354
358
  def write?
355
- collection&.write? && site.publisher.publish?(self)
359
+ return @write_p if defined?(@write_p)
360
+
361
+ @write_p = collection&.write? && site.publisher.publish?(self)
356
362
  end
363
+ # rubocop:enable Naming/MemoizedInstanceVariableName
357
364
 
358
365
  # The Document excerpt_separator, from the YAML Front-Matter or site
359
366
  # default excerpt_separator value
@@ -452,7 +459,10 @@ module Jekyll
452
459
  def merge_categories!(other)
453
460
  if other.key?("categories") && !other["categories"].nil?
454
461
  other["categories"] = other["categories"].split if other["categories"].is_a?(String)
455
- other["categories"] = (data["categories"] || []) | other["categories"]
462
+
463
+ if data["categories"].is_a?(Array)
464
+ other["categories"] = data["categories"] | other["categories"]
465
+ end
456
466
  end
457
467
  end
458
468
 
@@ -473,7 +483,7 @@ module Jekyll
473
483
  def read_content(**opts)
474
484
  self.content = File.read(path, **Utils.merged_file_read_opts(site, opts))
475
485
  if content =~ YAML_FRONT_MATTER_REGEXP
476
- self.content = $POSTMATCH
486
+ self.content = Regexp.last_match.post_match
477
487
  data_file = SafeYAML.load(Regexp.last_match(1))
478
488
  merge_data!(data_file, :source => "YAML front matter") if data_file
479
489
  end
@@ -498,7 +508,6 @@ module Jekyll
498
508
  end
499
509
  end
500
510
 
501
- # rubocop:disable Metrics/AbcSize
502
511
  def populate_title
503
512
  if relative_path =~ DATE_FILENAME_MATCHER
504
513
  date, slug, ext = Regexp.last_match.captures
@@ -521,7 +530,6 @@ module Jekyll
521
530
  data["slug"] ||= slug
522
531
  data["ext"] ||= ext
523
532
  end
524
- # rubocop:enable Metrics/AbcSize
525
533
 
526
534
  def modify_date(date)
527
535
  if !data["date"] || data["date"].to_i == site.time.to_i
@@ -7,10 +7,10 @@ module Jekyll
7
7
 
8
8
  mutable false
9
9
 
10
- def_delegator :@obj, :write?, :output
11
- def_delegators :@obj, :label, :docs, :files, :directory, :relative_directory
10
+ delegate_method_as :write?, :output
11
+ delegate_methods :label, :docs, :files, :directory, :relative_directory
12
12
 
13
- private def_delegator :@obj, :metadata, :fallback_data
13
+ private delegate_method_as :metadata, :fallback_data
14
14
 
15
15
  def to_s
16
16
  docs.to_s
@@ -11,10 +11,11 @@ module Jekyll
11
11
 
12
12
  mutable false
13
13
 
14
- def_delegator :@obj, :relative_path, :path
15
- def_delegators :@obj, :id, :output, :content, :to_s, :relative_path, :url, :date
14
+ delegate_method_as :relative_path, :path
15
+ private delegate_method_as :data, :fallback_data
16
16
 
17
- private def_delegator :@obj, :data, :fallback_data
17
+ delegate_methods :id, :output, :content, :to_s, :relative_path, :url, :date
18
+ data_delegators "title", "categories", "tags"
18
19
 
19
20
  def collection
20
21
  @obj.collection.label
@@ -64,18 +65,6 @@ module Jekyll
64
65
  result[key] = doc[key] unless NESTED_OBJECT_FIELD_BLACKLIST.include?(key)
65
66
  end
66
67
  end
67
-
68
- def title
69
- @obj.data["title"]
70
- end
71
-
72
- def categories
73
- @obj.data["categories"]
74
- end
75
-
76
- def tags
77
- @obj.data["tags"]
78
- end
79
68
  end
80
69
  end
81
70
  end