jekyll_all_collections 0.3.7 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +19 -1
- data/CHANGELOG.md +30 -9
- data/README.md +208 -105
- data/jekyll_all_collections.gemspec +5 -9
- data/lib/hooks/a_page.rb +69 -0
- data/lib/hooks/all_collections_hooks.rb +59 -0
- data/lib/hooks/all_files.rb +46 -0
- data/lib/hooks/class_methods.rb +50 -0
- data/lib/jekyll_all_collections/version.rb +1 -1
- data/lib/jekyll_all_collections.rb +14 -2
- data/lib/tag/all_collections_tag.rb +158 -0
- data/lib/util/mslinn_binary_search.rb +152 -0
- data/lib/util/send_chain.rb +58 -0
- data/spec/all_collections_tag/all_collections_tag_sort_spec.rb +1 -0
- data/spec/bsearch_spec.rb +50 -0
- data/spec/date_sort_spec.rb +8 -6
- data/spec/mslinn_binary_search_spec.rb +47 -0
- data/spec/send_chain_spec.rb +72 -0
- data/spec/send_spec.rb +28 -0
- data/spec/sorted_lru_files_spec.rb +82 -0
- data/spec/spec_helper.rb +1 -3
- data/spec/status_persistence.txt +32 -22
- data/spec/testable_spec.rb +38 -0
- metadata +33 -8
- data/lib/all_collections_hooks.rb +0 -118
- data/lib/all_collections_tag.rb +0 -141
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e43e220bfaba4972fb8a1bb90a54818dbc14a30e9433937a2ef97aa33f5ef049
|
4
|
+
data.tar.gz: 150e4651e714ca0e3d70bdb088032c7e27e1f3d31c7c5610312cd9f118574907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7553236876b6a247d8550bcd7772416956aee5b6b0a87a4042e8083395f177e4c3a8ee0cb93a0e927a1b17be487baac0ffdfeb7c94c0ea2a85f9a8a5825b99ea
|
7
|
+
data.tar.gz: 72f1fb5193dd8251f06b5393440d1bf68d8f185a55f310af52e426c00ac82890a4023115b8c92d8a5391c686729b5532b1e7d8d728536aa1991d9c153eabe8c8
|
data/.rubocop.yml
CHANGED
@@ -9,6 +9,7 @@ AllCops:
|
|
9
9
|
Exclude:
|
10
10
|
- binstub/**/*
|
11
11
|
- demo/_site/*
|
12
|
+
- demo/binstub/*
|
12
13
|
- vendor/**/*
|
13
14
|
- Gemfile*
|
14
15
|
NewCops: enable
|
@@ -29,6 +30,9 @@ Layout/HashAlignment:
|
|
29
30
|
Layout/LineLength:
|
30
31
|
Max: 150
|
31
32
|
|
33
|
+
Lint/MissingCopEnableDirective:
|
34
|
+
Enabled: false
|
35
|
+
|
32
36
|
Metrics/AbcSize:
|
33
37
|
Max: 55
|
34
38
|
|
@@ -37,6 +41,9 @@ Metrics/BlockLength:
|
|
37
41
|
- jekyll_plugin_support.gemspec
|
38
42
|
Max: 30
|
39
43
|
|
44
|
+
Metrics/ClassLength:
|
45
|
+
Enabled: false
|
46
|
+
|
40
47
|
Metrics/CyclomaticComplexity:
|
41
48
|
Max: 25
|
42
49
|
|
@@ -54,6 +61,9 @@ Naming/FileName:
|
|
54
61
|
RSpec/ExampleLength:
|
55
62
|
Max: 30
|
56
63
|
|
64
|
+
RSpec/IndexedLet:
|
65
|
+
Enabled: false
|
66
|
+
|
57
67
|
RSpec/SpecFilePathFormat:
|
58
68
|
Enabled: false
|
59
69
|
IgnoreMethods: true
|
@@ -61,7 +71,7 @@ RSpec/SpecFilePathFormat:
|
|
61
71
|
RSpec/SpecFilePathSuffix:
|
62
72
|
Enabled: false
|
63
73
|
|
64
|
-
RSpec/
|
74
|
+
RSpec/MultipleDescribes:
|
65
75
|
Enabled: false
|
66
76
|
|
67
77
|
RSpec/MultipleExpectations:
|
@@ -70,12 +80,20 @@ RSpec/MultipleExpectations:
|
|
70
80
|
Style/ClassVars:
|
71
81
|
Enabled: false
|
72
82
|
|
83
|
+
Style/CommentedKeyword:
|
84
|
+
Enabled: false
|
85
|
+
|
73
86
|
Style/Documentation:
|
74
87
|
Enabled: false
|
75
88
|
|
76
89
|
Style/FrozenStringLiteralComment:
|
77
90
|
Enabled: false
|
78
91
|
|
92
|
+
Style/GlobalVars:
|
93
|
+
Exclude:
|
94
|
+
- "**/*_spec.rb"
|
95
|
+
- "*_spec.rb"
|
96
|
+
|
79
97
|
Style/StringConcatenation:
|
80
98
|
Enabled: false
|
81
99
|
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,34 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.4.0 / 2025-02-07
|
4
|
+
|
5
|
+
* **This plugin is deprecated.**
|
6
|
+
The functionality will be folded into <code>jekyll_plugin_support</code>.
|
7
|
+
The last release of this plugin will halt Jekyll and tell you to remove it from the Jekyll website <code>Gemfile</code>
|
8
|
+
and to use <code>jekyll_plugin_support</code> instead.
|
9
|
+
* Added `AllCollectionsHooks.all_documents`, `AllCollectionsHooks.everything`,
|
10
|
+
`AllCollectionsHooks.site`, and `AllCollectionsHooks.sorted_lru_files` properties,
|
11
|
+
accessible from every other module.
|
12
|
+
* Added `site.all_documents`, `site.everything`, and `sorted_lru_files` properties.
|
13
|
+
|
14
|
+
* `all_collections` includes all documents in all collections.
|
15
|
+
|
16
|
+
* `all_documents` includes `all_collections` plus all standalone pages.
|
17
|
+
|
18
|
+
* `everything` includes `all_documents` plus all static files.
|
19
|
+
|
20
|
+
* `sorted_lru_files` is used by a new binary search lookup for matching page suffixes.
|
21
|
+
Currently only `jekyll_href` and `jekyll_draft` use this feature.
|
22
|
+
|
23
|
+
|
3
24
|
## 0.3.7 / 2024-12-21
|
4
25
|
|
5
|
-
* `AllCollectionsTag.class.evaluate` made compatible with Ruby 3.2.2
|
26
|
+
* `AllCollectionsTag.class.evaluate` made compatible with Ruby 3.2.2.
|
6
27
|
|
7
28
|
|
8
29
|
## 0.3.6 / 2024-07-23
|
9
30
|
|
10
|
-
* Made compatible with module renaming in JekyllPluginSupport v1.0.0
|
31
|
+
* Made compatible with module renaming in JekyllPluginSupport v1.0.0.
|
11
32
|
|
12
33
|
|
13
34
|
## 0.3.5 / 2024-03-26
|
@@ -19,7 +40,7 @@
|
|
19
40
|
|
20
41
|
## 0.3.4 / 2023-12-24
|
21
42
|
|
22
|
-
* Changed dependency to Jekyll >= 4.3.2
|
43
|
+
* Changed dependency to Jekyll >= 4.3.2.
|
23
44
|
|
24
45
|
|
25
46
|
## 0.3.3 / 2023-05-22
|
@@ -30,25 +51,25 @@
|
|
30
51
|
|
31
52
|
## 0.3.2 / 2023-04-05
|
32
53
|
|
33
|
-
* Modified dependency `'jekyll_plugin_support', '>= 0.5.0'
|
54
|
+
* Modified dependency `'jekyll_plugin_support', '>= 0.5.0'`.
|
34
55
|
|
35
56
|
|
36
57
|
## 0.3.1 / 2023-03-16
|
37
58
|
|
38
|
-
* Reduced the verbosity of the `@logger` message
|
59
|
+
* Reduced the verbosity of the `@logger` message.
|
39
60
|
|
40
61
|
## 0.3.0 / 2023-02-16
|
41
62
|
|
42
|
-
* Updated dependency `'jekyll_plugin_support', '~> 0.5.0'
|
63
|
+
* Updated dependency `'jekyll_plugin_support', '~> 0.5.0'`.
|
43
64
|
|
44
65
|
## 0.2.2 / 2023-02-12
|
45
66
|
|
46
|
-
* Updated dependency `'jekyll_plugin_support', '~> 0.4.0'
|
67
|
+
* Updated dependency `'jekyll_plugin_support', '~> 0.4.0'`.
|
47
68
|
|
48
69
|
|
49
70
|
## 0.2.1 / 2023-02-12
|
50
71
|
|
51
|
-
* Reduced the verbosity of log output from `info` to `debug
|
72
|
+
* Reduced the verbosity of log output from `info` to `debug`.
|
52
73
|
|
53
74
|
|
54
75
|
## 0.2.0 / 2023-02-04
|
@@ -65,4 +86,4 @@
|
|
65
86
|
|
66
87
|
## 0.1.0 / 2022-04-26
|
67
88
|
|
68
|
-
* Initial version published
|
89
|
+
* Initial version published.
|
data/README.md
CHANGED
@@ -1,35 +1,156 @@
|
|
1
1
|
# `jekyll_all_collections` [](https://badge.fury.io/rb/jekyll_all_collections)
|
2
2
|
|
3
3
|
|
4
|
-
`Jekyll_all_collections` is a Jekyll plugin that
|
5
|
-
|
6
|
-
which creates a formatted listing of all posts and documents from all collections,
|
7
|
-
sorted by age, newest to oldest.
|
4
|
+
`Jekyll_all_collections` is a Jekyll plugin that includes a generator,
|
5
|
+
triggered by a high-priority hook, and a block tag called `all_collections`.
|
8
6
|
|
9
|
-
The collection consists of an array of objects with the following properties:
|
10
|
-
`content` (HTML or Markdown), `data` (array), `date` (Ruby Date), `description`, `destination`,
|
11
|
-
`draft` (Boolean), `excerpt` (HTML or Markdown), `ext`, `label`, `last_modified` or `last_modified_at` (Ruby Date),
|
12
|
-
`layout`, `path`, `relative_path`, `tags`, `title`, `type`, and `url`.
|
13
7
|
|
14
|
-
|
8
|
+
## Generator
|
15
9
|
|
10
|
+
The generator adds four new attributes to
|
11
|
+
[`site`](https://jekyllrb.com/docs/variables/#site-variables):
|
12
|
+
`all_collections`, `all_documents`, `everything`, and `sorted_lru_files`.
|
16
13
|
|
17
|
-
|
14
|
+
These three attributes can be referenced as `site.everything`, `site.all_collections`
|
15
|
+
and `site.all_documents`.
|
16
|
+
|
17
|
+
* `all_collections` includes all documents in all collections.
|
18
|
+
|
19
|
+
* `all_documents` includes `all_collections` plus all standalone pages.
|
20
|
+
|
21
|
+
* `everything` includes `all_documents` plus all static files.
|
22
|
+
|
23
|
+
* `sorted_lru_files` is used by a new binary search lookup for matching page suffixes.
|
24
|
+
Currently only `jekyll_href` and `jekyll_draft` use this feature.
|
25
|
+
|
26
|
+
|
27
|
+
### Collection Management
|
28
|
+
|
29
|
+
Jekyll provides inconsistent attributes for
|
30
|
+
[`site.pages`](https://jekyllrb.com/docs/pages/),
|
31
|
+
[`site.posts`](https://jekyllrb.com/docs/posts/) and
|
32
|
+
[`site.static_files`](https://jekyllrb.com/docs/static-files/).
|
33
|
+
|
34
|
+
|
35
|
+
* While the `url` attributes of items in `site.posts` and `site.pages` start with a slash (/),
|
36
|
+
`site.static_files` items do not have a `url` attribute.
|
37
|
+
* Static files have a `relative_path` attribute, which starts with a slash (/),
|
38
|
+
but although that attribute is also provided in `site.posts` and `site.pages`,
|
39
|
+
those values do not start with a slash.
|
40
|
+
* Paths ending with a slash (`/`) imply that a file called `index.html` should be fetched.
|
41
|
+
* HTML redirect files created by the
|
42
|
+
[`jekyll-redirect-from`](https://github.com/jekyll/jekyll-redirect-from) Jekyll plugin,
|
43
|
+
which are included in `site.static_files`, should be ignored.
|
18
44
|
|
19
|
-
|
45
|
+
These inconsistencies mean that combining the standard three collections of files
|
46
|
+
provided as `site` attributes will create a new collection that is difficult
|
47
|
+
to process consistently:
|
20
48
|
|
21
49
|
```ruby
|
22
|
-
|
23
|
-
|
24
|
-
end
|
50
|
+
# This pseudocode creates `oops`, which is problematic to process consistently
|
51
|
+
oops = site.all_collections + site.pages + site.static_files
|
25
52
|
```
|
26
53
|
|
27
|
-
|
54
|
+
`oops`, above, is difficult to process because of inconsistencies in the provided attributes
|
55
|
+
and how the attributes are constructed.
|
28
56
|
|
29
|
-
|
30
|
-
|
57
|
+
|
58
|
+
### Solving The Problem
|
59
|
+
|
60
|
+
The generator normalizes these inconsistencies by utilizing the `APage` class
|
61
|
+
and filtering out HTML redirect files.
|
62
|
+
|
63
|
+
The `all_collections` collection contains `APage` representations of `site.collections`.
|
64
|
+
|
65
|
+
The `all_documents` collection contains `APage` representations of `site.pages`.
|
66
|
+
|
67
|
+
The `everything` collection contains `APage` representations of:
|
68
|
+
|
69
|
+
```text
|
70
|
+
# Pseudocode
|
71
|
+
site.collections + site.pages + site.static_files - HTML_redirect_files
|
72
|
+
```
|
73
|
+
|
74
|
+
|
75
|
+
## The APage Class
|
76
|
+
|
77
|
+
The `site.all_collections`, `site.all_documents` and `site.everything` attributes
|
78
|
+
consist of arrays of [`APage`](lib/hooks/a_page.rb) instances.
|
79
|
+
|
80
|
+
The `APage` class has the following attributes:
|
81
|
+
`content` (HTML or Markdown), `data` (array), `date` (Ruby Date), `description`, `destination`,
|
82
|
+
`draft` (Boolean), `ext`, `href`, `label`, `last_modified` or `last_modified_at` (Ruby Date),
|
83
|
+
`layout`, `origin`, `path`, `relative_path`, `tags`, `title`, `type`, and `url`.
|
84
|
+
|
85
|
+
* `href` always starts with a slash.
|
86
|
+
This value is consistent with `a href` values in website HTML.
|
87
|
+
Paths ending with a slash (`/`) have `index.html` appended so the path specifies an actual file.
|
88
|
+
|
89
|
+
* `origin` indicates the original source of the item.
|
90
|
+
Possible values are `collection`, `individual_page` and `static_file`.
|
91
|
+
Knowing the origin of each item allows code to process each type of item appropriately.
|
92
|
+
|
93
|
+
|
94
|
+
## Block Tag
|
95
|
+
|
96
|
+
The `all_collections` block tag creates a formatted listing of Jekyll files.
|
97
|
+
The ordering is configurable; by default, the listing is sorted by `date`, newest to oldest.
|
98
|
+
The `all_collections` tag has a `data_source` parameter that specifies which new property to report on
|
99
|
+
(`all_collections`, `all_documents`, or `everything`).
|
100
|
+
|
101
|
+
|
102
|
+
## Installation
|
103
|
+
|
104
|
+
### Installing In A Jekyll Website
|
105
|
+
|
106
|
+
1. Add the CSS found in
|
107
|
+
[`demo/assets/css/jekyll_all_collections.css`](demo/assets/css/jekyll_all_collections.css)
|
108
|
+
to your Jekyll layout(s).
|
109
|
+
|
110
|
+
2. Add the following to your Jekyll website's `Gemfile`, within the `jekyll_plugins` group:
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
group :jekyll_plugins do
|
114
|
+
gem 'jekyll_all_collections', '>= 0.3.8'
|
115
|
+
gem 'jekyll_draft', '>=2.1.0'
|
116
|
+
end
|
117
|
+
```
|
118
|
+
|
119
|
+
3. Type:
|
120
|
+
|
121
|
+
```shell
|
122
|
+
$ bundle
|
123
|
+
```
|
124
|
+
|
125
|
+
|
126
|
+
### Installing As a Gem Dependency
|
127
|
+
|
128
|
+
1. Add the following to your gem’s `.gemspec`:
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
spec.add_dependency 'jekyll_all_collections', '>= 0.3.8'
|
132
|
+
spec.add_dependency 'jekyll_draft', '>=2.1.0'
|
133
|
+
```
|
134
|
+
|
135
|
+
2. Type:
|
136
|
+
|
137
|
+
```shell
|
138
|
+
$ bundle
|
139
|
+
```
|
140
|
+
|
141
|
+
|
142
|
+
## Demo
|
143
|
+
|
144
|
+
The [`demo`](./demo) directory contains a demonstration website, which uses the plugin.
|
145
|
+
To run, type:
|
146
|
+
|
147
|
+
```console
|
148
|
+
$ bin/setup
|
149
|
+
$ demo/_bin/debug -r
|
31
150
|
```
|
32
151
|
|
152
|
+
Now point your web browser to http://localhost:4444
|
153
|
+
|
33
154
|
|
34
155
|
## Requirements
|
35
156
|
|
@@ -66,69 +187,51 @@ the `date` value will be used last modified date value.
|
|
66
187
|
|
67
188
|
## Usage
|
68
189
|
|
69
|
-
### `Site
|
190
|
+
### New `Site` Attributes
|
70
191
|
|
71
192
|
No explicit initialization or setup is required.
|
72
|
-
Jekyll plugins can access the value of
|
193
|
+
Jekyll plugins can access the value of
|
194
|
+
`site.all_collections`, `site.all_documents` and `site.everything`;
|
195
|
+
however, Liquid code in Jekyll pages and documents cannot.
|
73
196
|
|
74
197
|
|
75
|
-
###
|
198
|
+
### Excluding Files
|
76
199
|
|
77
|
-
|
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.
|
200
|
+
There are two ways to exclude files from the new `site` attributes.
|
82
201
|
|
83
|
-
|
202
|
+
1) The [`exclude` entry in `_config.yml`](https://jekyllrb.com/docs/configuration/options#global-configuration)
|
203
|
+
can be used as it normally would.
|
84
204
|
|
85
|
-
|
86
|
-
|
87
|
-
do_something_with page_or_apage
|
88
|
-
end
|
89
|
-
```
|
90
|
-
|
91
|
-
|
92
|
-
### `All_collections` Tag
|
205
|
+
2) Adding the following entry to a page’s front matter causes that page to be excluded
|
206
|
+
from the collection created by this plugin:
|
93
207
|
|
94
|
-
|
208
|
+
```html
|
209
|
+
---
|
210
|
+
exclude_from_all: true
|
211
|
+
---
|
212
|
+
```
|
95
213
|
|
96
|
-
```css
|
97
|
-
.posts {
|
98
|
-
display: flex;
|
99
|
-
flex-wrap: wrap;
|
100
|
-
justify-content: space-between;
|
101
|
-
line-height: 170%;
|
102
|
-
}
|
103
214
|
|
104
|
-
|
105
|
-
width: 120px;
|
106
|
-
font-family: Monaco,"Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
|
107
|
-
font-stretch: semi-condensed;
|
108
|
-
font-size: 10pt;
|
109
|
-
}
|
215
|
+
### Plugin Usage
|
110
216
|
|
111
|
-
|
112
|
-
width: calc(100% - 120px);
|
113
|
-
}
|
114
|
-
```
|
217
|
+
Jekyll generators and tags receive an enhanced version of the `site` Jekyll variable.
|
115
218
|
|
116
219
|
|
117
|
-
####
|
220
|
+
#### From a Custom Plugin
|
118
221
|
|
119
|
-
|
120
|
-
|
222
|
+
In the following example of how to use the `all_collections` plugin in a custom plugin,
|
223
|
+
the `do_something_with` function processes all `Jekyll::Page`s, `Jekyll:Document`s, and static files.
|
121
224
|
|
122
|
-
```
|
123
|
-
|
124
|
-
|
125
|
-
|
225
|
+
```ruby
|
226
|
+
@site.everything.each do |apage|
|
227
|
+
do_something_with apage
|
228
|
+
end
|
126
229
|
```
|
127
230
|
|
128
231
|
|
129
|
-
####
|
232
|
+
#### Using the Block Tag
|
130
233
|
|
131
|
-
The general form of the Jekyll tag is:
|
234
|
+
The general form of the Jekyll tag, including all options, is:
|
132
235
|
|
133
236
|
```html
|
134
237
|
{% all_collections
|
@@ -140,7 +243,7 @@ The general form of the Jekyll tag is:
|
|
140
243
|
```
|
141
244
|
|
142
245
|
|
143
|
-
|
246
|
+
##### `date_column` Attribute
|
144
247
|
|
145
248
|
One of two date columns can be displayed in the generated HTML:
|
146
249
|
either `date` (when the article was originally written),
|
@@ -148,7 +251,7 @@ or `last_modified`.
|
|
148
251
|
The default value for the `date_column` attribute is `date`.
|
149
252
|
|
150
253
|
|
151
|
-
|
254
|
+
##### `heading` Attribute
|
152
255
|
|
153
256
|
If no `heading` attribute is specified, a heading will automatically be generated, which contains the `sort_by` values,
|
154
257
|
for example:
|
@@ -157,7 +260,7 @@ for example:
|
|
157
260
|
{% all_collections id='abcdef' sort_by="last_modified" %}
|
158
261
|
```
|
159
262
|
|
160
|
-
|
263
|
+
The above generates a heading like:
|
161
264
|
|
162
265
|
```html
|
163
266
|
<h2 id="abcdef">All Posts Sorted By last_modified</h2>
|
@@ -171,11 +274,12 @@ specify an empty string for the value of `heading`:
|
|
171
274
|
```
|
172
275
|
|
173
276
|
|
174
|
-
|
277
|
+
##### `id` Attribute
|
175
278
|
|
176
279
|
If your Jekyll layout employs [`jekyll-toc`](https://github.com/allejo/jekyll-toc), then `id` attributes are important.
|
177
280
|
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
|
281
|
+
and if the attribute value is enclosed in double quotes
|
282
|
+
(`id="my_id"`, not single quotes like `id='my_id'`),
|
179
283
|
then the heading is included in the table of contents.
|
180
284
|
|
181
285
|
To suppress an `id` from being generated,
|
@@ -187,13 +291,13 @@ specify an empty string for the value of `id`, like this:
|
|
187
291
|
```
|
188
292
|
|
189
293
|
|
190
|
-
|
294
|
+
##### `SORT_KEYS` Values
|
191
295
|
|
192
296
|
`SORT_KEYS` specifies how to sort the collection.
|
193
297
|
Values can include one or more of the following attributes:
|
194
298
|
`date`, `destination`, `draft`, `label`, `last_modified`, `last_modified_at`, `path`, `relative_path`,
|
195
299
|
`title`, `type`, and `url`.
|
196
|
-
Ascending sorts are the default
|
300
|
+
Ascending sorts are the default; however, a descending sort can be achieved by prepending `-` before an attribute.
|
197
301
|
|
198
302
|
To specify more than one sort key, provide a comma-delimited string of values.
|
199
303
|
Included spaces are ignored.
|
@@ -228,7 +332,9 @@ title: Testing, 1, 2, 3
|
|
228
332
|
{% all_collections %}
|
229
333
|
```
|
230
334
|
|
231
|
-
|
335
|
+
Following are examples of how to specify the sort parameters.
|
336
|
+
|
337
|
+
**Explicitly express the default sort**<br>
|
232
338
|
(sort by the date originally written, newest to oldest):
|
233
339
|
|
234
340
|
```html
|
@@ -241,19 +347,20 @@ Sort by date, from oldest to newest:
|
|
241
347
|
{% all_collections sort_by="date" %}
|
242
348
|
```
|
243
349
|
|
244
|
-
Sort by the date last modified, oldest to newest
|
350
|
+
**Sort by the date last modified, oldest to newest:**
|
245
351
|
|
246
352
|
```html
|
247
353
|
{% all_collections sort_by="last_modified" %}
|
248
354
|
```
|
249
355
|
|
250
|
-
Sort by the date last modified, newest to oldest
|
356
|
+
**Sort by the date last modified, newest to oldest:**
|
251
357
|
|
252
358
|
```html
|
253
359
|
{% all_collections sort_by="-last_modified" %}
|
254
360
|
```
|
255
361
|
|
256
|
-
Several attributes can be specified as sort criteria
|
362
|
+
**Several attributes can be specified as sort criteria**<br>
|
363
|
+
by passing them as a comma-delimited string.
|
257
364
|
Included spaces are ignored:
|
258
365
|
|
259
366
|
```html
|
@@ -262,7 +369,7 @@ Included spaces are ignored:
|
|
262
369
|
{% all_collections sort_by="-last_modified, -date, title" %}
|
263
370
|
```
|
264
371
|
|
265
|
-
The following two examples produce the same output
|
372
|
+
**The following two examples produce the same output:**
|
266
373
|
|
267
374
|
```html
|
268
375
|
{% all_collections sort_by="-last_modified,-date" %}
|
@@ -270,18 +377,6 @@ The following two examples produce the same output:
|
|
270
377
|
```
|
271
378
|
|
272
379
|
|
273
|
-
## Demo
|
274
|
-
|
275
|
-
The [`demo`](./demo) directory contains a demonstration website, which uses the plugin.
|
276
|
-
To run, type:
|
277
|
-
|
278
|
-
```console
|
279
|
-
$ demo/_bin/debug -r
|
280
|
-
```
|
281
|
-
|
282
|
-
Now point your web browser to http://localhost:4444
|
283
|
-
|
284
|
-
|
285
380
|
## Debugging
|
286
381
|
|
287
382
|
You can control the verbosity of log output by adding the following to `_config.yml` in your Jekyll project:
|
@@ -291,10 +386,13 @@ plugin_loggers:
|
|
291
386
|
AllCollectionsTag::AllCollectionsTag: warn
|
292
387
|
```
|
293
388
|
|
389
|
+
1. First set breakpoints in the Ruby code that interests you.
|
294
390
|
|
295
|
-
|
391
|
+
2. You have several options for initiating a debug session:
|
296
392
|
|
297
|
-
1.
|
393
|
+
1. Use the **Debug Demo** Visual Studio Code launch configuration.
|
394
|
+
|
395
|
+
2. Type the `demo/_bin/debug` command, without the `-r` options shown above.
|
298
396
|
|
299
397
|
```console
|
300
398
|
... lots of output as bundle update runs...
|
@@ -311,7 +409,7 @@ plugin_loggers:
|
|
311
409
|
Fast Debugger (ruby-debug-ide 0.7.3, debase 0.2.5.beta2, file filtering is supported) listens on 0.0.0.0:1234
|
312
410
|
```
|
313
411
|
|
314
|
-
|
412
|
+
3. Run `bin/attach` and pass the directory name of a Jekyll website that has a suitable script called `_bin/debug`.
|
315
413
|
The `demo` subdirectory fits this description.
|
316
414
|
|
317
415
|
```console
|
@@ -322,18 +420,21 @@ plugin_loggers:
|
|
322
420
|
Fast Debugger (ruby-debug-ide 0.7.3, debase 0.2.4.1, file filtering is supported) listens on 0.0.0.0:1234
|
323
421
|
```
|
324
422
|
|
325
|
-
2. Set breakpoints in Ruby code.
|
326
423
|
|
327
|
-
3. Attach to the debugger process.
|
328
|
-
This git repo includes
|
424
|
+
3. Attach to the debugger process if required.
|
425
|
+
This git repo includes two [Visual Studio Code launch configurations](./.vscode/launch.json) for this purpose labeled
|
426
|
+
**Attach rdbg** and **Attach with ruby_lsp**.
|
329
427
|
|
330
428
|
4. Point your web browser to http://localhost:4444
|
331
429
|
|
430
|
+
If a debugging session terminates abruptly and leaves ports tied up,
|
431
|
+
run the `demo/_bin/release_port` script.
|
432
|
+
|
332
433
|
|
333
434
|
## Additional Information
|
334
435
|
|
335
436
|
More information is available on Mike Slinn's website about
|
336
|
-
[Jekyll plugins](https://
|
437
|
+
[Jekyll plugins](https://mslinn.com/jekyll_plugins/jekyll_all_collections.html).
|
337
438
|
|
338
439
|
|
339
440
|
## Development
|
@@ -349,8 +450,8 @@ To build and install this gem onto your local machine, run:
|
|
349
450
|
|
350
451
|
```shell
|
351
452
|
$ bundle exec rake install
|
352
|
-
jekyll_all_collections 0.
|
353
|
-
jekyll_all_collections (0.
|
453
|
+
jekyll_all_collections 0.3.8 built to pkg/jekyll_all_collections-0.3.8.gem.
|
454
|
+
jekyll_all_collections (0.3.8) installed.
|
354
455
|
```
|
355
456
|
|
356
457
|
Examine the newly built gem:
|
@@ -360,23 +461,25 @@ $ gem info jekyll_all_collections
|
|
360
461
|
|
361
462
|
*** LOCAL GEMS ***
|
362
463
|
|
363
|
-
jekyll_all_collections (0.
|
464
|
+
jekyll_all_collections (0.3.8)
|
364
465
|
Author: Mike Slinn
|
365
|
-
Homepage:
|
466
|
+
Homepage:
|
467
|
+
https://www.mslinn.com/jekyll_plugins/jekyll_all_collections.html
|
366
468
|
License: MIT
|
367
|
-
Installed at: /home/mslinn/.rbenv/versions/3.
|
469
|
+
Installed at (0.3.8): /home/mslinn/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0
|
368
470
|
|
369
|
-
Provides
|
471
|
+
Provides normalized collections and extra functionality for Jekyll websites.
|
370
472
|
```
|
371
473
|
|
372
474
|
|
373
475
|
### Build and Push to RubyGems
|
374
476
|
|
375
|
-
To release a new version
|
477
|
+
To release a new version:
|
376
478
|
|
377
479
|
1. Update the version number in `version.rb`.
|
378
|
-
2.
|
379
|
-
3.
|
480
|
+
2. Add an entry in `CHANGELOG.md` describing the changes since the last release.
|
481
|
+
3. Commit all changes to git; if you don't the next step might fail with a confusing error message.
|
482
|
+
4. Run the following:
|
380
483
|
|
381
484
|
```shell
|
382
485
|
$ bundle exec rake release
|
@@ -388,10 +491,10 @@ To release a new version,
|
|
388
491
|
|
389
492
|
## Contributing
|
390
493
|
|
391
|
-
1. Fork the project
|
392
|
-
2. Create a descriptively named feature branch
|
393
|
-
3. Add your feature
|
394
|
-
4. Submit a pull request
|
494
|
+
1. Fork the project.
|
495
|
+
2. Create a descriptively named feature branch.
|
496
|
+
3. Add your feature.
|
497
|
+
4. Submit a pull request.
|
395
498
|
|
396
499
|
|
397
500
|
## License
|
@@ -4,16 +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 = 'exe'
|
8
7
|
spec.description = <<~END_OF_DESC
|
9
|
-
Provides
|
8
|
+
Provides normalized collections and extra functionality for Jekyll websites.
|
10
9
|
END_OF_DESC
|
11
|
-
spec.email
|
12
|
-
spec.
|
13
|
-
|
14
|
-
# Specify which files should be added to the gem when it is released.
|
15
|
-
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
16
|
-
|
10
|
+
spec.email = ['mslinn@mslinn.com']
|
11
|
+
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
17
12
|
spec.homepage = 'https://www.mslinn.com/jekyll_plugins/jekyll_all_collections.html'
|
18
13
|
spec.license = 'MIT'
|
19
14
|
spec.metadata = {
|
@@ -27,10 +22,11 @@ Gem::Specification.new do |spec|
|
|
27
22
|
spec.platform = Gem::Platform::RUBY
|
28
23
|
spec.require_paths = ['lib']
|
29
24
|
spec.required_ruby_version = '>= 2.6.0'
|
30
|
-
spec.summary = 'Provides
|
25
|
+
spec.summary = 'Provides normalized collections and extra functionality for Jekyll websites.'
|
31
26
|
spec.version = JekyllAllCollectionsVersion::VERSION
|
32
27
|
|
33
28
|
spec.add_dependency 'jekyll', '>= 3.5.0'
|
34
29
|
spec.add_dependency 'jekyll_draft'
|
35
30
|
spec.add_dependency 'jekyll_plugin_support'
|
31
|
+
spec.add_dependency 'sorted_set'
|
36
32
|
end
|