sutty-archives 2.3.0 → 2.4.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/lib/jekyll-archives.rb +30 -11
- data/lib/jekyll-archives/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cc14da399823bcacdb254eb2a61dc1da3ef87787da6e7873ac2a119d2ce9eb1
|
4
|
+
data.tar.gz: c36acd59da6ec7e2cf8ed837c4989371e3c6edf2a4b65a087ea211f3df59f4e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b8c2af7c4ba9b48932bccda9cc8bb47a560ed1d3c4d573d487a5444c26052fcb8340014ed766bdec9c2802627d5b2afd4c2a3472ec0b87a245e17a1be06cadd
|
7
|
+
data.tar.gz: 51caab8fb1756dd2f77c752c36d2fe70ed14ce863932ac6a953c1ec26edaa0d862dca7d310aa7749fea198ed2e5319f0d9f4abd3c5a2019f76bc3a0aa123a485
|
data/lib/jekyll-archives.rb
CHANGED
@@ -18,6 +18,7 @@ module Jekyll
|
|
18
18
|
|
19
19
|
DEFAULTS = {
|
20
20
|
"layout" => "archive",
|
21
|
+
"group" => false,
|
21
22
|
"enabled" => [],
|
22
23
|
"titles" => {},
|
23
24
|
"replace" => false,
|
@@ -56,14 +57,15 @@ module Jekyll
|
|
56
57
|
read
|
57
58
|
@site.pages.concat(@archives)
|
58
59
|
|
59
|
-
@site.config["archives"] = @archives
|
60
|
+
@site.config["archives"] = @archives unless group?
|
60
61
|
end
|
61
62
|
|
62
63
|
# Read archive data from posts
|
63
64
|
def read
|
64
65
|
read_attrs
|
65
|
-
read_categories_tags
|
66
|
+
read_categories_tags if enabled? "categories-tags"
|
66
67
|
read_dates
|
68
|
+
read_types if group?
|
67
69
|
end
|
68
70
|
|
69
71
|
# Read and group by attributes, using the legacy names when
|
@@ -76,6 +78,11 @@ module Jekyll
|
|
76
78
|
next unless attr_title_enabled? attr, title
|
77
79
|
|
78
80
|
@archives << Archive.new(@site, title, attr, posts)
|
81
|
+
|
82
|
+
next unless group?
|
83
|
+
|
84
|
+
@site.config['archives'] ||= {}
|
85
|
+
@site.config['archives'][attr] = @archives.last
|
79
86
|
end
|
80
87
|
end
|
81
88
|
end
|
@@ -93,16 +100,14 @@ module Jekyll
|
|
93
100
|
end
|
94
101
|
|
95
102
|
def read_categories_tags
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
post.data['
|
101
|
-
post.data['tags'].include?(tag)
|
102
|
-
end
|
103
|
-
|
104
|
-
@archives << Archive.new(@site, { category: category, tag: tag }, "category-tag", category_tag_posts)
|
103
|
+
@site.categories.each do |category, posts|
|
104
|
+
posts.map { |post| post.data['tags'] }.flatten.uniq.compact.each do |tag|
|
105
|
+
category_tag_posts = posts.select do |post|
|
106
|
+
post.data['categories'].include?(category) &&
|
107
|
+
post.data['tags'].include?(tag)
|
105
108
|
end
|
109
|
+
|
110
|
+
@archives << Archive.new(@site, { category: category, tag: tag }, "category-tag", category_tag_posts)
|
106
111
|
end
|
107
112
|
end
|
108
113
|
end
|
@@ -119,6 +124,15 @@ module Jekyll
|
|
119
124
|
end
|
120
125
|
end
|
121
126
|
|
127
|
+
# Generates Archives by Archive type
|
128
|
+
def read_types
|
129
|
+
@config['enabled'].each do |type|
|
130
|
+
type = LEGACY_ATTRS[type] if LEGACY_ATTRS[type]
|
131
|
+
|
132
|
+
@archives << Archive.new(@site, type, 'type', @archives[type].posts)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
122
136
|
# Return the front matter attributes to archive by, using the
|
123
137
|
# legacy names unless specified and leaving out the date
|
124
138
|
# attributes.
|
@@ -133,6 +147,11 @@ module Jekyll
|
|
133
147
|
@enabled == true || @enabled == "all" || (@enabled.is_a?(Array) && @enabled.include?(archive))
|
134
148
|
end
|
135
149
|
|
150
|
+
# Checks if we want grouped archives
|
151
|
+
def group?
|
152
|
+
@config['group']
|
153
|
+
end
|
154
|
+
|
136
155
|
# Custom `post_attr_hash` method for years
|
137
156
|
def years
|
138
157
|
date_attr_hash(@posts.docs, "%Y")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sutty-archives
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alfred Xing
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jekyll
|