octopress-paginate 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +24 -17
- data/lib/octopress-paginate.rb +9 -4
- data/lib/octopress-paginate/version.rb +1 -1
- metadata +3 -87
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: febefb37fa1786908c4c1e4e22bbd3974517f0c7
|
4
|
+
data.tar.gz: 29cceb649b823c04eace32c305f50e3cff1fcf01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9922d090804e0148ebb214fce2d72b9ce9a32edef67d7b63a19831c6e3967feb3899d4a2012f4f2f00d93a9c8f82c7183a146d8ee71d923418bb3623993f9cdc
|
7
|
+
data.tar.gz: 3ec404b5fe19bec61470265829e6c4d7273c91f90088dbd5d27960668fb8787b8ddcb43ce4e8a8dca03274fb83509d07597768461723344c9236256edbf7ce2c
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 1.2.0 (2016-09-24)
|
4
|
+
|
5
|
+
- Fix deprecation warnings with Jekyll 3.
|
6
|
+
- Add `reverse` capability.
|
7
|
+
|
3
8
|
### 1.1.1 (2015-02-27)
|
4
9
|
|
5
10
|
- Fix: Typo caused paginated collections to fail.
|
6
11
|
|
7
12
|
### 1.1.0 (2015-02-11)
|
8
13
|
|
9
|
-
- New: Configure site-wide defaults in _config.yml
|
14
|
+
- New: Configure site-wide defaults in \_config.yml
|
10
15
|
|
11
16
|
### 1.0.0 (2015-02-10)
|
12
17
|
|
data/README.md
CHANGED
@@ -8,30 +8,38 @@ Simple and flexible pagination for Jekyll sites featuring:
|
|
8
8
|
- Filter by categories or tags
|
9
9
|
- Multi-language support (with [octopress-multilingual](https://github.com/octopress/multilingual))
|
10
10
|
|
11
|
-
[](https://travis-ci.org/octopress/paginate)
|
12
|
+
[](https://rubygems.org/gems/octopress-paginate)
|
13
|
+
[](https://octopress.mit-license.org)
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
17
17
|
If you're using bundler add this gem to your site's Gemfile in the `:jekyll_plugins` group:
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
```ruby
|
20
|
+
group :jekyll_plugins do
|
21
|
+
gem 'octopress-paginate'
|
22
|
+
end
|
23
|
+
```
|
22
24
|
|
23
25
|
Then install the gem with Bundler
|
24
26
|
|
25
|
-
|
27
|
+
```shell
|
28
|
+
$ bundle
|
29
|
+
```
|
26
30
|
|
27
31
|
To install manually without bundler:
|
28
32
|
|
29
|
-
|
33
|
+
```shell
|
34
|
+
$ gem install octopress-paginate
|
35
|
+
```
|
30
36
|
|
31
37
|
Then add the gem to your Jekyll configuration.
|
32
38
|
|
33
|
-
|
34
|
-
|
39
|
+
```ruby
|
40
|
+
gems:
|
41
|
+
- octopress-paginate
|
42
|
+
```
|
35
43
|
|
36
44
|
## Usage
|
37
45
|
|
@@ -85,7 +93,6 @@ That's all there is to it.
|
|
85
93
|
|
86
94
|
Just like Jekyll's paginator, your pagination pages will have access to the following liquid variables.
|
87
95
|
|
88
|
-
|
89
96
|
```yaml
|
90
97
|
paginator.total_pages # Number of paginated pages
|
91
98
|
paginator.total_posts # Total number of posts being paginated
|
@@ -108,7 +115,7 @@ Pagination is configured on a per-page basis under the `paginate` key in a page'
|
|
108
115
|
```yaml
|
109
116
|
paginate:
|
110
117
|
collection: posts
|
111
|
-
per_page: 10 # maximum number of items per page
|
118
|
+
per_page: 10 # maximum number of items per page
|
112
119
|
limit: 5 # Maximum number of pages to paginate (false for unlimited)
|
113
120
|
permalink: /page:num/ # pagination path (relative to template page)
|
114
121
|
title_suffix: " - page :num" # Append to template's page title
|
@@ -116,13 +123,14 @@ paginate:
|
|
116
123
|
categories: [] # Paginate items in any of these categories
|
117
124
|
tag: '' # Paginate items tagged with this tag
|
118
125
|
tags: [] # Paginate items tagged with any of these tags
|
126
|
+
reversed: false # Reverse the order of the documents
|
119
127
|
```
|
120
128
|
|
121
129
|
Why set a pagination limit? For sites with lots of posts, this should speed up your build time considerably since Jekyll won't have to generate and write so many additional pages. Additionally, I suspect that it is very uncommon for users to browse paginated post indexes beyond a few pages. If you don't like it, it's easy to disable.
|
122
130
|
|
123
131
|
### Site-wide pagination defaults
|
124
132
|
|
125
|
-
You can set your own site-wide pagination defaults by configuring the `pagination` key in Jekyll's site config.
|
133
|
+
You can set your own site-wide pagination defaults by configuring the `pagination` key in Jekyll's site config.
|
126
134
|
|
127
135
|
<!-- title:"Site wide configuration _config.yml" -->
|
128
136
|
|
@@ -138,14 +146,13 @@ override these defaults.
|
|
138
146
|
|
139
147
|
### Pagination permalinks
|
140
148
|
|
141
|
-
Assume your pagination template page was at `/index.html`. The second pagination page would be
|
149
|
+
Assume your pagination template page was at `/index.html`. The second pagination page would be
|
142
150
|
published to `/page2/index.html` by default. If your template page was at `/posts/index.html` or if was configured
|
143
151
|
with `permalink: /posts/` the second pagination page would be published to `/posts/page2/index.html`.
|
144
152
|
|
145
|
-
|
146
153
|
Here are some examples:
|
147
154
|
|
148
|
-
```
|
155
|
+
```yaml
|
149
156
|
paginate:
|
150
157
|
permalink /page-:num/ # => /page-2/index.html
|
151
158
|
permalink /page/:num/ # => /page/2/index.html
|
@@ -156,7 +163,7 @@ You get the idea.
|
|
156
163
|
|
157
164
|
## Contributing
|
158
165
|
|
159
|
-
1. Fork it (
|
166
|
+
1. Fork it (<https://github.com/octopress/paginate/fork>)
|
160
167
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
161
168
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
162
169
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/octopress-paginate.rb
CHANGED
@@ -12,7 +12,8 @@ module Octopress
|
|
12
12
|
'limit' => 5,
|
13
13
|
'permalink' => '/page:num/',
|
14
14
|
'title_suffix' => ' - page :num',
|
15
|
-
'page_num' => 1
|
15
|
+
'page_num' => 1,
|
16
|
+
'reversed' => false
|
16
17
|
}
|
17
18
|
|
18
19
|
LOOP = /(paginate.+\s+in)\s+(site\.(.+?))(.+)%}/
|
@@ -64,7 +65,7 @@ module Octopress
|
|
64
65
|
pages.times do |i|
|
65
66
|
index = i+2
|
66
67
|
|
67
|
-
# If page is generated by an Octopress Ink plugin, use the built in
|
68
|
+
# If page is generated by an Octopress Ink plugin, use the built in
|
68
69
|
# methods for cloning the page
|
69
70
|
#
|
70
71
|
if page.respond_to?(:asset) && page.asset.to_s.match('Octopress::Ink')
|
@@ -119,7 +120,7 @@ module Octopress
|
|
119
120
|
def page_title(page, index)
|
120
121
|
title = if page.data['title']
|
121
122
|
page.data['title']
|
122
|
-
else
|
123
|
+
else
|
123
124
|
page.data['paginate']['collection'].capitalize
|
124
125
|
end
|
125
126
|
|
@@ -133,11 +134,15 @@ module Octopress
|
|
133
134
|
if defined?(Octopress::Multilingual) && page.lang
|
134
135
|
page.site.posts_by_language(page.lang)
|
135
136
|
else
|
136
|
-
page.site.posts.reverse
|
137
|
+
page.site.posts.docs.reverse
|
137
138
|
end
|
138
139
|
else
|
139
140
|
page.site.collections[page['paginate']['collection']].docs
|
140
141
|
end
|
142
|
+
|
143
|
+
if page['paginate']['reversed'] == true
|
144
|
+
collection = collection.reverse
|
145
|
+
end
|
141
146
|
|
142
147
|
if categories = page.data['paginate']['categories']
|
143
148
|
collection = collection.reject{|p| (p.categories & categories).empty?}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-paginate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-hooks
|
@@ -24,90 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: clash
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.7'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.7'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: octopress-multilingual
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: octopress
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: pry-byebug
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
27
|
description:
|
112
28
|
email:
|
113
29
|
- brandon@imathis.com
|
@@ -141,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
57
|
version: '0'
|
142
58
|
requirements: []
|
143
59
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
60
|
+
rubygems_version: 2.5.1
|
145
61
|
signing_key:
|
146
62
|
specification_version: 4
|
147
63
|
summary: A nice and simple paginator for Jekyll sites.
|