jekyll-pagination 0.0.1 → 0.0.2
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.
- data/ChangeLog +7 -0
- data/README +7 -1
- data/lib/jekyll/pagination.rb +16 -29
- data/lib/jekyll/pagination/version.rb +1 -1
- metadata +4 -4
data/ChangeLog
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
= Revision history for jekyll-pagination
|
2
2
|
|
3
|
+
== 0.0.2 [2010-07-01]
|
4
|
+
|
5
|
+
* Cleanup and documentation.
|
6
|
+
* Overwriting Pagination#paginate was obsoleted by overwriting Page#dir=
|
7
|
+
* Provide aliases to original methods
|
8
|
+
* Credits.
|
9
|
+
|
3
10
|
== 0.0.1 [2010-06-30]
|
4
11
|
|
5
12
|
* Birthday :-)
|
data/README
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
== VERSION
|
4
4
|
|
5
|
-
This documentation refers to jekyll-pagination version 0.0.
|
5
|
+
This documentation refers to jekyll-pagination version 0.0.2
|
6
6
|
|
7
7
|
|
8
8
|
== DESCRIPTION
|
@@ -30,6 +30,12 @@ RubyGem:: <http://rubygems.org/gems/jekyll-pagination>
|
|
30
30
|
* Jens Wille <mailto:jens.wille@uni-koeln.de>
|
31
31
|
|
32
32
|
|
33
|
+
== CREDITS
|
34
|
+
|
35
|
+
* Arne Eilermann <mailto:arne.eilermann@uni-koeln.de> for the original idea
|
36
|
+
and implementation.
|
37
|
+
|
38
|
+
|
33
39
|
== LICENSE AND COPYRIGHT
|
34
40
|
|
35
41
|
Copyright (C) 2010 University of Cologne,
|
data/lib/jekyll/pagination.rb
CHANGED
@@ -28,33 +28,12 @@
|
|
28
28
|
|
29
29
|
module Jekyll
|
30
30
|
|
31
|
-
class Pagination
|
32
|
-
|
33
|
-
def paginate(site, page)
|
34
|
-
posts = site.site_payload['site']['posts']
|
35
|
-
|
36
|
-
total = Pager.calculate_pages(posts, site.config['paginate'].to_i)
|
37
|
-
|
38
|
-
1.upto(total) { |num|
|
39
|
-
pager = Pager.new(site.config, num, posts, total)
|
40
|
-
|
41
|
-
if num > 1
|
42
|
-
newpage = Page.new(site, site.source, page.dir, page.name)
|
43
|
-
|
44
|
-
newpage.pager = pager
|
45
|
-
newpage.dir = File.join(page.dir, "page#{num}")
|
46
|
-
|
47
|
-
site.pages << newpage
|
48
|
-
else
|
49
|
-
page.pager = pager
|
50
|
-
end
|
51
|
-
}
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
31
|
class Page
|
57
32
|
|
33
|
+
alias_method :_pagination_original_dir=, :dir=
|
34
|
+
|
35
|
+
# Overwrites the original method to also set +basename+ when there's
|
36
|
+
# a +pager+. NOTE: Depends on +pager+ being set before setting +dir+.
|
58
37
|
def dir=(dir)
|
59
38
|
@basename = 'index' if @pager
|
60
39
|
@dir = dir
|
@@ -64,11 +43,19 @@ module Jekyll
|
|
64
43
|
|
65
44
|
class Pager
|
66
45
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
46
|
+
class << self
|
47
|
+
|
48
|
+
alias_method :_pagination_original_pagination_enabled?, :pagination_enabled?
|
49
|
+
|
50
|
+
# Overwrites the original method to check +paginate_file+ and
|
51
|
+
# +paginate_files+ configuration options.
|
52
|
+
def pagination_enabled?(config, file)
|
53
|
+
if config['paginate']
|
54
|
+
config['paginate_files'] ||= ['index.html']
|
55
|
+
config.pluralized_array('paginate_file', 'paginate_files').include?(file)
|
56
|
+
end
|
71
57
|
end
|
58
|
+
|
72
59
|
end
|
73
60
|
|
74
61
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-pagination
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jens Wille
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-07-01 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|