dimples 1.2.3 → 1.2.4

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: b634c387f28dce364954a393bdd1c515942c53f8
4
- data.tar.gz: 0b04146454413293bcdc39962f9057a7bff40660
3
+ metadata.gz: 3be3dfc36f4a8285d77823deff68e9585cb71baf
4
+ data.tar.gz: cb592149ddd792be5f46f1bf647cbcf8084c5cb9
5
5
  SHA512:
6
- metadata.gz: c2d8140add07d0aa4bfcffbdc5267c622d8d4cc34ba050c4b6ed2c3a2e509e90964613a976431840b49734a85417886a363bc4606e499e93a4a9e4cb4d9417a4
7
- data.tar.gz: 8df6e21eb9b1b569ae2c82dd955d3c94a036aa3bc5c368dbfc0f9e116a024f2fa7bc7a2a54bb7b99f1a0f8d90fb8f75c4106af35eea4cbff74cfcab249596e56
6
+ metadata.gz: 93ec231ac30080beeef7d13876fb573b361c8131e5378775e8472905c2bbc5ad56561eda9f4ec8d18ac66a6060033d3ffa8ea048bec84171eccbc87171bc797a
7
+ data.tar.gz: eb90279afa05032d464ff0e7a38ab400e1ee82befa8341a85f20f229f54755a7322c883c514b87b7c7778dad5658943dd15262dd42d3916e15b57bfc1e4f717a
data/lib/dimples/site.rb CHANGED
@@ -205,31 +205,32 @@ module Dimples
205
205
  page_count = (posts.length.to_f / per_page.to_i).ceil
206
206
 
207
207
  for index in 1..page_count
208
- range = posts.slice((index - 1) * per_page, per_page)
209
-
210
208
  page = @page_class.new(self)
211
209
 
212
210
  page.layout = layout
213
211
  page.title = title || @templates[layout].title
214
212
 
215
- page_paths = paths.clone
216
-
217
213
  pagination = {
218
214
  page: index,
219
215
  pages: page_count,
220
216
  post_count: posts.length,
221
- path: pagination_url(index, page_paths)
217
+ path: pagination_url(index, paths)
222
218
  }
223
219
 
224
- page_paths << "page#{index}" if index != 1
225
-
226
220
  pagination[:previous_page] = pagination[:page] - 1 if (pagination[:page] - 1) > 0
227
221
  pagination[:next_page] = pagination[:page] + 1 if (pagination[:page] + 1) <= pagination[:pages]
228
222
 
229
- path = File.join(page_paths)
223
+ if pagination[:previous_page]
224
+ pagination[:previous_page_url] = pagination[:path]
225
+ pagination[:previous_page_url] += "page" + pagination[:previous_page].to_s if pagination[:previous_page] != 1
226
+ end
227
+
228
+ pagination[:next_page_url] = pagination[:path] + "page" + pagination[:next_page].to_s if pagination[:next_page]
229
+
230
+ output_path = File.join(paths, index != 1 ? "page#{index}" : '')
230
231
 
231
232
  begin
232
- page.write(path, {posts: range, pagination: pagination})
233
+ page.write(output_path, {posts: posts.slice((index - 1) * per_page, per_page), pagination: pagination})
233
234
  rescue => e
234
235
  raise "Failed to generate paginated page #{path} (#{e})"
235
236
  end
@@ -1,3 +1,3 @@
1
1
  module Dimples
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
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.2.3
4
+ version: 1.2.4
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-05-28 00:00:00.000000000 Z
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt