jekyll_all_collections 0.3.3 → 0.3.5
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/.rubocop.yml +5 -2
- data/CHANGELOG.md +41 -11
- data/README.md +129 -60
- data/Rakefile +2 -2
- data/jekyll_all_collections.gemspec +3 -3
- data/lib/all_collections_hooks.rb +9 -4
- data/lib/all_collections_tag.rb +7 -4
- data/lib/jekyll_all_collections/version.rb +1 -1
- data/lib/jekyll_all_collections.rb +2 -2
- data/spec/spec_helper.rb +1 -2
- data/spec/status_persistence.txt +22 -0
- metadata +9 -8
- /data/spec/{all_collections_tag_sort_spec.rb → all_collections_tag/all_collections_tag_sort_spec.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c477b19e427d2b5fe98559dd2fefa87379d8c1607073f27c23848a158f20e0e6
|
|
4
|
+
data.tar.gz: 464c2be868d33b406dad3a5304e7e3d1956b9e021400ee6be66be3f6513a85b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4f69eb2073fe356156a90a626a0d6f9f97764d83fc835047deaf709d188ceacbbf117beb59e5b03e362db4674bbc27e011d09d45c7ef5a0019bc51b405cb879
|
|
7
|
+
data.tar.gz: 9f50b25fb6bfc64dbed2425c0865a7382053cbd45dddfaca6a53bbbed4506fdc2ecb91211e4064d40069651b60dae3d60ded4bff6e17f56f89982199e27b3eb7
|
data/.rubocop.yml
CHANGED
|
@@ -7,11 +7,11 @@ require:
|
|
|
7
7
|
|
|
8
8
|
AllCops:
|
|
9
9
|
Exclude:
|
|
10
|
-
-
|
|
10
|
+
- binstub/**/*
|
|
11
|
+
- demo/_site/*
|
|
11
12
|
- vendor/**/*
|
|
12
13
|
- Gemfile*
|
|
13
14
|
NewCops: enable
|
|
14
|
-
TargetRubyVersion: 2.6
|
|
15
15
|
|
|
16
16
|
Gemspec/DeprecatedAttributeAssignment:
|
|
17
17
|
Enabled: false
|
|
@@ -19,6 +19,9 @@ Gemspec/DeprecatedAttributeAssignment:
|
|
|
19
19
|
Gemspec/RequireMFA:
|
|
20
20
|
Enabled: false
|
|
21
21
|
|
|
22
|
+
Gemspec/RequiredRubyVersion:
|
|
23
|
+
Enabled: false
|
|
24
|
+
|
|
22
25
|
Layout/HashAlignment:
|
|
23
26
|
EnforcedColonStyle: table
|
|
24
27
|
EnforcedHashRocketStyle: table
|
data/CHANGELOG.md
CHANGED
|
@@ -1,29 +1,59 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## 0.3.5 / 2024-03-26
|
|
5
|
+
|
|
6
|
+
* Added `APage.extname` for compatibility with Jekyll
|
|
7
|
+
[`Document`](https://github.com/jekyll/jekyll/blob/master/lib/jekyll/document.rb);
|
|
8
|
+
previously, the filetype of the uri was provided only as `APage.ext`.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## 0.3.4 / 2023-12-24
|
|
12
|
+
|
|
13
|
+
* Changed dependency to Jekyll >= 4.3.2
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
## 0.3.3 / 2023-05-22
|
|
2
|
-
|
|
3
|
-
|
|
17
|
+
|
|
18
|
+
* Corrected key presence checks in APage.initialize
|
|
19
|
+
* Using `warn_short_trace` from `jekyll_plugin_support` for non-fatal errors.
|
|
20
|
+
|
|
4
21
|
|
|
5
22
|
## 0.3.2 / 2023-04-05
|
|
6
|
-
|
|
23
|
+
|
|
24
|
+
* Modified dependency `'jekyll_plugin_support', '>= 0.5.0'`
|
|
25
|
+
|
|
7
26
|
|
|
8
27
|
## 0.3.1 / 2023-03-16
|
|
9
|
-
|
|
28
|
+
|
|
29
|
+
* Reduced the verbosity of the `@logger` message
|
|
10
30
|
|
|
11
31
|
## 0.3.0 / 2023-02-16
|
|
12
|
-
|
|
32
|
+
|
|
33
|
+
* Updated dependency `'jekyll_plugin_support', '~> 0.5.0'`
|
|
13
34
|
|
|
14
35
|
## 0.2.2 / 2023-02-12
|
|
15
|
-
|
|
36
|
+
|
|
37
|
+
* Updated dependency `'jekyll_plugin_support', '~> 0.4.0'`
|
|
38
|
+
|
|
16
39
|
|
|
17
40
|
## 0.2.1 / 2023-02-12
|
|
18
|
-
|
|
41
|
+
|
|
42
|
+
* Reduced the verbosity of log output from `info` to `debug`
|
|
43
|
+
|
|
19
44
|
|
|
20
45
|
## 0.2.0 / 2023-02-04
|
|
21
|
-
|
|
22
|
-
|
|
46
|
+
|
|
47
|
+
* Returns Array[APage] instead of a collection of different types of objects.
|
|
48
|
+
* Converted the plugin to a `:site, :post_read` hook instead of a tag,
|
|
23
49
|
so explicit initialization is no longer required.
|
|
24
50
|
|
|
51
|
+
|
|
25
52
|
## 0.1.1 / 2022-04-27
|
|
26
|
-
|
|
53
|
+
|
|
54
|
+
* Changed invocation from a `:site` hook to an idempotent method invocation.
|
|
55
|
+
|
|
27
56
|
|
|
28
57
|
## 0.1.0 / 2022-04-26
|
|
29
|
-
|
|
58
|
+
|
|
59
|
+
* Initial version published
|
data/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
`jekyll_all_collections`
|
|
2
|
-
|
|
3
|
-
===========
|
|
1
|
+
# `jekyll_all_collections` [](https://badge.fury.io/rb/jekyll_all_collections)
|
|
2
|
+
|
|
4
3
|
|
|
5
4
|
`Jekyll_all_collections` is a Jekyll plugin that adds a new property called `all_collections` to `site`.
|
|
6
5
|
It also provides a new Jekyll tag called `all_collections`,
|
|
@@ -16,6 +15,7 @@ Pages that are not in any collection are not included.
|
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
## Installation
|
|
18
|
+
|
|
19
19
|
Add this line to your application's Gemfile:
|
|
20
20
|
|
|
21
21
|
```ruby
|
|
@@ -26,42 +26,73 @@ end
|
|
|
26
26
|
|
|
27
27
|
And then execute:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
```shell
|
|
30
|
+
$ bundle
|
|
31
|
+
```
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
## Requirements
|
|
33
|
-
|
|
35
|
+
|
|
36
|
+
All the pages in the Jekyll website must have an implicit date
|
|
37
|
+
(for example, all posts are assigned this property by Jekyll),
|
|
34
38
|
or an explicit `date` set in front matter, like this:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
---
|
|
42
|
+
date: 2022-01-01
|
|
43
|
+
---
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If a front matter variable called `last_modified` or `last_modified_at` exists,
|
|
47
|
+
its value will be converted to a Ruby `Date`:
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
---
|
|
51
|
+
last_modified: 2023-01-01
|
|
52
|
+
---
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
---
|
|
59
|
+
last_modified_at: 2023-01-01
|
|
60
|
+
---
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Otherwise, if `last_modified` or `last_modified_at` is not present in the front matter for a page,
|
|
64
|
+
the `date` value will be used last modified date value.
|
|
65
|
+
|
|
55
66
|
|
|
56
67
|
## Usage
|
|
57
68
|
|
|
58
69
|
### `Site.all_collections`
|
|
70
|
+
|
|
59
71
|
No explicit initialization or setup is required.
|
|
60
72
|
Jekyll plugins can access the value of `site.all_collections`, however Liquid code in Jekyll pages and documents cannot.
|
|
61
73
|
|
|
62
74
|
|
|
75
|
+
### Plugin Usage
|
|
76
|
+
|
|
77
|
+
Jekyll generators and tags receive an enhanced version of the `site` Jekyll variable.
|
|
78
|
+
A new array of `APage` instance called `all_collections` is added, one for each Jekyll document and page.
|
|
79
|
+
Examine [`APage.rb`](https://github.com/mslinn/jekyll_all_collections/blob/v0.3.4/lib/all_collections_hooks.rb#L68-L102)
|
|
80
|
+
to see the available properties.
|
|
81
|
+
One particularly useful property is `url`, which is difficult to obtain from Jekyll.
|
|
82
|
+
|
|
83
|
+
All `Jekyll::Page`s and `Jekyll:Document`s can be processed with the following sample code:
|
|
84
|
+
|
|
85
|
+
```ruby
|
|
86
|
+
(@site.all_collections + @site.pages).each do |page_or_apage|
|
|
87
|
+
do_something_with page_or_apage
|
|
88
|
+
end
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
|
|
63
92
|
### `All_collections` Tag
|
|
93
|
+
|
|
64
94
|
Add the following CSS to your stylesheet:
|
|
95
|
+
|
|
65
96
|
```css
|
|
66
97
|
.posts {
|
|
67
98
|
display: flex;
|
|
@@ -82,17 +113,24 @@ Add the following CSS to your stylesheet:
|
|
|
82
113
|
}
|
|
83
114
|
```
|
|
84
115
|
|
|
116
|
+
|
|
85
117
|
#### Excluding Pages
|
|
86
|
-
|
|
87
|
-
|
|
118
|
+
|
|
119
|
+
Adding the following entry to a page’s front matter causes that page to be excluded
|
|
120
|
+
from the collection created by this plugin:
|
|
121
|
+
|
|
122
|
+
```html
|
|
88
123
|
---
|
|
89
124
|
exclude_from_all: true
|
|
90
125
|
---
|
|
91
126
|
```
|
|
92
127
|
|
|
128
|
+
|
|
93
129
|
#### General Form
|
|
130
|
+
|
|
94
131
|
The general form of the Jekyll tag is:
|
|
95
|
-
|
|
132
|
+
|
|
133
|
+
```html
|
|
96
134
|
{% all_collections
|
|
97
135
|
date_column='date|last_modified'
|
|
98
136
|
heading='All Posts'
|
|
@@ -101,7 +139,9 @@ The general form of the Jekyll tag is:
|
|
|
101
139
|
%}
|
|
102
140
|
```
|
|
103
141
|
|
|
142
|
+
|
|
104
143
|
#### `date_column` Attribute
|
|
144
|
+
|
|
105
145
|
One of two date columns can be displayed in the generated HTML:
|
|
106
146
|
either `date` (when the article was originally written),
|
|
107
147
|
or `last_modified`.
|
|
@@ -109,48 +149,59 @@ The default value for the `date_column` attribute is `date`.
|
|
|
109
149
|
|
|
110
150
|
|
|
111
151
|
#### `heading` Attribute
|
|
112
|
-
|
|
113
|
-
|
|
152
|
+
|
|
153
|
+
If no `heading` attribute is specified, a heading will automatically be generated, which contains the `sort_by` values,
|
|
154
|
+
for example:
|
|
155
|
+
|
|
156
|
+
```html
|
|
114
157
|
{% all_collections id='abcdef' sort_by="last_modified" %}
|
|
115
158
|
```
|
|
159
|
+
|
|
116
160
|
Generates a heading like:
|
|
117
|
-
|
|
161
|
+
|
|
162
|
+
```html
|
|
118
163
|
<h2 id="abcdef">All Posts Sorted By last_modified</h2>
|
|
119
164
|
```
|
|
120
165
|
|
|
121
166
|
To suppress both a `h2` heading (and the enclosed `id`) from being generated,
|
|
122
167
|
specify an empty string for the value of `heading`:
|
|
123
|
-
|
|
168
|
+
|
|
169
|
+
```html
|
|
124
170
|
{% all_collections heading='' %}
|
|
125
171
|
```
|
|
126
172
|
|
|
127
173
|
|
|
128
174
|
#### `id` Attribute
|
|
175
|
+
|
|
129
176
|
If your Jekyll layout employs [`jekyll-toc`](https://github.com/allejo/jekyll-toc), then `id` attributes are important.
|
|
130
|
-
The `jekyll-toc` include checks for `id` attributes in `h2` ... `h6` tags, and if found,
|
|
177
|
+
The `jekyll-toc` include checks for `id` attributes in `h2` ... `h6` tags, and if found,
|
|
178
|
+
and if the attribute value is enclosed in double quotes (`id="my_id"`, not `id='my_id'`),
|
|
131
179
|
then the heading is included in the table of contents.
|
|
132
180
|
|
|
133
181
|
To suppress an `id` from being generated,
|
|
134
182
|
and thereby preventing the heading from appearing in the automatically generated table of contents from `jekyll-toc`,
|
|
135
183
|
specify an empty string for the value of `id`, like this:
|
|
136
|
-
|
|
184
|
+
|
|
185
|
+
```html
|
|
137
186
|
{% all_collections id='' %}
|
|
138
187
|
```
|
|
139
188
|
|
|
140
189
|
|
|
141
190
|
#### `SORT_KEYS` Values
|
|
191
|
+
|
|
142
192
|
`SORT_KEYS` specifies how to sort the collection.
|
|
143
193
|
Values can include one or more of the following attributes:
|
|
144
|
-
`date`, `destination`, `draft`, `label`, `last_modified`, `last_modified_at`, `path`, `relative_path`,
|
|
194
|
+
`date`, `destination`, `draft`, `label`, `last_modified`, `last_modified_at`, `path`, `relative_path`,
|
|
195
|
+
`title`, `type`, and `url`.
|
|
145
196
|
Ascending sorts are the default, however a descending sort can be achieved by prepending `-` before an attribute.
|
|
146
197
|
|
|
147
198
|
To specify more than one sort key, provide a comma-delimited string of values.
|
|
148
199
|
Included spaces are ignored.
|
|
149
|
-
For example, specify the primary sort key as
|
|
150
|
-
the secondary sort key as
|
|
151
|
-
and the tertiary key as
|
|
200
|
+
For example, specify the primary sort key as `draft`,
|
|
201
|
+
the secondary sort key as `last_modified`,
|
|
202
|
+
and the tertiary key as `label`:
|
|
152
203
|
|
|
153
|
-
```
|
|
204
|
+
```html
|
|
154
205
|
{% all_collections
|
|
155
206
|
date_column='last_modified'
|
|
156
207
|
heading='All Posts'
|
|
@@ -160,10 +211,12 @@ and the tertiary key as <code>label</code>:
|
|
|
160
211
|
```
|
|
161
212
|
|
|
162
213
|
|
|
163
|
-
#### Usage Examples
|
|
214
|
+
#### Liquid Usage Examples
|
|
215
|
+
|
|
164
216
|
Here is a short Jekyll page, including front matter,
|
|
165
217
|
demonstrating this plugin being invoked with all default attribute values:
|
|
166
|
-
|
|
218
|
+
|
|
219
|
+
```html
|
|
167
220
|
---
|
|
168
221
|
description: "
|
|
169
222
|
Dump of all collections, sorted by date originally written, newest to oldest.
|
|
@@ -177,51 +230,62 @@ title: Testing, 1, 2, 3
|
|
|
177
230
|
|
|
178
231
|
Explicitly express the default sort
|
|
179
232
|
(sort by the date originally written, newest to oldest):
|
|
180
|
-
|
|
233
|
+
|
|
234
|
+
```html
|
|
181
235
|
{% all_collections sort_by="-date" %}
|
|
182
236
|
```
|
|
183
237
|
|
|
184
238
|
Sort by date, from oldest to newest:
|
|
185
|
-
|
|
239
|
+
|
|
240
|
+
```html
|
|
186
241
|
{% all_collections sort_by="date" %}
|
|
187
242
|
```
|
|
188
243
|
|
|
189
244
|
Sort by the date last modified, oldest to newest:
|
|
190
|
-
|
|
245
|
+
|
|
246
|
+
```html
|
|
191
247
|
{% all_collections sort_by="last_modified" %}
|
|
192
248
|
```
|
|
193
249
|
|
|
194
250
|
Sort by the date last modified, newest to oldest:
|
|
195
|
-
|
|
251
|
+
|
|
252
|
+
```html
|
|
196
253
|
{% all_collections sort_by="-last_modified" %}
|
|
197
254
|
```
|
|
198
255
|
|
|
199
256
|
Several attributes can be specified as sort criteria by passing them as a comma-delimited string.
|
|
200
257
|
Included spaces are ignored:
|
|
201
|
-
|
|
258
|
+
|
|
259
|
+
```html
|
|
202
260
|
{% all_collections sort_by="-last_modified, -date" %}
|
|
203
261
|
{% all_collections sort_by="-last_modified, title" %}
|
|
204
262
|
{% all_collections sort_by="-last_modified, -date, title" %}
|
|
205
263
|
```
|
|
206
264
|
|
|
207
265
|
The following two examples produce the same output:
|
|
208
|
-
|
|
266
|
+
|
|
267
|
+
```html
|
|
209
268
|
{% all_collections sort_by="-last_modified,-date" %}
|
|
210
269
|
{% all_collections sort_by="-last_modified, -date" %}
|
|
211
270
|
```
|
|
212
271
|
|
|
213
272
|
|
|
214
273
|
## Demo
|
|
274
|
+
|
|
215
275
|
The [`demo`](./demo) directory contains a demonstration website, which uses the plugin.
|
|
216
276
|
To run, type:
|
|
277
|
+
|
|
217
278
|
```console
|
|
218
279
|
$ demo/_bin/debug -r
|
|
219
280
|
```
|
|
281
|
+
|
|
220
282
|
Now point your web browser to http://localhost:4444
|
|
221
283
|
|
|
222
284
|
|
|
223
285
|
## Debugging
|
|
286
|
+
|
|
224
287
|
You can control the verbosity of log output by adding the following to `_config.yml` in your Jekyll project:
|
|
288
|
+
|
|
225
289
|
```yaml
|
|
226
290
|
plugin_loggers:
|
|
227
291
|
AllCollectionsTag::AllCollectionsTag: warn
|
|
@@ -231,7 +295,8 @@ plugin_loggers:
|
|
|
231
295
|
1. You have two options for initiating a debug session:
|
|
232
296
|
|
|
233
297
|
1. Run `demo/_bin/debug`, without the `-r` options shown above.
|
|
234
|
-
|
|
298
|
+
|
|
299
|
+
```console
|
|
235
300
|
... lots of output as bundle update runs...
|
|
236
301
|
Bundle updated!
|
|
237
302
|
|
|
@@ -248,6 +313,7 @@ plugin_loggers:
|
|
|
248
313
|
|
|
249
314
|
2. Run `bin/attach` and pass the directory name of a Jekyll website that has a suitable script called `_bin/debug`.
|
|
250
315
|
The `demo` subdirectory fits this description.
|
|
316
|
+
|
|
251
317
|
```console
|
|
252
318
|
$ bin/attach demo
|
|
253
319
|
Successfully uninstalled jekyll_all_collections-0.1.2
|
|
@@ -265,6 +331,7 @@ plugin_loggers:
|
|
|
265
331
|
|
|
266
332
|
|
|
267
333
|
## Additional Information
|
|
334
|
+
|
|
268
335
|
More information is available on Mike Slinn's website about
|
|
269
336
|
[Jekyll plugins](https://www.mslinn.com/blog/index.html#Jekyll).
|
|
270
337
|
|
|
@@ -277,12 +344,9 @@ You can also run `bin/console` for an interactive prompt that will allow you to
|
|
|
277
344
|
|
|
278
345
|
|
|
279
346
|
### Build and Install Locally
|
|
347
|
+
|
|
280
348
|
To build and install this gem onto your local machine, run:
|
|
281
|
-
```shell
|
|
282
|
-
$ rake install
|
|
283
|
-
```
|
|
284
349
|
|
|
285
|
-
The following also does the same thing:
|
|
286
350
|
```shell
|
|
287
351
|
$ bundle exec rake install
|
|
288
352
|
jekyll_all_collections 0.1.0 built to pkg/jekyll_all_collections-0.1.0.gem.
|
|
@@ -290,6 +354,7 @@ jekyll_all_collections (0.1.0) installed.
|
|
|
290
354
|
```
|
|
291
355
|
|
|
292
356
|
Examine the newly built gem:
|
|
357
|
+
|
|
293
358
|
```shell
|
|
294
359
|
$ gem info jekyll_all_collections
|
|
295
360
|
|
|
@@ -306,15 +371,19 @@ jekyll_all_collections (0.1.0)
|
|
|
306
371
|
|
|
307
372
|
|
|
308
373
|
### Build and Push to RubyGems
|
|
374
|
+
|
|
309
375
|
To release a new version,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
376
|
+
|
|
377
|
+
1. Update the version number in `version.rb`.
|
|
378
|
+
2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
|
|
379
|
+
3. Run the following:
|
|
380
|
+
|
|
381
|
+
```shell
|
|
382
|
+
$ bundle exec rake release
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
The above creates a git tag for the version, commits the created tag,
|
|
386
|
+
and pushes the new `.gem` file to [RubyGems.org](https://rubygems.org).
|
|
318
387
|
|
|
319
388
|
|
|
320
389
|
## Contributing
|
data/Rakefile
CHANGED
|
@@ -4,11 +4,11 @@ Gem::Specification.new do |spec|
|
|
|
4
4
|
github = 'https://github.com/mslinn/jekyll_all_collections'
|
|
5
5
|
|
|
6
6
|
spec.authors = ['Mike Slinn']
|
|
7
|
-
spec.bindir = '
|
|
7
|
+
spec.bindir = 'exe'
|
|
8
8
|
spec.description = <<~END_OF_DESC
|
|
9
9
|
Provides a collection of all collections in site.all_collections.
|
|
10
10
|
END_OF_DESC
|
|
11
|
-
spec.email = ['
|
|
11
|
+
spec.email = ['mslinn@mslinn.com']
|
|
12
12
|
spec.executables = []
|
|
13
13
|
|
|
14
14
|
# Specify which files should be added to the gem when it is released.
|
|
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.version = JekyllAllCollectionsVersion::VERSION
|
|
31
31
|
|
|
32
32
|
spec.add_dependency 'jekyll', '>= 3.5.0'
|
|
33
|
-
spec.add_dependency 'jekyll_draft', '
|
|
33
|
+
spec.add_dependency 'jekyll_draft', '>= 1.1.1'
|
|
34
34
|
spec.add_dependency 'jekyll_plugin_support', '>= 0.7.0'
|
|
35
35
|
end
|
|
@@ -12,7 +12,7 @@ module AllCollectionsHooks
|
|
|
12
12
|
# @logger.debug { "Jekyll::Hooks.register(:site, :after_init: #{defined}" }
|
|
13
13
|
# end
|
|
14
14
|
|
|
15
|
-
# Creates a `Array[
|
|
15
|
+
# Creates a `Array[APage]` property called site.all_collections if it does not already exist
|
|
16
16
|
# Each `APage` entry is one document or page.
|
|
17
17
|
Jekyll::Hooks.register(:site, :post_read, priority: :normal) do |site|
|
|
18
18
|
defined = AllCollectionsHooks.all_collections_defined?(site)
|
|
@@ -66,7 +66,7 @@ module AllCollectionsHooks
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
class APage
|
|
69
|
-
attr_reader :content, :data, :date, :description, :destination, :draft, :excerpt, :ext,
|
|
69
|
+
attr_reader :content, :data, :date, :description, :destination, :draft, :excerpt, :ext, :extname,
|
|
70
70
|
:label, :last_modified, :layout, :path, :relative_path, :tags, :title, :type, :url
|
|
71
71
|
|
|
72
72
|
# Verify each property exists before accessing it; this helps write tests
|
|
@@ -77,10 +77,15 @@ module AllCollectionsHooks
|
|
|
77
77
|
@content = obj.content if obj.respond_to? :content
|
|
78
78
|
@date = (@data['date'].to_date if @data&.key?('date')) || Date.today
|
|
79
79
|
@description = @data['description'] if @data.key? 'description'
|
|
80
|
-
|
|
80
|
+
|
|
81
|
+
# TODO: What _config.yml setting should be passed to destination()?
|
|
82
|
+
@destination = obj.destination('') if obj.respond_to? :destination
|
|
83
|
+
|
|
81
84
|
@draft = Jekyll::Draft.draft?(obj)
|
|
82
85
|
@excerpt = @data['excerpt'] if @data.key? 'excerpt'
|
|
83
|
-
@ext =
|
|
86
|
+
@ext = obj.extname
|
|
87
|
+
@ext ||= @data['ext'] if @data.key? 'ext'
|
|
88
|
+
@extname = @ext # For compatibility with previous versions of all_collections
|
|
84
89
|
@label = obj.collection.label if obj&.collection.respond_to? :label
|
|
85
90
|
@last_modified = @data['last_modified'] || @data['last_modified_at'] || @date
|
|
86
91
|
@last_modified_field = case @data
|
data/lib/all_collections_tag.rb
CHANGED
|
@@ -8,8 +8,7 @@ class NullBinding < BasicObject
|
|
|
8
8
|
def min_binding
|
|
9
9
|
::Kernel
|
|
10
10
|
.instance_method(:binding)
|
|
11
|
-
.
|
|
12
|
-
.call
|
|
11
|
+
.bind_call(self)
|
|
13
12
|
end
|
|
14
13
|
end
|
|
15
14
|
|
|
@@ -36,7 +35,7 @@ module AllCollectionsTag
|
|
|
36
35
|
end
|
|
37
36
|
@id = @helper.parameter_specified?('id') || SecureRandom.hex(10)
|
|
38
37
|
sort_by_param = @helper.parameter_specified? 'sort_by'
|
|
39
|
-
sort_by = (sort_by_param&.
|
|
38
|
+
sort_by = (sort_by_param&.delete(' ')&.split(',') if sort_by_param != false) || ['-date']
|
|
40
39
|
@heading = @helper.parameter_specified?('heading') || self.class.default_head(sort_by)
|
|
41
40
|
sort_lambda_string = self.class.create_lambda_string(sort_by)
|
|
42
41
|
@logger.debug do
|
|
@@ -98,7 +97,11 @@ module AllCollectionsTag
|
|
|
98
97
|
private
|
|
99
98
|
|
|
100
99
|
def last_modified_value(post)
|
|
101
|
-
@logger.debug
|
|
100
|
+
@logger.debug do
|
|
101
|
+
" post.last_modified='#{post.last_modified}'; " \
|
|
102
|
+
"post.last_modified_at='#{post.last_modified_at}'; " \
|
|
103
|
+
"@date_column='#{@date_column}'"
|
|
104
|
+
end
|
|
102
105
|
last_modified = if @date_column == 'last_modified' && post.respond_to?(:last_modified)
|
|
103
106
|
post.last_modified
|
|
104
107
|
elsif post.respond_to? :last_modified_at
|
data/spec/spec_helper.rb
CHANGED
|
@@ -6,9 +6,8 @@ require_relative '../lib/jekyll_all_collections'
|
|
|
6
6
|
Jekyll.logger.log_level = :info
|
|
7
7
|
|
|
8
8
|
RSpec.configure do |config|
|
|
9
|
-
config.filter_run :focus
|
|
10
9
|
# config.order = 'random'
|
|
11
|
-
config.
|
|
10
|
+
config.filter_run_when_matching focus: true
|
|
12
11
|
|
|
13
12
|
# See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
|
|
14
13
|
config.example_status_persistence_file_path = 'spec/status_persistence.txt'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
example_id | status | run_time |
|
|
2
|
+
----------------------------------------------------------------- | ------ | --------------- |
|
|
3
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:1] | passed | 0.00138 seconds |
|
|
4
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:2] | passed | 0.00185 seconds |
|
|
5
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:3] | passed | 0.0016 seconds |
|
|
6
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:4] | passed | 0.00169 seconds |
|
|
7
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:5] | passed | 0.0012 seconds |
|
|
8
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:6] | passed | 0.00154 seconds |
|
|
9
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:7] | passed | 0.00122 seconds |
|
|
10
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:8] | passed | 0.0015 seconds |
|
|
11
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:9] | passed | 0.00141 seconds |
|
|
12
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:10] | passed | 0.00118 seconds |
|
|
13
|
+
./spec/date_sort_spec.rb[1:1] | passed | 0.00007 seconds |
|
|
14
|
+
./spec/date_sort_spec.rb[1:2] | passed | 0.00005 seconds |
|
|
15
|
+
./spec/date_sort_spec.rb[1:3] | passed | 0.00005 seconds |
|
|
16
|
+
./spec/date_sort_spec.rb[1:4] | passed | 0.00005 seconds |
|
|
17
|
+
./spec/date_sort_spec.rb[1:5] | passed | 0.00011 seconds |
|
|
18
|
+
./spec/date_sort_spec.rb[1:6] | passed | 0.00004 seconds |
|
|
19
|
+
./spec/date_sort_spec.rb[1:7] | passed | 0.00006 seconds |
|
|
20
|
+
./spec/date_sort_spec.rb[1:8] | passed | 0.00004 seconds |
|
|
21
|
+
./spec/date_sort_spec.rb[1:9] | passed | 0.00004 seconds |
|
|
22
|
+
./spec/date_sort_spec.rb[1:10] | passed | 0.00005 seconds |
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll_all_collections
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Slinn
|
|
8
8
|
autorequire:
|
|
9
|
-
bindir:
|
|
9
|
+
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-03-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|
|
@@ -28,14 +28,14 @@ dependencies:
|
|
|
28
28
|
name: jekyll_draft
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: 1.1.1
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - "
|
|
38
|
+
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: 1.1.1
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
@@ -56,7 +56,7 @@ description: 'Provides a collection of all collections in site.all_collections.
|
|
|
56
56
|
|
|
57
57
|
'
|
|
58
58
|
email:
|
|
59
|
-
-
|
|
59
|
+
- mslinn@mslinn.com
|
|
60
60
|
executables: []
|
|
61
61
|
extensions: []
|
|
62
62
|
extra_rdoc_files: []
|
|
@@ -71,9 +71,10 @@ files:
|
|
|
71
71
|
- lib/all_collections_tag.rb
|
|
72
72
|
- lib/jekyll_all_collections.rb
|
|
73
73
|
- lib/jekyll_all_collections/version.rb
|
|
74
|
-
- spec/all_collections_tag_sort_spec.rb
|
|
74
|
+
- spec/all_collections_tag/all_collections_tag_sort_spec.rb
|
|
75
75
|
- spec/date_sort_spec.rb
|
|
76
76
|
- spec/spec_helper.rb
|
|
77
|
+
- spec/status_persistence.txt
|
|
77
78
|
homepage: https://www.mslinn.com/jekyll_plugins/jekyll_all_collections.html
|
|
78
79
|
licenses:
|
|
79
80
|
- MIT
|
|
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
98
99
|
- !ruby/object:Gem::Version
|
|
99
100
|
version: '0'
|
|
100
101
|
requirements: []
|
|
101
|
-
rubygems_version: 3.
|
|
102
|
+
rubygems_version: 3.5.6
|
|
102
103
|
signing_key:
|
|
103
104
|
specification_version: 4
|
|
104
105
|
summary: Provides a collection of all collections in site.all_collections.
|
/data/spec/{all_collections_tag_sort_spec.rb → all_collections_tag/all_collections_tag_sort_spec.rb}
RENAMED
|
File without changes
|