jekyll-archives-dir-category 0.1.0 → 0.1.5

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: 39b0ef05fc29929a7c57609d539ec8fcf34c73c04e2cef76826c1df4525099ea
4
- data.tar.gz: 4e0e5f70afcf09c9ac93f8b8b22c7261c50b02afeb78a56010cffe41725f3b62
3
+ metadata.gz: 851d4fda6842f27e53d5a044b417f1c50a04080bc040d3aa868f891d5c0135de
4
+ data.tar.gz: a8722f129daeee0f4205e388a9c47292d2141591b37839b56a2d57aecbf1aee1
5
5
  SHA512:
6
- metadata.gz: a5696cb3138e9e9334409b162893f6f986297e150efdaf4c0c7d6562960304862f233aea9b340a548029f10e7cbdd3097235bebb6cdeee92e7454cd7509981cf
7
- data.tar.gz: 23f7a4bc8a87c7acb4043149ab94af2a23e74ed48dc2c86950164278584c58e58cdc022c7df427b2b5b073858ebded565c78e609dcff63fb86a45ef6a0b696e9
6
+ metadata.gz: e82ea052f9467b2322bd99b7e32c1c17a8d32e02a3b7ab9f2ee93b232ed50057f9bfc622502bb4a4dc6896a103a8e82b4adf76e15b16d38f7c8b4d692872d8f6
7
+ data.tar.gz: dad00cdf6a717b1ab90892219416909a3d4a11613693567e25a63962e58688d05265c9f67709fc9ad4d540ccb963dfd840299c3a27fbf0b6140843a198f53c8e
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Archives
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.5"
6
6
  end
7
7
  end
@@ -91,8 +91,14 @@ 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
95
- p.data["update-time"] = File.mtime(p.path)
94
+ p.data["category_name"] = cn
95
+ io = IO.popen('git log -1 --pretty="format:%cI" ' + p.path)
96
+ date_str = io.gets
97
+ # printf("post:%s\n", p.path)
98
+ # printf(" pwd :%s", `pwd`)
99
+ # printf(" date:%s\n\n", date_str)
100
+ p.data["update_time"] = date_str
101
+ # printf("Post date:%s\n", `git log -1 --pretty="format:%cI" $p`)
96
102
  # printf(" category:%s\n", c)
97
103
  # printf(" category name:%s\n\n", cn)
98
104
  end
@@ -103,6 +109,7 @@ module Jekyll
103
109
  category_info << c
104
110
  end
105
111
  site.data["category-info"] = category_info
112
+ print category_info.inspect
106
113
  end
107
114
 
108
115
  # the category info from '_category.yml' file
@@ -127,9 +134,9 @@ module Jekyll
127
134
  info["priority"] = category_info["priority"] if !category_info["priority"].nil?
128
135
  end
129
136
  if info["href"].nil?
130
- info["count"] = 0
137
+ info["post_count"] = 0
131
138
  else
132
- info["count"] = @posts.docs.count { |a|
139
+ info["post_count"] = @posts.docs.count { |a|
133
140
  a.data["category"].start_with? info["href"]
134
141
  }
135
142
  end
@@ -218,15 +225,36 @@ module Jekyll
218
225
  end
219
226
 
220
227
  def read_dates
228
+ dates_info_years = []
221
229
  years.each do |year, y_posts|
222
230
  append_enabled_date_type({ :year => year }, "year", y_posts)
231
+ dates_info_months = []
223
232
  months(y_posts).each do |month, m_posts|
224
233
  append_enabled_date_type({ :year => year, :month => month }, "month", m_posts)
234
+ dates_info_days = []
225
235
  days(m_posts).each do |day, d_posts|
226
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
+ }
227
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
+ }
228
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
+ }
229
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
230
258
  end
231
259
 
232
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.0
4
+ version: 0.1.5
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-19 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