jekyll 4.3.0 → 4.3.1

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: 96201c2ad5de2a82883b9efe695bfd44841b88be07a878479b6cda7bac0c2c9e
4
- data.tar.gz: b23a9dcb412a6605a65aea79fbec04cff5f6e2d219c0009cf22a624a7514a19f
3
+ metadata.gz: 2aeb2bbb34dfbdffa695f378301a1d07489c82828c2e5cbea920786e83d391f6
4
+ data.tar.gz: 41f746d2a3c406ff6789defd5801212b3fa2f223ab76d7dbf1b367754694b48b
5
5
  SHA512:
6
- metadata.gz: 457379d010c3e05bd5ee7472a38574ac5101af8740949738b221d8db369dcbae83d659591096876eff2878962a824d1f4abebd17f81be869889d4be2cb6e2d53
7
- data.tar.gz: e2feb1925ca0ac86528b53c8e72f1f121b39deaaae92f21d777d10b8c2224e75ea6070553e276962b248d1a8d2a89812472d60d9502b110abf6268702ac2c3d7
6
+ metadata.gz: e82a99626b40672bb732e28504067169d63ba64761d34e660a4e9d3c0bad678565567955d4766bd52ba49af69d03960627c3076fe96c9de4b1e3b39f36eec49b
7
+ data.tar.gz: 5d77890bfb0b4ecbeff0f50d5978bbd7a7014460915b06c93a26b822c96ab6afc333cc02e9290e62429828578cef2cb6a0f84053461fa6359940075782a37bd8
@@ -12,7 +12,6 @@ module Jekyll
12
12
  mutable false
13
13
 
14
14
  delegate_method_as :relative_path, :path
15
- delegate_method_as :basename, :name
16
15
  private delegate_method_as :data, :fallback_data
17
16
 
18
17
  delegate_methods :id, :output, :content, :to_s, :relative_path, :url, :date
@@ -26,6 +25,10 @@ module Jekyll
26
25
  fallback_data["excerpt"].to_s
27
26
  end
28
27
 
28
+ def name
29
+ fallback_data["name"] || @obj.basename
30
+ end
31
+
29
32
  def <=>(other)
30
33
  return nil unless other.is_a? DocumentDrop
31
34
 
@@ -16,7 +16,7 @@ module Jekyll
16
16
  end
17
17
 
18
18
  def name
19
- @obj.doc.basename
19
+ @obj.doc.data["name"] || @obj.doc.basename
20
20
  end
21
21
  end
22
22
  end
@@ -7,6 +7,7 @@ module Jekyll
7
7
 
8
8
  mutable false
9
9
 
10
+ delegate_method_as :site_data, :data
10
11
  delegate_methods :time, :pages, :static_files, :tags, :categories
11
12
 
12
13
  private delegate_method_as :config, :fallback_data
@@ -23,12 +24,6 @@ module Jekyll
23
24
  (key != "posts" && @obj.collections.key?(key)) || super
24
25
  end
25
26
 
26
- def data
27
- @obj.site_data.tap do |value|
28
- value.context = @context if value.respond_to?(:context=)
29
- end
30
- end
31
-
32
27
  def posts
33
28
  @site_posts ||= @obj.posts.docs.sort { |a, b| b <=> a }
34
29
  end
@@ -6,7 +6,7 @@ module Jekyll
6
6
 
7
7
  def initialize(site, in_source_dir: nil)
8
8
  @site = site
9
- @content = DataHash.new
9
+ @content = {}
10
10
  @entry_filter = EntryFilter.new(site)
11
11
  @in_source_dir = in_source_dir || @site.method(:in_source_dir)
12
12
  @source_dir = @in_source_dir.call("/")
@@ -24,8 +24,6 @@ module Jekyll
24
24
  @content
25
25
  end
26
26
 
27
- # rubocop:disable Metrics/AbcSize
28
-
29
27
  # Read and parse all .yaml, .yml, .json, .csv and .tsv
30
28
  # files under <dir> and add them to the <data> variable.
31
29
  #
@@ -45,14 +43,13 @@ module Jekyll
45
43
  next if @entry_filter.symlink?(path)
46
44
 
47
45
  if File.directory?(path)
48
- read_data_to(path, data[sanitize_filename(entry)] = DataHash.new)
46
+ read_data_to(path, data[sanitize_filename(entry)] = {})
49
47
  else
50
48
  key = sanitize_filename(File.basename(entry, ".*"))
51
- data[key] = DataEntry.new(site, path, read_data_file(path))
49
+ data[key] = read_data_file(path)
52
50
  end
53
51
  end
54
52
  end
55
- # rubocop:enable Metrics/AbcSize
56
53
 
57
54
  # Determines how to read a data file.
58
55
  #
data/lib/jekyll/utils.rb CHANGED
@@ -47,14 +47,7 @@ module Jekyll
47
47
  end
48
48
 
49
49
  def mergable?(value)
50
- case value
51
- when Hash, Drops::Drop, DataHash
52
- true
53
- when DataEntry
54
- mergable?(value.data)
55
- else
56
- false
57
- end
50
+ value.is_a?(Hash) || value.is_a?(Drops::Drop)
58
51
  end
59
52
 
60
53
  def duplicable?(obj)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jekyll
4
- VERSION = "4.3.0"
4
+ VERSION = "4.3.1"
5
5
  end
data/lib/jekyll.rb CHANGED
@@ -45,8 +45,6 @@ module Jekyll
45
45
  autoload :Collection, "jekyll/collection"
46
46
  autoload :Configuration, "jekyll/configuration"
