lifer 0.10.1 → 0.11.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 +4 -4
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +1 -1
- data/lib/lifer/entry/markdown.rb +6 -6
- data/lib/lifer/entry.rb +3 -2
- data/lib/lifer/uri_strategy/pretty.rb +9 -2
- data/lib/lifer/uri_strategy/pretty_root.rb +19 -5
- data/lib/lifer/uri_strategy/pretty_yyyy_mm_dd.rb +9 -2
- data/lib/lifer/uri_strategy/root.rb +4 -1
- data/lib/lifer/uri_strategy/simple.rb +4 -1
- data/lib/lifer/uri_strategy.rb +18 -0
- data/lib/lifer/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a63fea0c89c87889fa7aab9fc17e53385a562d2bf5bbca5aa552076acc31ed10
|
4
|
+
data.tar.gz: d158cad653234c27d4f17291f2a4511e3896684e148e5aa12206ffdef4403603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59974cefd0e30b280ff61b6e2d624aea02ddeb099afc97eff50796f208f09f1a8327a91004441b87f5e7b5ea1d66908f8ebd56c467d1e2bdddf7f4ed8d1faafe
|
7
|
+
data.tar.gz: b4b288d0a7dd6e1766bdd8dc6ea72b7851aabaaaf16eb6eaf3a1c11f6d14ef2a3d2f4f859c38f6c4ed6127afedb1655cf9b5f705ade2d22683eb3f27224f8589
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
## Next
|
2
2
|
|
3
|
+
## v0.11.0
|
4
|
+
|
5
|
+
This release adds new functionality to our URI strategies, adding
|
6
|
+
`URIStrategy#permalink`, to make support for pretty URI strategies (i.e. where
|
7
|
+
entries all end in `/index.ext`) better and more compatible with web servers
|
8
|
+
where `foo` is the "same thing" as `foo/index.html`.
|
9
|
+
|
10
|
+
Example output filename:
|
11
|
+
|
12
|
+
/my/filename/index.html
|
13
|
+
|
14
|
+
Expected permalink for this file using a pretty URI strategy:
|
15
|
+
|
16
|
+
/my/filename
|
17
|
+
|
18
|
+
## v0.10.2
|
19
|
+
|
20
|
+
This release resolves another bug in `Entry#summary` causing entries without
|
21
|
+
full-stops within the truncation threshold to not be truncated with a "..."
|
22
|
+
properly.
|
23
|
+
|
3
24
|
## v0.10.1
|
4
25
|
|
5
26
|
This release resolves a bug with `Entry#summary`. When I originally implemented
|
data/Gemfile.lock
CHANGED
data/lib/lifer/entry/markdown.rb
CHANGED
@@ -35,12 +35,12 @@ class Lifer::Entry::Markdown < Lifer::Entry
|
|
35
35
|
text = raw_first_paragraph_text
|
36
36
|
return text if text.length <= TRUNCATION_THRESHOLD
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
text = text[0..TRUNCATION_THRESHOLD]
|
39
|
+
|
40
|
+
# Index of the fullstop from the last complete sentence in the truncated
|
41
|
+
# text.
|
42
|
+
last_fullstop_index = text.rindex /(\.) /
|
43
|
+
last_fullstop_index ? text[0..last_fullstop_index] : "%s..." % text
|
44
44
|
end
|
45
45
|
|
46
46
|
# The title or a default title.
|
data/lib/lifer/entry.rb
CHANGED
@@ -194,9 +194,10 @@ module Lifer
|
|
194
194
|
cached_permalink_variable,
|
195
195
|
File.join(
|
196
196
|
host,
|
197
|
-
Lifer::URIStrategy
|
197
|
+
Lifer::URIStrategy
|
198
|
+
.find(collection.setting :uri_strategy)
|
198
199
|
.new(root: Lifer.root)
|
199
|
-
.
|
200
|
+
.permalink(self)
|
200
201
|
)
|
201
202
|
)
|
202
203
|
end
|
@@ -14,8 +14,15 @@ class Lifer::URIStrategy::Pretty < Lifer::URIStrategy
|
|
14
14
|
basename = File.basename entry.file,
|
15
15
|
Lifer::Utilities.file_extension(entry.file)
|
16
16
|
|
17
|
-
|
17
|
+
entry.file.to_s
|
18
18
|
.gsub(/#{root}[\/]{0,1}/, "")
|
19
|
-
.gsub(/#{basename}(\..+)/, "#{basename}
|
19
|
+
.gsub(/#{basename}(\..+)/, "#{basename}#{pretty_part entry}")
|
20
20
|
end
|
21
|
+
|
22
|
+
# @see Lifer::UriStrategy#permalink
|
23
|
+
def permalink(entry) = output_file(entry).gsub pretty_part(entry), ""
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def pretty_part(entry) = "/index.#{file_extension(entry)}"
|
21
28
|
end
|
@@ -11,14 +11,28 @@ class Lifer::URIStrategy
|
|
11
11
|
|
12
12
|
# @see Lifer::URIStrategy#output_file
|
13
13
|
def output_file(entry)
|
14
|
-
basename
|
15
|
-
|
14
|
+
if basename(entry) == "index"
|
15
|
+
"index.html"
|
16
|
+
else
|
17
|
+
"#{basename entry}#{pretty_part entry}"
|
18
|
+
end
|
19
|
+
end
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
# @see Lifer::UriStrategy#permalink
|
22
|
+
def permalink(entry)
|
23
|
+
if basename(entry) == "index"
|
24
|
+
"/"
|
19
25
|
else
|
20
|
-
|
26
|
+
output_file(entry).gsub pretty_part(entry), ""
|
21
27
|
end
|
22
28
|
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def basename(entry)
|
33
|
+
File.basename entry.file, Lifer::Utilities.file_extension(entry.file)
|
34
|
+
end
|
35
|
+
|
36
|
+
def pretty_part(entry) = "/index.#{file_extension(entry)}"
|
23
37
|
end
|
24
38
|
end
|
@@ -24,9 +24,16 @@
|
|
24
24
|
basename = File.basename entry.file,
|
25
25
|
Lifer::Utilities.file_extension(entry.file)
|
26
26
|
|
27
|
-
|
27
|
+
entry.file.to_s
|
28
28
|
.gsub(/#{root}[\/]{0,1}/, "")
|
29
|
-
.gsub(/#{basename}(\..+)/, "#{basename}
|
29
|
+
.gsub(/#{basename}(\..+)/, "#{basename}#{pretty_part entry}")
|
30
30
|
.gsub(DATE_REGEXP, "")
|
31
31
|
end
|
32
|
+
|
33
|
+
# @see Lifer::UriStrategy#permalink
|
34
|
+
def permalink(entry) = output_file(entry).gsub pretty_part(entry), ""
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def pretty_part(entry) = "/index.#{file_extension(entry)}"
|
32
39
|
end
|
@@ -11,7 +11,10 @@ class Lifer::URIStrategy
|
|
11
11
|
basename = File.basename entry.file,
|
12
12
|
Lifer::Utilities.file_extension(entry.file)
|
13
13
|
|
14
|
-
|
14
|
+
"#{basename}.#{file_extension(entry)}"
|
15
15
|
end
|
16
|
+
|
17
|
+
# @see Lifer::UriStrategy#permalink
|
18
|
+
def permalink(entry) = output_file(entry)
|
16
19
|
end
|
17
20
|
end
|
@@ -10,8 +10,11 @@ class Lifer::URIStrategy::Simple < Lifer::URIStrategy
|
|
10
10
|
basename = File.basename entry.file,
|
11
11
|
Lifer::Utilities.file_extension(entry.file)
|
12
12
|
|
13
|
-
|
13
|
+
entry.file.to_s
|
14
14
|
.gsub(/#{root}[\/]{0,1}/, "")
|
15
15
|
.gsub(/#{basename}(\..+)/, "#{basename}.#{file_extension(entry)}")
|
16
16
|
end
|
17
|
+
|
18
|
+
# @see Lifer::UriStrategy#permalink
|
19
|
+
def permalink(entry) = output_file(entry)
|
17
20
|
end
|
data/lib/lifer/uri_strategy.rb
CHANGED
@@ -39,6 +39,24 @@ class Lifer::URIStrategy
|
|
39
39
|
raise NotImplementedError, I18n.t("shared.not_implemented_method")
|
40
40
|
end
|
41
41
|
|
42
|
+
# This method should sometimes return the path to the file in the format
|
43
|
+
# specified by the current URI strategy. Of course, this depends on what the URI
|
44
|
+
# stategy is. For "pretty" strategies, the permalink may differ from the output
|
45
|
+
# filename. For example, the output file may point to
|
46
|
+
#
|
47
|
+
# entry-name/index.html
|
48
|
+
#
|
49
|
+
# While the permalink like points to:
|
50
|
+
#
|
51
|
+
# entry-name
|
52
|
+
#
|
53
|
+
# @raise [NotImplementedError] This method must be implemented on each
|
54
|
+
# subclass.
|
55
|
+
# @return [String] The permalink to the built output file.
|
56
|
+
def permalink(entry)
|
57
|
+
raise NotImplementedError, I18n.t("shared.not_implemented_error")
|
58
|
+
end
|
59
|
+
|
42
60
|
private
|
43
61
|
|
44
62
|
def file_extension(entry) = entry.class.output_extension
|
data/lib/lifer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lifer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- benjamin wil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -210,8 +210,8 @@ licenses:
|
|
210
210
|
- MIT
|
211
211
|
metadata:
|
212
212
|
allowed_push_host: https://rubygems.org
|
213
|
-
homepage_uri: https://github.com/benjaminwil/lifer/blob/v0.
|
214
|
-
source_code_uri: https://github.com/benjaminwil/lifer/tree/v0.
|
213
|
+
homepage_uri: https://github.com/benjaminwil/lifer/blob/v0.11.0/README.md
|
214
|
+
source_code_uri: https://github.com/benjaminwil/lifer/tree/v0.11.0
|
215
215
|
changelog_uri: https://github.com/benjaminwil/lifer/blob/main/CHANGELOG.md
|
216
216
|
post_install_message:
|
217
217
|
rdoc_options: []
|