jekyll_all_collections 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +18 -1
- data/lib/all_collections_hooks.rb +5 -3
- data/lib/jekyll_all_collections/version.rb +1 -1
- data/spec/status_persistence.txt +22 -23
- metadata +3 -3
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/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
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
|
+
|
3
11
|
## 0.3.4 / 2023-12-24
|
4
12
|
|
5
13
|
* Changed dependency to Jekyll >= 4.3.2
|
data/README.md
CHANGED
@@ -72,6 +72,23 @@ No explicit initialization or setup is required.
|
|
72
72
|
Jekyll plugins can access the value of `site.all_collections`, however Liquid code in Jekyll pages and documents cannot.
|
73
73
|
|
74
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
|
+
|
75
92
|
### `All_collections` Tag
|
76
93
|
|
77
94
|
Add the following CSS to your stylesheet:
|
@@ -194,7 +211,7 @@ and the tertiary key as `label`:
|
|
194
211
|
```
|
195
212
|
|
196
213
|
|
197
|
-
#### Usage Examples
|
214
|
+
#### Liquid Usage Examples
|
198
215
|
|
199
216
|
Here is a short Jekyll page, including front matter,
|
200
217
|
demonstrating this plugin being invoked with all default attribute values:
|
@@ -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
|
@@ -83,7 +83,9 @@ module AllCollectionsHooks
|
|
83
83
|
|
84
84
|
@draft = Jekyll::Draft.draft?(obj)
|
85
85
|
@excerpt = @data['excerpt'] if @data.key? 'excerpt'
|
86
|
-
@ext =
|
86
|
+
@ext = obj.extname
|
87
|
+
@ext ||= @data['ext'] if @data.key? 'ext'
|
88
|
+
@extname = @ext # For compatibility with previous versions of all_collections
|
87
89
|
@label = obj.collection.label if obj&.collection.respond_to? :label
|
88
90
|
@last_modified = @data['last_modified'] || @data['last_modified_at'] || @date
|
89
91
|
@last_modified_field = case @data
|
data/spec/status_persistence.txt
CHANGED
@@ -1,23 +1,22 @@
|
|
1
|
-
example_id
|
2
|
-
|
3
|
-
./spec/
|
4
|
-
./spec/
|
5
|
-
./spec/
|
6
|
-
./spec/
|
7
|
-
./spec/
|
8
|
-
./spec/
|
9
|
-
./spec/
|
10
|
-
./spec/
|
11
|
-
./spec/
|
12
|
-
./spec/
|
13
|
-
./spec/
|
14
|
-
./spec/
|
15
|
-
./spec/
|
16
|
-
./spec/
|
17
|
-
./spec/
|
18
|
-
./spec/
|
19
|
-
./spec/
|
20
|
-
./spec/
|
21
|
-
./spec/
|
22
|
-
./spec/
|
23
|
-
./spec/lambda_sort_spec.rb[1:11] | passed | 0.00036 seconds |
|
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
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
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
102
|
+
rubygems_version: 3.5.6
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Provides a collection of all collections in site.all_collections.
|