lifer 0.6.1 → 0.7.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 +10 -0
- data/Gemfile.lock +1 -1
- data/lib/lifer/brain.rb +1 -8
- data/lib/lifer/builder/html/from_liquid/drops/collection_drop.rb +2 -2
- data/lib/lifer/builder/html/from_liquid/drops/collections_drop.rb +4 -2
- data/lib/lifer/builder/html/from_liquid/drops/entry_drop.rb +1 -2
- data/lib/lifer/builder/html/from_liquid/drops/frontmatter_drop.rb +2 -3
- data/lib/lifer/builder/html/from_liquid/drops/settings_drop.rb +2 -1
- data/lib/lifer/builder/html/from_liquid/filters.rb +3 -5
- data/lib/lifer/builder/html/from_liquid/layout_tag.rb +1 -2
- data/lib/lifer/builder/html.rb +1 -1
- data/lib/lifer/builder/rss.rb +62 -8
- data/lib/lifer/builder.rb +2 -1
- data/lib/lifer/config.rb +1 -1
- data/lib/lifer/dev/response.rb +2 -3
- data/lib/lifer/dev/server.rb +2 -3
- data/lib/lifer/entry/html.rb +3 -3
- data/lib/lifer/entry/markdown.rb +10 -11
- data/lib/lifer/entry/txt.rb +4 -4
- data/lib/lifer/entry.rb +1 -1
- data/lib/lifer/selection.rb +4 -4
- data/lib/lifer/shared/finder_methods.rb +1 -2
- data/lib/lifer/templates/config.yaml +7 -0
- data/lib/lifer/utilities.rb +7 -8
- data/lib/lifer/version.rb +1 -1
- data/lib/lifer.rb +3 -4
- 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: a2f61316d5e10ff4212470b5539741a4204f35976f97d193ef7aabfd944c62a5
|
4
|
+
data.tar.gz: 03b9aafb098ab04f2aa1306fa34512d9627801d468910fb48cd5e10a736b7e47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c1f46e3c16622144cc513b3496d4d0bb9f14231d1b92960b63249b3962753355ed92d5a27ed12ad3bd930e0e56ef871b4551bb4d888e11384191f5747580b19
|
7
|
+
data.tar.gz: bcc5771d87e311dfe52d1c2bc79d9386c8f3677b7f3eafb66100815a9d76b2c8e2b5ce60855424d276c1cc8d8fb5e1c42f2298c5d662edf1ee85d03f8ec1a9c8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
## Next
|
2
2
|
|
3
|
+
## v0.7.0
|
4
|
+
|
5
|
+
This release adds Atom feed support to the RSS builder. In your configuration
|
6
|
+
file, you can configure feed formats to `rss` (the default) or `atom` now:
|
7
|
+
|
8
|
+
my_collection:
|
9
|
+
rss:
|
10
|
+
format: atom
|
11
|
+
url: haha.xml
|
12
|
+
|
3
13
|
## v0.6.1
|
4
14
|
|
5
15
|
This release just fixes a mistake I made, where I built and pushed a tag from a
|
data/Gemfile.lock
CHANGED
data/lib/lifer/brain.rb
CHANGED
@@ -125,8 +125,7 @@ class Lifer::Brain
|
|
125
125
|
# value. If the in-scope collection does not have a configured setting, this
|
126
126
|
# method will return fallback settings (unless `:strict` is `true`).
|
127
127
|
#
|
128
|
-
#
|
129
|
-
#
|
128
|
+
# @example Usage:
|
130
129
|
# setting(:my, :great, :setting)
|
131
130
|
#
|
132
131
|
# @overload setting(path, ..., collection: nil, strict: false)
|
@@ -160,12 +159,6 @@ class Lifer::Brain
|
|
160
159
|
path.start_with?("/") ? path : File.join(root, path)
|
161
160
|
end
|
162
161
|
|
163
|
-
# FIXME:
|
164
|
-
# Do collections work with sub-subdirectories? For example, what if the
|
165
|
-
# configured collection maps to a directory:
|
166
|
-
#
|
167
|
-
# subdirectory_one/sub_subdirectory_one
|
168
|
-
#
|
169
162
|
# @return [Set<Lifer::Collection>]
|
170
163
|
def generate_collections
|
171
164
|
config.collectionables
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Lifer::Builder::HTML::FromLiquid::Drops
|
2
2
|
# This drop allows users to access Lifer collection information from within
|
3
|
-
# Liquid templates.
|
3
|
+
# Liquid templates.
|
4
4
|
#
|
5
|
+
# @example Usage
|
5
6
|
# {{ collection.name }}
|
6
|
-
#
|
7
7
|
# {% for entries in collection.entries %}
|
8
8
|
# {{ entry.title }}
|
9
9
|
# {% endfor %}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Lifer::Builder::HTML::FromLiquid::Drops
|
2
2
|
# This drop allows users to iterate over their Lifer collections in Liquid
|
3
|
-
# templates.
|
3
|
+
# templates.
|
4
4
|
#
|
5
|
+
# @example Usage
|
5
6
|
# {% for collection in collections %}
|
6
7
|
# {{ collection.name }}
|
7
8
|
# {% endfor %}
|
@@ -27,8 +28,9 @@ module Lifer::Builder::HTML::FromLiquid::Drops
|
|
27
28
|
def to_a = @collections
|
28
29
|
|
29
30
|
# Dynamically define Liquid accessors based on the Lifer project's
|
30
|
-
# collection names.
|
31
|
+
# collection names.
|
31
32
|
#
|
33
|
+
# @example Get the root collection's name.
|
32
34
|
# {{ collections.root.name }}
|
33
35
|
#
|
34
36
|
# @param arg [String] The name of a collection.
|
@@ -2,8 +2,7 @@ module Lifer::Builder::HTML::FromLiquid::Drops
|
|
2
2
|
# This drop represents a Lifer entry and allows users to access entry
|
3
3
|
# metadata and content in Liquid templates.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
#
|
5
|
+
# @example Usage
|
7
6
|
# <h1>{{ entry.title }}</h1>
|
8
7
|
# <small>Published on <datetime>{{ entry.date }}</datetime></small>
|
9
8
|
#
|
@@ -2,8 +2,7 @@ module Lifer::Builder::HTML::FromLiquid::Drops
|
|
2
2
|
# Markdown entries may contain YAML frontmatter. And if they do, we need a way
|
3
3
|
# for the Liquid templates to access that data.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
#
|
5
|
+
# @example Usage
|
7
6
|
# {{ entry.frontmatter.any_available_frontmatter_key }}
|
8
7
|
#
|
9
8
|
class FrontmatterDrop < Liquid::Drop
|
@@ -18,8 +17,8 @@ module Lifer::Builder::HTML::FromLiquid::Drops
|
|
18
17
|
def to_s = frontmatter.to_json
|
19
18
|
|
20
19
|
# Dynamically define Liquid accessors based on the Lifer settings object.
|
21
|
-
# For example, to get a collections URI strategy:
|
22
20
|
#
|
21
|
+
# @example Get a collection's URI strategy.
|
23
22
|
# {{ settings.my_collection.uri_strategy }}
|
24
23
|
#
|
25
24
|
# @param arg [String] The name of a collection.
|
@@ -2,6 +2,7 @@ module Lifer::Builder::HTML::FromLiquid::Drops
|
|
2
2
|
# This drop allows users to access the current Lifer project settings from
|
3
3
|
# Liquid templates. Example:
|
4
4
|
#
|
5
|
+
# @example Usage
|
5
6
|
# {{ settings.my_collection.uri_strategy }}
|
6
7
|
#
|
7
8
|
class SettingsDrop < Liquid::Drop
|
@@ -15,8 +16,8 @@ module Lifer::Builder::HTML::FromLiquid::Drops
|
|
15
16
|
def to_s = settings.to_json
|
16
17
|
|
17
18
|
# Dynamically define Liquid accessors based on the Lifer settings object.
|
18
|
-
# For example, to get a collections URI strategy:
|
19
19
|
#
|
20
|
+
# @example Get a collections URI strategy:
|
20
21
|
# {{ settings.my_collection.uri_strategy }}
|
21
22
|
#
|
22
23
|
# @param arg [String] The name of a collection.
|
@@ -1,8 +1,7 @@
|
|
1
1
|
# This module provides Liquid filters to be used within Liquid templates.
|
2
2
|
# In many cases these utilities exist to be pseudo-compatible with Jekyll.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
4
|
+
# @example A filter in a Liquid template.
|
6
5
|
# {{ entry.date | date_to_xmlschema }}
|
7
6
|
#
|
8
7
|
module Lifer::Builder::HTML::FromLiquid::Filters
|
@@ -17,10 +16,9 @@ module Lifer::Builder::HTML::FromLiquid::Filters
|
|
17
16
|
|
18
17
|
# Transforms a string to kabab-case.
|
19
18
|
#
|
20
|
-
#
|
19
|
+
# @example Result
|
20
|
+
# handleize("hello_there") #=> "hello-there"
|
21
21
|
#
|
22
|
-
# Before: hello_there
|
23
|
-
# After: hello-there
|
24
22
|
# @param input [String] A string.
|
25
23
|
# @return [String] The transformed string.
|
26
24
|
def handleize(input) = Util.handleize(input)
|
@@ -11,8 +11,7 @@ class Lifer::Builder::HTML::FromLiquid
|
|
11
11
|
# frontmatter when we didn't need to. Maybe in the long run this was a bad
|
12
12
|
# call? I don't know.
|
13
13
|
#
|
14
|
-
#
|
15
|
-
#
|
14
|
+
# @example Usage from a Liquid template.
|
16
15
|
# {% layout "path/to/my_liquid_layout_template" %}
|
17
16
|
#
|
18
17
|
# (The required `endlayout` tag will be appended to the end of the file
|
data/lib/lifer/builder/html.rb
CHANGED
@@ -74,7 +74,7 @@ class Lifer::Builder::HTML < Lifer::Builder
|
|
74
74
|
# For the given collection, ensure all required directories and
|
75
75
|
# subdirectories exist so the entry output can be safely written to.
|
76
76
|
#
|
77
|
-
# @param
|
77
|
+
# @param collection [Lifer::Collection] A collection.
|
78
78
|
# @return [void]
|
79
79
|
def generate_output_directories_for(collection)
|
80
80
|
directories = collection.entries
|
data/lib/lifer/builder/rss.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
require "rss"
|
3
3
|
|
4
|
+
# FIXME: Can this feed builder just take a type for Atom feeds instead of us
|
5
|
+
# creating a separate builder?
|
6
|
+
|
4
7
|
# Builds a simple, UTF-8, RSS 2.0[1] feed using the Ruby standard library's RSS
|
5
8
|
# features.
|
6
9
|
#
|
@@ -26,6 +29,8 @@ require "rss"
|
|
26
29
|
#
|
27
30
|
# - `count:` - The limit of RSS feed items that should be included in the
|
28
31
|
# output document. Leave unset or set to `0` to include all entries.
|
32
|
+
# - `format:` - The RSS format to build with. Either `rss` or `atom` are
|
33
|
+
# supported. `rss` is the default format.
|
29
34
|
# - `managing_editor:` - the contents of the `<managingEditor>` node of the
|
30
35
|
# RSS document. When unset, Lifer builds a valid `<managingEditor>` value
|
31
36
|
# using the collection or root `author` value and a null email address to
|
@@ -47,10 +52,27 @@ class Lifer::Builder::RSS < Lifer::Builder
|
|
47
52
|
#
|
48
53
|
DEFAULT_MANAGING_EDITOR_EMAIL = "editor@null.invalid"
|
49
54
|
|
55
|
+
# All of the available formats that this builder can build. Where the keys
|
56
|
+
# are formats accepted as input in configuration files and the values are
|
57
|
+
# the formats that the RSS builder will output.
|
58
|
+
#
|
59
|
+
FORMATS = {atom: "atom", rss: "rss2.0"}
|
60
|
+
|
61
|
+
# The default format for this RSS feed builder. Where the key is the format
|
62
|
+
# accepted as input in configuration files and the value is the format that
|
63
|
+
# the RSS builder will output.
|
64
|
+
|
65
|
+
# The name of the format type, as needed by `RSS::Maker`, used by default by
|
66
|
+
# this feed builder.
|
67
|
+
#
|
68
|
+
DEFAULT_MAkER_FORMAT_NAME = FORMATS[:rss]
|
69
|
+
|
70
|
+
|
50
71
|
self.name = :rss
|
51
72
|
self.settings = [
|
52
73
|
rss: [
|
53
74
|
:count,
|
75
|
+
:format,
|
54
76
|
:managing_editor,
|
55
77
|
:url
|
56
78
|
]
|
@@ -69,6 +91,14 @@ class Lifer::Builder::RSS < Lifer::Builder
|
|
69
91
|
end
|
70
92
|
end
|
71
93
|
|
94
|
+
def feed_format(collection)
|
95
|
+
format = Lifer.setting(:rss, :format, collection:)&.to_sym
|
96
|
+
|
97
|
+
return FORMATS[format] if FORMATS.keys.include? format
|
98
|
+
|
99
|
+
DEFAULT_MAkER_FORMAT_NAME
|
100
|
+
end
|
101
|
+
|
72
102
|
# Traverses and renders an RSS feed for feedable collection.
|
73
103
|
#
|
74
104
|
# @return [void]
|
@@ -150,8 +180,10 @@ class Lifer::Builder::RSS < Lifer::Builder
|
|
150
180
|
end
|
151
181
|
end
|
152
182
|
|
153
|
-
#
|
154
|
-
# generated by Lifer are missing some recommended functionality.
|
183
|
+
# @fixme Using the W3C feed validation checker[1], I found that RSS and Atom
|
184
|
+
# feed items generated by Lifer are missing some recommended functionality.
|
185
|
+
#
|
186
|
+
# RSS reports:
|
155
187
|
#
|
156
188
|
# > This feed is valid, but interoperability with the widest range of feed
|
157
189
|
# > readers could be improved by implementing the following recommendations.
|
@@ -169,6 +201,14 @@ class Lifer::Builder::RSS < Lifer::Builder
|
|
169
201
|
# related to our Markdown parser implementation than the RSS feed generation
|
170
202
|
# itself.
|
171
203
|
#
|
204
|
+
# Atom reports:
|
205
|
+
#
|
206
|
+
# > Two or more entries with the same value for <atom:updated>
|
207
|
+
# > (https://validator.w3.org/feed/docs/warning/DuplicateUpdated.html)
|
208
|
+
# >
|
209
|
+
# > Missing <atom:link> with rel="self".
|
210
|
+
# > (https://validator.w3.org/feed/docs/warning/MissingSelf.html)
|
211
|
+
#
|
172
212
|
# [1]: https://validator.w3.org/feed/check.cgi
|
173
213
|
#
|
174
214
|
def rss_entry(rss_feed, lifer_entry)
|
@@ -185,7 +225,7 @@ class Lifer::Builder::RSS < Lifer::Builder
|
|
185
225
|
end
|
186
226
|
end
|
187
227
|
|
188
|
-
#
|
228
|
+
# @fixme Using the W3C feed validation checker[1], I found that RSS feeds
|
189
229
|
# generated by Lifer are missing some recommended functionality. Reports:
|
190
230
|
#
|
191
231
|
# > Missing atom:link with rel="self"
|
@@ -196,20 +236,34 @@ class Lifer::Builder::RSS < Lifer::Builder
|
|
196
236
|
def rss_feed_for(collection, &block)
|
197
237
|
feed_object = nil
|
198
238
|
|
199
|
-
::RSS::Maker.make
|
239
|
+
::RSS::Maker.make feed_format(collection) do |feed|
|
200
240
|
feed.channel.description =
|
201
241
|
Lifer.setting(:description, collection: collection) ||
|
202
242
|
Lifer.setting(:site_title, collection: collection)
|
203
243
|
|
204
244
|
feed.channel.language = Lifer.setting(:language, collection: collection)
|
205
245
|
|
206
|
-
|
207
|
-
|
208
|
-
feed.channel.link = "%s/%s" % [
|
246
|
+
channel_link = "%s/%s" % [
|
209
247
|
Lifer.setting(:global, :host),
|
210
|
-
Lifer.setting(:rss,
|
248
|
+
Lifer.setting(:rss, :url, collection:)
|
211
249
|
]
|
212
250
|
|
251
|
+
# The W3C Atom validator claims that the <id> should be a "canonicalized"
|
252
|
+
# URL with a slash at the end.
|
253
|
+
#
|
254
|
+
channel_link = channel_link + "/" unless channel_link.end_with?("/")
|
255
|
+
|
256
|
+
feed.channel.lastBuildDate = Time.now.to_s
|
257
|
+
feed.channel.link = channel_link
|
258
|
+
|
259
|
+
# Additional channel fields for Atom format feeds.
|
260
|
+
#
|
261
|
+
if feed_format(collection) == "atom"
|
262
|
+
feed.channel.author = Lifer.setting(:author, collection: collection)
|
263
|
+
feed.channel.id = channel_link
|
264
|
+
feed.channel.updated = Time.now.to_s
|
265
|
+
end
|
266
|
+
|
213
267
|
feed.channel.managingEditor = managing_editor(collection)
|
214
268
|
feed.channel.title = Lifer.setting(:title, collection: collection)
|
215
269
|
feed.channel.webMaster =
|
data/lib/lifer/builder.rb
CHANGED
@@ -18,7 +18,8 @@ class Lifer::Builder
|
|
18
18
|
# Every builder class must have execute method. This is the entrypoint for
|
19
19
|
# instantiating *and* executing any builder.
|
20
20
|
#
|
21
|
-
# @param root [string] An absolute path to the Lifer project root
|
21
|
+
# @param root [string] An absolute path to the Lifer project root
|
22
|
+
# directory.
|
22
23
|
# @return [NotImplementedError] A builder subclass must implement this
|
23
24
|
# method.
|
24
25
|
def execute(root:) = (raise NotImplementedError)
|
data/lib/lifer/config.rb
CHANGED
@@ -33,7 +33,7 @@ class Lifer::Config
|
|
33
33
|
# Provides "implicit settings" that may not be set anywhere but really do
|
34
34
|
# require a value.
|
35
35
|
#
|
36
|
-
#
|
36
|
+
# @fixme I don't think this really belongs here. But in some cases we need
|
37
37
|
# to provide the implicit setting key and a default value when calling the
|
38
38
|
# `#setting` method. It would be nicer if the HTML builder handled this,
|
39
39
|
# somehow.
|
data/lib/lifer/dev/response.rb
CHANGED
@@ -33,9 +33,8 @@ module Lifer::Dev
|
|
33
33
|
[File.read(path)]
|
34
34
|
end
|
35
35
|
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# Is there a nice, dependency-free way to do this?
|
36
|
+
# @fixme It would be very nice to not manually manage this list of
|
37
|
+
# content types. Is there a nice, dependency-free way to do this?
|
39
38
|
#
|
40
39
|
def content_type
|
41
40
|
case File.extname(path)
|
data/lib/lifer/dev/server.rb
CHANGED
@@ -71,8 +71,8 @@ module Lifer::Dev
|
|
71
71
|
# @private
|
72
72
|
# On reload, we rebuild the Lifer project.
|
73
73
|
#
|
74
|
-
#
|
75
|
-
#
|
74
|
+
# @fixme Partial rebuilds would be a nice enhancement for performance
|
75
|
+
# reasons.
|
76
76
|
#
|
77
77
|
def reload!
|
78
78
|
if @changes
|
@@ -84,7 +84,6 @@ module Lifer::Dev
|
|
84
84
|
|
85
85
|
# @private
|
86
86
|
# @return [Lifer::Dev::Router] Our dev server router.
|
87
|
-
#
|
88
87
|
def router
|
89
88
|
return @router if @router && !test_mode?
|
90
89
|
|
data/lib/lifer/entry/html.rb
CHANGED
@@ -7,9 +7,9 @@ class Lifer::Entry::HTML < Lifer::Entry
|
|
7
7
|
self.input_extensions = ["html", "html.erb", "html.liquid"]
|
8
8
|
self.output_extension = :html
|
9
9
|
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
10
|
+
# @fixme This could probably get more sophisticated, but at the moment HTML
|
11
|
+
# entries don't have any way to provide metadata about themselves. So let's
|
12
|
+
# just give them a default date to start.
|
13
13
|
#
|
14
14
|
# @return [Time] The publication date of the HTML entry.
|
15
15
|
def date = Lifer::Entry::DEFAULT_DATE
|
data/lib/lifer/entry/markdown.rb
CHANGED
@@ -6,11 +6,11 @@ require_relative "../utilities"
|
|
6
6
|
|
7
7
|
# We should initialize each Markdown file in a Lifer project as a
|
8
8
|
# `Lifer::Entry::Markdown` object. This class contains convenience methods for
|
9
|
-
# parsing a Markdown file with frontmatter as a weblog post or article. Of
|
10
|
-
# all frontmatter key-values will be available for users to render as
|
11
|
-
# their template files.
|
9
|
+
# parsing a Markdown file with frontmatter as a weblog post or article. Of
|
10
|
+
# course, all frontmatter key-values will be available for users to render as
|
11
|
+
# they will in their template files.
|
12
12
|
#
|
13
|
-
#
|
13
|
+
# @fixme As we add other types of entries, especially ones that use frontmatter,
|
14
14
|
# it may make sense to pull some of these methods into a separate module.
|
15
15
|
#
|
16
16
|
class Lifer::Entry::Markdown < Lifer::Entry
|
@@ -86,15 +86,14 @@ class Lifer::Entry::Markdown < Lifer::Entry
|
|
86
86
|
)
|
87
87
|
end
|
88
88
|
|
89
|
-
# FIXME:
|
90
|
-
# This would be easier to test and more appropriate as a module method
|
91
|
-
# takes text and options as arguments.
|
92
|
-
#
|
93
89
|
# If given a summary in the frontmatter of the entry, we can use this to
|
94
90
|
# provide a summary. Otherwise, we can truncate the first paragraph and use
|
95
91
|
# that as a summary, although that is a bit annoying. This is useful for
|
96
92
|
# indexes and feeds and so on.
|
97
93
|
#
|
94
|
+
# @fixme This would be easier to test and more appropriate as a module method
|
95
|
+
# takes text and options as arguments.
|
96
|
+
#
|
98
97
|
# @return [String] A summary of the entry.
|
99
98
|
def summary
|
100
99
|
return frontmatter[:summary] if frontmatter[:summary]
|
@@ -119,9 +118,9 @@ class Lifer::Entry::Markdown < Lifer::Entry
|
|
119
118
|
|
120
119
|
# The HTML representation of the Markdown entry as parsed by Kramdown.
|
121
120
|
#
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
121
|
+
# @fixme Before converting a Kramdown document to Markdown, we should convert
|
122
|
+
# any relative URLs to absolute ones. This makes it more flexible to use
|
123
|
+
# HTML output where ever we want, especially in RSS feeds where feed
|
125
124
|
# readers may "wtf" a relative URL.
|
126
125
|
#
|
127
126
|
# @return [String] The HTML for the body of the entry.
|
data/lib/lifer/entry/txt.rb
CHANGED
@@ -7,9 +7,9 @@ class Lifer::Entry::TXT < Lifer::Entry
|
|
7
7
|
self.input_extensions = ["txt"]
|
8
8
|
self.output_extension = :txt
|
9
9
|
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
10
|
+
# @fixme This could probably get more sophisticated, but at the moment HTML
|
11
|
+
# entries don't have any way to provide metadata about themselves. So let's
|
12
|
+
# just give them a default date to start.
|
13
13
|
#
|
14
14
|
# @return [Time] The publication date of the HTML entry.
|
15
15
|
def date = Lifer::Entry::DEFAULT_DATE
|
@@ -34,7 +34,7 @@ class Lifer::Entry::TXT < Lifer::Entry
|
|
34
34
|
# While we don't actually output text to HTML, we need to implement this
|
35
35
|
# method so that the RSS feed builder can add text files as feed entries.
|
36
36
|
#
|
37
|
-
#
|
37
|
+
# @fixme Maybe the `#to_html` methods should be renamed, then?
|
38
38
|
#
|
39
39
|
# @return [String] The output HTML (not actually HTML).
|
40
40
|
def to_html = full_text
|
data/lib/lifer/entry.rb
CHANGED
@@ -8,7 +8,7 @@ require "digest/sha1"
|
|
8
8
|
# should implement. It also provides the entry generator for *all* entry
|
9
9
|
# subclasses.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# @fixme Markdown entries are able to provide metadata via frontmatter, but
|
12
12
|
# other entry types do not currently support frontmatter. Should they? Or is
|
13
13
|
# there some nicer way to provide entry metadata for non-Markdown files in
|
14
14
|
# 2024?
|
data/lib/lifer/selection.rb
CHANGED
@@ -48,13 +48,13 @@ class Lifer::Selection < Lifer::Collection
|
|
48
48
|
raise NotImplementedError, I18n.t("selection.entries_not_implemented")
|
49
49
|
end
|
50
50
|
|
51
|
-
# FIXME:
|
52
|
-
# Getting selection settings may actually need to be different than getting
|
53
|
-
# collection settings. But for now let's just inherit the superclass method.
|
54
|
-
#
|
55
51
|
# A getter for selection settings. See `Lifer::Collection#setting` for more
|
56
52
|
# information.
|
57
53
|
#
|
54
|
+
# @fixme Getting selection settings may actually need to be different than
|
55
|
+
# getting collection settings. But for now let's just inherit the
|
56
|
+
# superclass method.
|
57
|
+
#
|
58
58
|
# @return [String, Symbol, NilClass] The setting for the collection (or a
|
59
59
|
# fallback setting, or a default setting).
|
60
60
|
def setting(...)
|
@@ -32,6 +32,13 @@ uri_strategy: simple
|
|
32
32
|
### uri_strategy: pretty
|
33
33
|
###
|
34
34
|
### layout_file: path/to/my_other_layout.html.erb
|
35
|
+
###
|
36
|
+
### my_with_fine_grained_rss_settings:
|
37
|
+
### rss
|
38
|
+
### count: 99
|
39
|
+
### format: rss
|
40
|
+
### managing_editor: editor@example.com (Managing Editor)
|
41
|
+
### url: custom.xml
|
35
42
|
|
36
43
|
# Selections
|
37
44
|
#
|
data/lib/lifer/utilities.rb
CHANGED
@@ -14,16 +14,15 @@ module Lifer::Utilities
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# Given a string path, classify it into a namespaced Ruby constant. If the
|
17
|
-
# constant does not exist, we raise a helpful error.
|
17
|
+
# constant does not exist, we raise a helpful error.
|
18
18
|
#
|
19
|
-
#
|
20
|
-
#
|
19
|
+
# @example Result
|
20
|
+
# classify("my/class_name/that_exists") #=> My::ClassName::ThatExists
|
21
21
|
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
# (`u_r_i_strategy`).
|
22
|
+
# @fixme Note that this method is currently a bit naive. It cannot politely
|
23
|
+
# transform classes with many caps in them (i.e. `URIStrategy`) without
|
24
|
+
# being given an exact match (`URIStrategy`) or a broken-looking one
|
25
|
+
# (`u_r_i_strategy`).
|
27
26
|
#
|
28
27
|
# @param string_constant [String] A string that maps to a Ruby constant.
|
29
28
|
# @return [Class, Module]
|
data/lib/lifer/version.rb
CHANGED
data/lib/lifer.rb
CHANGED
@@ -63,7 +63,7 @@ module Lifer
|
|
63
63
|
|
64
64
|
# A set of all entries currently in the project.
|
65
65
|
#
|
66
|
-
#
|
66
|
+
# @fixme Do we need this as well as `Lifer.manifest`?
|
67
67
|
#
|
68
68
|
# @return [Set] All entries.
|
69
69
|
def entry_manifest = brain.entry_manifest
|
@@ -85,7 +85,7 @@ module Lifer
|
|
85
85
|
|
86
86
|
# A set of all entries currently in the project.
|
87
87
|
#
|
88
|
-
#
|
88
|
+
# @fixme Do we need this as well as `Lifer.manifest`?
|
89
89
|
#
|
90
90
|
# @return [Set] All entries.
|
91
91
|
def manifest = brain.manifest
|
@@ -99,8 +99,7 @@ module Lifer
|
|
99
99
|
# Register new settings so that they are "safe" and can be read from a Lifer
|
100
100
|
# configuration file. Unregistered settings are ignored.
|
101
101
|
#
|
102
|
-
#
|
103
|
-
#
|
102
|
+
# @example Usage
|
104
103
|
# register_settings(
|
105
104
|
# :hidden,
|
106
105
|
# :birthday,
|
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.7.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-03-
|
11
|
+
date: 2025-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -207,8 +207,8 @@ licenses:
|
|
207
207
|
- MIT
|
208
208
|
metadata:
|
209
209
|
allowed_push_host: https://rubygems.org
|
210
|
-
homepage_uri: https://github.com/benjaminwil/lifer/blob/0.
|
211
|
-
source_code_uri: https://github.com/benjaminwil/lifer/tree/0.
|
210
|
+
homepage_uri: https://github.com/benjaminwil/lifer/blob/0.7.0/README.md
|
211
|
+
source_code_uri: https://github.com/benjaminwil/lifer/tree/0.7.0
|
212
212
|
changelog_uri: https://github.com/benjaminwil/lifer/blob/main/CHANGELOG.md
|
213
213
|
post_install_message:
|
214
214
|
rdoc_options: []
|