dimples 1.6.3 → 1.7

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
  SHA1:
3
- metadata.gz: 2d8efe1feb572148827ab83694edcf8b5429be15
4
- data.tar.gz: 638b4c45430282d35779d2dfee179926d9c0f0ae
3
+ metadata.gz: 2195d33c5db58576e330e294263c8e0372b5751b
4
+ data.tar.gz: 8395118f614c8e2e72a31f43cb57717ca8d79c8d
5
5
  SHA512:
6
- metadata.gz: 3e3be8bbeee3358c972b1b07cfa135fc4ea21861220ed3d6aadd05a881f1cdbcadba0a3e1b77a18dbbc7ec10b476951232aacbbade33736277f8dc0a00c832d4
7
- data.tar.gz: 4a8860e444bea38ce540797a1a734c87e2b06fa98e3920cff21c4dd75c6f4d84633b1b258ed6b29a3abe64e77e6ab0c3a0c201041f258df3bb95679aab4a9afa
6
+ metadata.gz: f4b5a24e2576217a18ab9cb26c060fdf9775e6b73f6302a008df047b9d4b6ed1960b6221cada8cbcdd5f76d5e6a8e0e1aece6b410981614e2c3c63680d20d938
7
+ data.tar.gz: dc5359f9081e0628ee56902834bd38f9717112c72d41622a9f0d7b9961795624beb728a9ea80595f3c61d4d91866e0b1781b21f88b025d0249744039e55a4fb9
@@ -37,6 +37,9 @@ module Dimples
37
37
  'posts' => 'posts',
38
38
  'post' => 'post',
39
39
  'category' => 'category',
40
+ 'year_archives' => 'year_archives',
41
+ 'month_archives' => 'month_archives',
42
+ 'day_archives' => 'day_archives'
40
43
  },
41
44
 
42
45
  'rendering' => {
@@ -33,13 +33,13 @@ module Dimples
33
33
  @source_paths[:root] = File.expand_path(@config['source_path'])
34
34
  @output_paths[:site] = File.expand_path(@config['destination_path'])
35
35
 
36
- %w{pages posts public templates}.each do |path|
36
+ %w[pages posts public templates].each do |path|
37
37
  @source_paths[path.to_sym] = File.join(@source_paths[:root], path)
38
38
  end
39
39
 
40
- @output_paths[:archives] = File.join(@output_paths[:site], @config['paths']['archives'])
41
- @output_paths[:posts] = File.join(@output_paths[:site], @config['paths']['posts'])
42
- @output_paths[:categories] = File.join(@output_paths[:site], @config['paths']['categories'])
40
+ %w[archives posts categories].each do |path|
41
+ @output_paths[path.to_sym] = File.join(@output_paths[:site], @config['paths'][path])
42
+ end
43
43
  end
44
44
 
45
45
  def generate(options = {})
@@ -100,13 +100,9 @@ module Dimples
100
100
  (@categories[slug] ||= []) << post
101
101
  end
102
102
 
103
- %w[year month day].each do |date_type|
104
- if @config['generation']["#{date_type}_archives"]
105
-
106
- date_key = post.date.strftime(@config['date_formats'][date_type])
107
- (@archives[date_type.to_sym][date_key] ||= []) << post
108
- end
109
- end
103
+ (@archives[:year][post.year] ||= []) << post
104
+ (@archives[:month]["#{post.year}/#{post.month}"] ||= []) << post
105
+ (@archives[:day]["#{post.year}/#{post.month}/#{post.day}"] ||= []) << post
110
106
 
111
107
  @posts << post
112
108
  end
@@ -165,15 +161,23 @@ module Dimples
165
161
  %w[year month day].each do |date_type|
166
162
 
167
163
  if @config['generation']["#{date_type}_archives"]
164
+ template = @config['layouts']["#{date_type}_archives"]
168
165
 
169
- template = @config['layouts'][date_type] || @config['layouts']['archives'] || @config['layouts']['posts']
170
- archives[date_type.to_sym].each_pair do |date_title, posts|
171
-
166
+ @archives[date_type.to_sym].each_value do |posts|
167
+ title = posts[0].date.strftime(@config['date_formats'][date_type])
172
168
  paths = [@output_paths[:archives], posts[0].year]
173
- paths << posts[0].month if date_type =~ /month|day/
174
- paths << posts[0].day if date_type == 'day'
175
-
176
- paginate(posts: posts, title: date_title, paths: paths, layout: template)
169
+ dates = {year: posts[0].year}
170
+
171
+ case date_type
172
+ when 'month'
173
+ paths << posts[0].month
174
+ dates[:month] = posts[0].month
175
+ when 'day'
176
+ paths.concat([posts[0].month, posts[0].day])
177
+ dates[:day] = posts[0].month
178
+ end
179
+
180
+ paginate(posts: posts, title: title, paths: paths, layout: template, context: dates)
177
181
  end
178
182
  end
179
183
  end
@@ -1,3 +1,3 @@
1
1
  module Dimples
2
- VERSION = "1.6.3"
2
+ VERSION = "1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: '1.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-10 00:00:00.000000000 Z
11
+ date: 2016-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.4.5.1
135
+ rubygems_version: 2.5.1
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: A basic static site generator