jekyll-last-modified-at 1.2.1 → 1.3.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e6831aedf55b3c70becc35b679f774c69b6057482c7cb56da41f907f1f0dffa
|
4
|
+
data.tar.gz: b8d86118dc3c07cd7b6f72464daccfb389f78e2269de86f83d9edee318998c27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
6
|
+
attr_reader :site_source, :page_path
|
7
|
+
attr_accessor :format
|
7
8
|
|
8
|
-
def initialize(site_source, page_path,
|
9
|
+
def initialize(site_source, page_path, format = nil)
|
9
10
|
@site_source = site_source
|
10
11
|
@page_path = page_path
|
11
|
-
@
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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.
|
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:
|
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.
|
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.
|