sutty-archives 2.2.3 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb321000de02f19e06eeeb4c87cb3e631a5e587a8eaa1c8f8b1d1ca5f122035d
4
- data.tar.gz: 7c246d8580ac25397faf9408c70baebc7297deee7ad4c4e678d8c0e7de0012a5
3
+ metadata.gz: 3fef8ed446f2c81a26428e355f7b4c14923fdd56b9367db006f13464f909cac8
4
+ data.tar.gz: a2a0af5d85a97a779b0ca73f2300612ea333d2c2d99accd12bdc822673ba0874
5
5
  SHA512:
6
- metadata.gz: c0aa4305061361e3aee1ed18a230f09f0dbea26458fbb97f98c72399afe29d4180e7ad51b688716824ae6f820464f49e34eb9d1810a5023a228840e611fed87d
7
- data.tar.gz: 8d2a98375dcb61f3af31fe0c6168366fa5525311f10ab07f6ec3926feb652c48a3750940d9b6c8937cf83add40145a0e97298fbb115264a834b927995fe8530b
6
+ metadata.gz: 4933c5145a31350e62411b303ecba29f8b49a50e63baf4412ef02f6bb96f65cc82ac31febf86c459303ead1d1c7ccdcf1ce2586d323b03c53d26c7be2cdc42ab
7
+ data.tar.gz: 811cf946c59dbd7c297cfe201843f76f87e043a2d964434ae4e380dbb190eec710ee040526ef270d584aafb4df6a1956dd1d392593831d67f5c9a8957f4f1856
@@ -20,6 +20,7 @@ module Jekyll
20
20
  "layout" => "archive",
21
21
  "enabled" => [],
22
22
  "titles" => {},
23
+ "replace" => false,
23
24
  "permalinks" => {
24
25
  "year" => "/:year/",
25
26
  "month" => "/:year/:month/",
@@ -43,6 +43,17 @@ module Jekyll
43
43
  @data = { "layout" => layout }
44
44
 
45
45
  @content = ""
46
+
47
+ # Replace the value with the archive except for date and
48
+ # category-tag. For category-tag, do we want to replace the
49
+ # category or the tag?
50
+ return unless replace?
51
+ @posts.each do |post|
52
+ case post.data[attribute]
53
+ when Array then post.data[attribute].map!{|v| (v == title) ? self : v }
54
+ else post.data[attribute] = self
55
+ end
56
+ end
46
57
  end
47
58
 
48
59
  # The template of the permalink.
@@ -151,6 +162,18 @@ module Jekyll
151
162
 
152
163
  private
153
164
 
165
+ def replace?
166
+ @config['replace'] && !(date? || @type == 'category-tag')
167
+ end
168
+
169
+ def attribute
170
+ case type
171
+ when 'tag' then 'tags'
172
+ when 'category' then 'categories'
173
+ else type
174
+ end
175
+ end
176
+
154
177
  # Generate slug if @title attribute is a string.
155
178
  #
156
179
  # Note: mode other than those expected by Jekyll returns the given string after
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Archives
5
- VERSION = "2.2.3"
5
+ VERSION = "2.3.0"
6
6
  end
7
7
  end
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.2.3
4
+ version: 2.3.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-08-26 00:00:00.000000000 Z
12
+ date: 2020-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubygems_version: 3.0.3
147
+ rubygems_version: 3.1.2
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Post archives for Jekyll. Fork of jekyll-archives.