jekyll-archives-dir-category 0.1.2 → 0.1.6

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: 7b303af89b367228b34b4aeafe0bd22ee44d09c07dbdf6cb987d461ed8fcca77
4
- data.tar.gz: b9b4498c4d8bc456b540e95f1a9c75e5b89f52d367d693ba4dc42e8a0ff658a3
3
+ metadata.gz: 51f99c38c390df3f76d5e599923412a807acbbf856633afcd3d4e2e2f2822186
4
+ data.tar.gz: ab314678395c075446f7e06ec8a5cbfc6c315e1b05ab2a931330eb43bbe8028b
5
5
  SHA512:
6
- metadata.gz: 68235cb9e5649cf5cbce1f8d6e63621e9ea0622992141b1f6037aa92b964d35a747cc6a6774e69dc6a248fc14d3623a5051dd41a3af66ba6ef0cd8f66e3f2de0
7
- data.tar.gz: 9cb24a2c6adfe47dc1aa69b1028346a79c34638cfedc9074263beadfb66d928f0e7b605d69ec1622a8f06ad0fe2109bb5d17e00f9bbc560ae9860dd18f2beee4
6
+ metadata.gz: 784a93fb04f52507ea5bf2e8821c377399bf3bca646243521318dd5ea4d063161306f9526b3a3a53c1204b25211a8cb875949e96cc03cc2e978d8b983e8a5c96
7
+ data.tar.gz: 3c7898774af1b19fd1f036a2ef14ef3aa18a5f945d8c4e75c528dc0f505b1cd41d58b37c024a854fab510d5b0f930d2bdacf05c536dcdd2de3325c9e0880bfad
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Archives
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.6"
6
6
  end
7
7
  end
@@ -91,13 +91,13 @@ module Jekyll
91
91
  cn = get_category_name(path)
92
92
  p.data["category"] = c
93
93
  p.data["categories"] = [c]
94
- p.data["category-name"] = cn
94
+ p.data["category_name"] = cn
95
95
  io = IO.popen('git log -1 --pretty="format:%cI" ' + p.path)
96
96
  date_str = io.gets
97
97
  # printf("post:%s\n", p.path)
98
98
  # printf(" pwd :%s", `pwd`)
99
99
  # printf(" date:%s\n\n", date_str)
100
- p.data["update-time"] = date_str
100
+ p.data["update_time"] = date_str
101
101
  # printf("Post date:%s\n", `git log -1 --pretty="format:%cI" $p`)
102
102
  # printf(" category:%s\n", c)
103
103
  # printf(" category name:%s\n\n", cn)
@@ -109,6 +109,7 @@ module Jekyll
109
109
  category_info << c
110
110
  end
111
111
  site.data["category-info"] = category_info
112
+ # print category_info.inspect
112
113
  end
113
114
 
114
115
  # the category info from '_category.yml' file
@@ -133,9 +134,9 @@ module Jekyll
133
134
  info["priority"] = category_info["priority"] if !category_info["priority"].nil?
134
135
  end
135
136
  if info["href"].nil?
136
- info["count"] = 0
137
+ info["post_count"] = 0
137
138
  else
138
- info["count"] = @posts.docs.count { |a|
139
+ info["post_count"] = @posts.docs.count { |a|
139
140
  a.data["category"].start_with? info["href"]
140
141
  }
141
142
  end
@@ -224,15 +225,36 @@ module Jekyll
224
225
  end
225
226
 
226
227
  def read_dates
228
+ dates_info_years = []
227
229
  years.each do |year, y_posts|
228
230
  append_enabled_date_type({ :year => year }, "year", y_posts)
231
+ dates_info_months = []
229
232
  months(y_posts).each do |month, m_posts|
230
233
  append_enabled_date_type({ :year => year, :month => month }, "month", m_posts)
234
+ dates_info_days = []
231
235
  days(m_posts).each do |day, d_posts|
232
236
  append_enabled_date_type({ :year => year, :month => month, :day => day }, "day", d_posts)
237
+ dates_info_days << {
238
+ "day" => "%02d" % day.to_i,
239
+ "post_count" => @posts.docs.count {|p| p.date.year == year.to_i && p.date.month == month.to_i && p.date.day == day.to_i },
240
+ }
233
241
  end
242
+ dates_info_months << {
243
+ "month" => "%02d" % month.to_i,
244
+ "days" => dates_info_days.sort{|a, b| b["day"] <=> a["day"]},
245
+ "post_count" => @posts.docs.count {|p| p.date.year == year.to_i && p.date.month == month.to_i },
246
+ }
234
247
  end
248
+ dates_info_years << {
249
+ "year" => "%04d" % year.to_i,
250
+ "months" => dates_info_months.sort{|a, b| b["month"] <=> a["month"]},
251
+ "post_count" => @posts.docs.count {|p| p.date.year == year.to_i },
252
+ }
235
253
  end
254
+
255
+ @site.data["date-info"] = dates_info_years.sort{|a, b| b["year"] <=> a["year"]}
256
+ # print "\n=================================\n"
257
+ # print @site.data["date-info"].inspect
236
258
  end
237
259
 
238
260
  # Checks if archive type is enabled in config
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-archives-dir-category
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alfred Xing
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-22 00:00:00.000000000 Z
11
+ date: 2021-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll