jekyll-last-modified-at 1.2.1 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f76bca0b09b46eef5bc447edfbbdeba35fc2fbe19f03df85c3ea91cbc2b3d302
4
- data.tar.gz: d2f0670a2fab03f69f6d3666d03dd8a356ab80fc7d6572ed1b0c8ba459e4ca66
3
+ metadata.gz: 7e6831aedf55b3c70becc35b679f774c69b6057482c7cb56da41f907f1f0dffa
4
+ data.tar.gz: b8d86118dc3c07cd7b6f72464daccfb389f78e2269de86f83d9edee318998c27
5
5
  SHA512:
6
- metadata.gz: 49866c3752b95d1bb8f5fa845e6ee28c14de0afca4fd850e0a0e25f22b412c6ebb5575a642a733840fa8a8e34442ef339ff5dea0f218cc2a57f3321edfc8af2c
7
- data.tar.gz: 81561a99693b11272ed8431cd40add63371a8570bc2c83f86cf852674aea86c61aa1f0650d4656f1f718261c93c30d0e2b1efac68d6566c525a5680482ab8bb7
6
+ metadata.gz: c7782f9a82e4ec0c54e89e3a3f234b5f2a8f6d7cd93455c7db53e20e3e4a77eff380cb0f9bd544f6e791e3b00c351530e3625b0640db2856112be740b885272c
7
+ data.tar.gz: ee62f0c449b3393cf5a4b32c8c4926140faea4e41880e88c5fef9f9904aac5b2e50c231752fb0608de2214a023fbff148715920b844d47e3252997f57efd783f
@@ -3,12 +3,13 @@
3
3
  module Jekyll
4
4
  module LastModifiedAt
5
5
  class Determinator
6
- attr_reader :site_source, :page_path, :opts
6
+ attr_reader :site_source, :page_path
7
+ attr_accessor :format
7
8
 
8
- def initialize(site_source, page_path, opts = {})
9
+ def initialize(site_source, page_path, format = nil)
9
10
  @site_source = site_source
10
11
  @page_path = page_path
11
- @opts = opts
12
+ @format = format || '%d-%b-%y'
12
13
  end
13
14
 
14
15
  def git
@@ -21,7 +22,7 @@ module Jekyll
21
22
  def formatted_last_modified_date
22
23
  return PATH_CACHE[page_path] unless PATH_CACHE[page_path].nil?
23
24
 
24
- last_modified = last_modified_at_time.strftime(format)
25
+ last_modified = last_modified_at_time.strftime(@format)
25
26
  PATH_CACHE[page_path] = last_modified
26
27
  last_modified
27
28
  end
@@ -60,14 +61,6 @@ module Jekyll
60
61
  @to_liquid ||= last_modified_at_time
61
62
  end
62
63
 
63
- def format
64
- opts['format'] ||= '%d-%b-%y'
65
- end
66
-
67
- def format=(new_format)
68
- opts['format'] = new_format
69
- end
70
-
71
64
  private
72
65
 
73
66
  def absolute_path_to_article
@@ -5,7 +5,9 @@ module Jekyll
5
5
  module Hook
6
6
  def self.add_determinator_proc
7
7
  proc { |item|
8
- item.data['last_modified_at'] = Determinator.new(item.site.source, item.path)
8
+ format = item.site.config.dig('last-modified-at', 'date-format')
9
+ item.data['last_modified_at'] = Determinator.new(item.site.source, item.path,
10
+ format)
9
11
  }
10
12
  end
11
13
 
@@ -9,11 +9,11 @@ module Jekyll
9
9
  end
10
10
 
11
11
  def render(context)
12
- site_source = context.registers[:site].source
12
+ site = context.registers[:site]
13
+ format = @format || site.config.dig('last-modified-at', 'date-format')
13
14
  article_file = context.environments.first['page']['path']
14
-
15
- Determinator.new(site_source, article_file,
16
- 'format' => @format).formatted_last_modified_date
15
+ Determinator.new(site.source, article_file, format)
16
+ .formatted_last_modified_date
17
17
  end
18
18
  end
19
19
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module LastModifiedAt
5
- VERSION = '1.2.1'
5
+ VERSION = '1.3.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-last-modified-at
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-02 00:00:00.000000000 Z
11
+ date: 2020-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubygems_version: 3.0.6
163
+ rubygems_version: 3.1.2
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: A liquid tag for Jekyll to indicate the last time a file was modified.