47
47
  autoload :Convertible, "jekyll/convertible"
48
- autoload :DataEntry, "jekyll/data_entry"
49
- autoload :DataHash, "jekyll/data_hash"
50
48
  autoload :Deprecator, "jekyll/deprecator"
51
49
  autoload :Document, "jekyll/document"
52
50
  autoload :EntryFilter, "jekyll/entry_filter"
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.3.0
4
+ version: 4.3.1
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: 2022-10-20 00:00:00.000000000 Z
13
+ date: 2022-10-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable
@@ -295,8 +295,6 @@ files:
295
295
  - lib/jekyll/converters/markdown/kramdown_parser.rb
296
296
  - lib/jekyll/converters/smartypants.rb
297
297
  - lib/jekyll/convertible.rb
298
- - lib/jekyll/data_entry.rb
299
- - lib/jekyll/data_hash.rb
300
298
  - lib/jekyll/deprecator.rb
301
299
  - lib/jekyll/document.rb
302
300
  - lib/jekyll/drops/collection_drop.rb
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- class DataEntry
5
- attr_accessor :context
6
- attr_reader :data
7
-
8
- # Create a Jekyll wrapper for given parsed data object.
9
- #
10
- # site - The current Jekyll::Site instance.
11
- # abs_path - Absolute path to the data source file.
12
- # parsed_data - Parsed representation of data source file contents.
13
- #
14
- # Returns nothing.
15
- def initialize(site, abs_path, parsed_data)
16
- @site = site
17
- @path = abs_path
18
- @data = parsed_data
19
- end
20
-
21
- # Liquid representation of current instance is the parsed data object.
22
- #
23
- # Mark as a dependency for regeneration here since every renderable object primarily uses the
24
- # parsed data object while the parent resource is being rendered by Liquid. Accessing the data
25
- # object directly via Ruby interface `#[]()` is outside the scope of regeneration.
26
- #
27
- # FIXME: Marking as dependency on every call is non-ideal. Optimize at later day.
28
- #
29
- # Returns the parsed data object.
30
- def to_liquid
31
- add_regenerator_dependencies if incremental_build?
32
- @data
33
- end
34
-
35
- # -- Overrides to maintain backwards compatibility --
36
-
37
- # Any missing method will be forwarded to the underlying data object stored in the instance
38
- # variable `@data`.
39
- def method_missing(method, *args, &block)
40
- @data.respond_to?(method) ? @data.send(method, *args, &block) : super
41
- end
42
-
43
- def respond_to_missing?(method, *)
44
- @data.respond_to?(method) || super
45
- end
46
-
47
- def <=>(other)
48
- data <=> (other.is_a?(self.class) ? other.data : other)
49
- end
50
-
51
- def ==(other)
52
- data == (other.is_a?(self.class) ? other.data : other)
53
- end
54
-
55
- # Explicitly defined to bypass re-routing from `method_missing` hook for greater performance.
56
- #
57
- # Returns string representation of parsed data object.
58
- def inspect
59
- @data.inspect
60
- end
61
-
62
- private
63
-
64
- def incremental_build?
65
- @incremental = @site.config["incremental"] if @incremental.nil?
66
- @incremental
67
- end
68
-
69
- def add_regenerator_dependencies
70
- page = context.registers[:page]
71
- return unless page&.key?("path")
72
-
73
- absolute_path = \
74
- if page["collection"]
75
- @site.in_source_dir(@site.config["collections_dir"], page["path"])
76
- else
77
- @site.in_source_dir(page["path"])
78
- end
79
-
80
- @site.regenerator.add_dependency(absolute_path, @path)
81
- end
82
- end
83
- end
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- # A class that behaves very similar to Ruby's `Hash` class yet different in how it is handled by
5
- # Liquid. This class emulates Hash by delegation instead of inheritance to minimize overridden
6
- # methods especially since some Hash methods returns another Hash instance instead of the
7
- # subclass instance.
8
- class DataHash
9
- #
10
- # Delegate given (zero-arity) method(s) to the Hash object stored in instance variable
11
- # `@registry`.
12
- # NOTE: Avoiding the use of `Forwardable` module's `def_delegators` for preventing unnecessary
13
- # creation of interim objects on multiple calls.
14
- def self.delegate_to_registry(*symbols)
15
- symbols.each { |sym| define_method(sym) { @registry.send(sym) } }
16
- end
17
- private_class_method :delegate_to_registry
18
-
19
- # -- core instance methods --
20
-
21
- attr_accessor :context
22
-
23
- def initialize
24
- @registry = {}
25
- end
26
-
27
- def [](key)
28
- @registry[key].tap do |value|
29
- value.context = context if value.respond_to?(:context=)
30
- end
31
- end
32
-
33
- # `Hash#to_liquid` returns the Hash instance itself.
34
- # Mimic that behavior by returning `self` instead of returning the `@registry` variable value.
35
- def to_liquid
36
- self
37
- end
38
-
39
- # -- supplementary instance methods to emulate Hash --
40
-
41
- delegate_to_registry :freeze, :inspect
42
-
43
- def merge(other, &block)
44
- merged_registry = @registry.merge(other, &block)
45
- dup.tap { |d| d.instance_variable_set(:@registry, merged_registry) }
46
- end
47
-
48
- def merge!(other, &block)
49
- @registry.merge!(other, &block)
50
- self
51
- end
52
-
53
- def method_missing(method, *args, &block)
54
- @registry.send(method, *args, &block)
55
- end
56
-
57
- def respond_to_missing?(method, *)
58
- @registry.respond_to?(method)
59
- end
60
- end
61
- end