middleman-blog 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/features/paginate.feature +19 -0
- data/lib/middleman-blog/blog_article.rb +1 -3
- data/lib/middleman-blog/extension.rb +57 -41
- data/lib/middleman-blog/version.rb +1 -1
- metadata +68 -70
data/CHANGELOG.md
CHANGED
data/features/paginate.feature
CHANGED
@@ -65,9 +65,28 @@ Feature: Pagination
|
|
65
65
|
Then I should see "/2011-02-01-test-article.html"
|
66
66
|
Then I should see "/2011-02-02-test-article.html"
|
67
67
|
|
68
|
+
When I go to "/2011/01.html"
|
69
|
+
Then I should see "Paginate: false"
|
70
|
+
Then I should see "Article Count: 5"
|
71
|
+
Then I should see "/2011-01-01-test-article.html"
|
72
|
+
Then I should see "/2011-01-02-test-article.html"
|
73
|
+
Then I should see "/2011-01-03-test-article.html"
|
74
|
+
Then I should see "/2011-01-04-test-article.html"
|
75
|
+
Then I should see "/2011-01-05-test-article.html"
|
76
|
+
Then I should not see "/2011-02-01-test-article.html"
|
77
|
+
Then I should not see "/2011-02-02-test-article.html"
|
78
|
+
|
68
79
|
When I go to "/2011/page/2.html"
|
69
80
|
Then I should see "File Not Found"
|
70
81
|
|
82
|
+
When I go to "/tags/foo.html"
|
83
|
+
Then I should see "Paginate: false"
|
84
|
+
Then I should see "Article Count: 2"
|
85
|
+
Then I should not see "/2011-02-02-test-article.html"
|
86
|
+
Then I should not see "/2011-02-01-test-article.html"
|
87
|
+
Then I should see "/2011-01-02-test-article.html"
|
88
|
+
Then I should see "/2011-01-01-test-article.html"
|
89
|
+
|
71
90
|
When I go to "/tags/bar.html"
|
72
91
|
Then I should see "Paginate: false"
|
73
92
|
Then I should see "Article Count: 2"
|
@@ -2,27 +2,27 @@ module Middleman
|
|
2
2
|
module Blog
|
3
3
|
class Options
|
4
4
|
KEYS = [
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
5
|
+
:prefix,
|
6
|
+
:permalink,
|
7
|
+
:sources,
|
8
|
+
:taglink,
|
9
|
+
:layout,
|
10
|
+
:summary_separator,
|
11
|
+
:summary_length,
|
12
|
+
:summary_generator,
|
13
|
+
:year_link,
|
14
|
+
:month_link,
|
15
|
+
:day_link,
|
16
|
+
:default_extension,
|
17
|
+
:calendar_template,
|
18
|
+
:year_template,
|
19
|
+
:month_template,
|
20
|
+
:day_template,
|
21
|
+
:tag_template,
|
22
|
+
:paginate,
|
23
|
+
:per_page,
|
24
|
+
:page_link
|
25
|
+
]
|
26
26
|
|
27
27
|
KEYS.each do |name|
|
28
28
|
attr_accessor name
|
@@ -39,7 +39,10 @@ module Middleman
|
|
39
39
|
def registered(app, options_hash={}, &block)
|
40
40
|
require 'middleman-blog/blog_data'
|
41
41
|
require 'middleman-blog/blog_article'
|
42
|
-
|
42
|
+
require 'active_support/core_ext/time/zones'
|
43
|
+
|
44
|
+
app.set :time_zone, 'UTC'
|
45
|
+
|
43
46
|
app.send :include, Helpers
|
44
47
|
|
45
48
|
options = Options.new(options_hash)
|
@@ -82,45 +85,55 @@ module Middleman
|
|
82
85
|
end
|
83
86
|
|
84
87
|
app.after_configuration do
|
88
|
+
# Make sure ActiveSupport's TimeZone stuff has something to work with,
|
89
|
+
# allowing people to set their desired time zone via Time.zone or
|
90
|
+
# set :time_zone
|
91
|
+
time_zone = Time.zone if Time.zone
|
92
|
+
zone_default = Time.find_zone!(time_zone || 'UTC')
|
93
|
+
unless zone_default
|
94
|
+
raise 'Value assigned to time_zone not recognized.'
|
95
|
+
end
|
96
|
+
Time.zone_default = zone_default
|
97
|
+
|
85
98
|
# Initialize blog with options
|
86
99
|
blog(options)
|
87
100
|
|
88
101
|
sitemap.register_resource_list_manipulator(
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
102
|
+
:blog_articles,
|
103
|
+
blog,
|
104
|
+
false
|
105
|
+
)
|
93
106
|
|
94
107
|
if options.tag_template
|
95
108
|
ignore options.tag_template
|
96
109
|
|
97
110
|
require 'middleman-blog/tag_pages'
|
98
111
|
sitemap.register_resource_list_manipulator(
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
112
|
+
:blog_tags,
|
113
|
+
TagPages.new(self),
|
114
|
+
false
|
115
|
+
)
|
103
116
|
end
|
104
117
|
|
105
118
|
if options.year_template ||
|
106
|
-
|
107
|
-
|
119
|
+
options.month_template ||
|
120
|
+
options.day_template
|
108
121
|
|
109
122
|
require 'middleman-blog/calendar_pages'
|
110
123
|
sitemap.register_resource_list_manipulator(
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
124
|
+
:blog_calendar,
|
125
|
+
CalendarPages.new(self),
|
126
|
+
false
|
127
|
+
)
|
115
128
|
end
|
116
129
|
|
117
130
|
if options.paginate
|
118
131
|
require 'middleman-blog/paginator'
|
119
132
|
sitemap.register_resource_list_manipulator(
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
133
|
+
:blog_paginate,
|
134
|
+
Paginator.new(self),
|
135
|
+
false
|
136
|
+
)
|
124
137
|
end
|
125
138
|
end
|
126
139
|
end
|
@@ -192,7 +205,10 @@ module Middleman
|
|
192
205
|
# @return [Array<Middleman::Sitemap::Resource>]
|
193
206
|
def page_articles
|
194
207
|
limit = (current_resource.metadata[:page]["per_page"] || 0) - 1
|
195
|
-
|
208
|
+
|
209
|
+
# "articles" local variable is populated by Calendar and Tag page generators
|
210
|
+
# If it's not set then use the complete list of articles
|
211
|
+
(current_resource.metadata[:locals]["articles"] || blog.articles)[0..limit]
|
196
212
|
end
|
197
213
|
end
|
198
214
|
end
|
metadata
CHANGED
@@ -1,76 +1,73 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-blog
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 3
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 3.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Thomas Reynolds
|
13
9
|
- Ben Hollis
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
13
|
+
date: 2012-09-21 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: middleman-core
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
25
20
|
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 3
|
29
|
-
- 0
|
30
|
-
- 1
|
21
|
+
- !ruby/object:Gem::Version
|
31
22
|
version: 3.0.1
|
32
|
-
name: middleman-core
|
33
|
-
requirement: *id001
|
34
|
-
prerelease: false
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
23
|
type: :runtime
|
37
|
-
|
38
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
39
28
|
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
|
43
|
-
- 6
|
44
|
-
- 0
|
45
|
-
version: 0.6.0
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 3.0.1
|
31
|
+
- !ruby/object:Gem::Dependency
|
46
32
|
name: maruku
|
47
|
-
requirement:
|
48
|
-
|
49
|
-
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.6.0
|
50
39
|
type: :runtime
|
51
|
-
|
52
|
-
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
53
44
|
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
|
57
|
-
- 3
|
58
|
-
- 0
|
59
|
-
version: 0.3.0
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.6.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
60
48
|
name: tzinfo
|
61
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.3.0
|
55
|
+
type: :runtime
|
62
56
|
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.3.0
|
63
63
|
description: A blog foundation using Middleman
|
64
|
-
email:
|
64
|
+
email:
|
65
65
|
- me@tdreyno.com
|
66
66
|
- ben@benhollis.net
|
67
67
|
executables: []
|
68
|
-
|
69
68
|
extensions: []
|
70
|
-
|
71
69
|
extra_rdoc_files: []
|
72
|
-
|
73
|
-
files:
|
70
|
+
files:
|
74
71
|
- .gemtest
|
75
72
|
- .gitignore
|
76
73
|
- .travis.yml
|
@@ -208,37 +205,37 @@ files:
|
|
208
205
|
- lib/middleman-blog/version.rb
|
209
206
|
- lib/middleman_extension.rb
|
210
207
|
- middleman-blog.gemspec
|
211
|
-
has_rdoc: true
|
212
208
|
homepage: https://github.com/middleman/middleman-blog
|
213
209
|
licenses: []
|
214
|
-
|
215
210
|
post_install_message:
|
216
211
|
rdoc_options: []
|
217
|
-
|
218
|
-
require_paths:
|
212
|
+
require_paths:
|
219
213
|
- lib
|
220
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
214
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
215
|
+
none: false
|
216
|
+
requirements:
|
217
|
+
- - ! '>='
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '0'
|
220
|
+
segments:
|
225
221
|
- 0
|
226
|
-
|
227
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
222
|
+
hash: -3637459157260692446
|
223
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
|
+
none: false
|
225
|
+
requirements:
|
226
|
+
- - ! '>='
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0'
|
229
|
+
segments:
|
232
230
|
- 0
|
233
|
-
|
231
|
+
hash: -3637459157260692446
|
234
232
|
requirements: []
|
235
|
-
|
236
233
|
rubyforge_project: middleman-blog
|
237
|
-
rubygems_version: 1.
|
234
|
+
rubygems_version: 1.8.24
|
238
235
|
signing_key:
|
239
236
|
specification_version: 3
|
240
237
|
summary: A blog foundation using Middleman
|
241
|
-
test_files:
|
238
|
+
test_files:
|
242
239
|
- features/article_cli.feature
|
243
240
|
- features/article_dirs.feature
|
244
241
|
- features/blog_sources.feature
|
@@ -346,3 +343,4 @@ test_files:
|
|
346
343
|
- fixtures/tags-app/source/index.html.erb
|
347
344
|
- fixtures/tags-app/source/layout.erb
|
348
345
|
- fixtures/tags-app/source/tag.html.erb
|
346
|
+
has_rdoc:
|