sutty-archives 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de531ca1b1088e2b311d795bb399e76d4d472c13b146b4c87d711d0ff7f30612
4
- data.tar.gz: 465b830b25c64e795503d591012e37268059265a1fb16b0d6d1d289fdf40dfae
3
+ metadata.gz: 504d81958bc2f61213d04212cd3988a17131869a0dff5e294f0782e353515f43
4
+ data.tar.gz: cb58a0438cdd6bbf51c33ac2bea2f33e5862498039d81d74c9bb56d94fe48c44
5
5
  SHA512:
6
- metadata.gz: 4cd9ad72c38bf0a4fccad60781a6d2d161e42754d7e98262d15ca037e8c125ac3cfd3f312b2f58f52a0cb3b3e2a2a1f1cdfccf881180d9dd689238b154ec25ef
7
- data.tar.gz: 82dc16f23c07788f6c69e592e3045a3d49f03987a556694825b005a9c0e7b66d3e9a203eeb73baf2d70287ec69dc44097a82b600f004d993a282ebb6cb926a5b
6
+ metadata.gz: b25f4cc57b9b894980af8c95a65d3e6c35b5ef68de2c91c983d11a7c53300f96116592f20a364e7aae34c71aa028ac98ebcbe421324a9b43b2f5cbf851889f26
7
+ data.tar.gz: 4259f6adafecb055f17404b46b1ba0a2033bc68905a174bca902dfdd09151ab9eb5f293d35ad37ae190e04de6c740b71107389a43734ac31c30180d64acc6a8b
@@ -71,14 +71,28 @@ module Jekyll
71
71
  post_attr_hash(attr).each do |title, posts|
72
72
  attr = LEGACY_ATTRS[attr] if LEGACY_ATTRS[attr]
73
73
 
74
+ next unless attr_title_enabled? attr, title
75
+
74
76
  @archives << Archive.new(@site, title, attr, posts)
75
77
  end
76
78
  end
77
79
  end
78
80
 
81
+ # If the permalink is a hash of value => template, check if it
82
+ # isn't disabled.
83
+ def attr_title_enabled?(attr, value)
84
+ permalinks = @config.dig('permalinks', attr)
85
+
86
+ if permalinks.is_a?(Hash)
87
+ !!permalinks.dig(value)
88
+ else
89
+ true
90
+ end
91
+ end
92
+
79
93
  def read_categories_tags
80
94
  if enabled? "categories-tags"
81
- categories.each do |category, posts|
95
+ @site.categories.each do |category, posts|
82
96
  posts.map { |post| post.data['tags'] }.flatten.uniq.compact.each do |tag|
83
97
  category_tag_posts = posts.select do |post|
84
98
  post.data['categories'].include?(category) &&
@@ -50,7 +50,10 @@ module Jekyll
50
50
  #
51
51
  # Returns the template String.
52
52
  def template
53
- @config.dig("permalinks", type) || "/#{type}/:name/"
53
+ t = @config.dig("permalinks", type)
54
+ t = t.is_a?(Hash) ? t[title] : t
55
+
56
+ t || "/#{type}/:name/"
54
57
  end
55
58
 
56
59
  # The layout to use for rendering
@@ -111,7 +114,7 @@ module Jekyll
111
114
  #
112
115
  # Returns a Date.
113
116
  def date
114
- return unless @title.is_a?(Hash)
117
+ return unless date?
115
118
 
116
119
  @date ||= begin
117
120
  args = @title.values.map(&:to_i)
@@ -143,6 +146,10 @@ module Jekyll
143
146
  "#<Jekyll:Archive @type=#{@type} @title=#{@title} @data=#{@data.inspect}>"
144
147
  end
145
148
 
149
+ def date?
150
+ %w[year month day].include? @type
151
+ end
152
+
146
153
  private
147
154
 
148
155
  # Generate slug if @title attribute is a string.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Archives
5
- VERSION = "2.2.1"
5
+ VERSION = "2.2.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sutty-archives
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alfred Xing
8
8
  - f
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-06-10 00:00:00.000000000 Z
12
+ date: 2020-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -116,7 +116,7 @@ dependencies:
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  description: Automatically generate post archives by dates, and any front matter attribute.
119
- email:
119
+ email:
120
120
  executables: []
121
121
  extensions: []
122
122
  extra_rdoc_files: []
@@ -129,7 +129,7 @@ homepage: https://0xacab.org/sutty/jekyll/sutty-archives
129
129
  licenses:
130
130
  - MIT
131
131
  metadata: {}
132
- post_install_message:
132
+ post_install_message:
133
133
  rdoc_options: []
134
134
  require_paths:
135
135
  - lib
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubygems_version: 3.0.3
148
- signing_key:
148
+ signing_key:
149
149
  specification_version: 4
150
150
  summary: Post archives for Jekyll. Fork of jekyll-archives.
151
151
  test_files: []