middleman-blog 3.3.0 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/Gemfile-3.0 +1 -1
- data/features/custom_collections.feature +70 -0
- data/features/custom_collections_multiblog.feature +58 -0
- data/features/custom_permalinks_feature.feature +33 -0
- data/features/tags_multiblog.feature +28 -2
- data/fixtures/calendar-and-tag-app/config-directory-indexes.rb +0 -1
- data/fixtures/calendar-app/config-directory-indexes.rb +0 -1
- data/fixtures/custom-collections-app/config-blog-prefix.rb +13 -0
- data/fixtures/custom-collections-app/config-directory-indexes.rb +13 -0
- data/fixtures/custom-collections-app/config.rb +12 -0
- data/fixtures/custom-collections-app/source/blog/2011-01-01-new-article.html.markdown +8 -0
- data/fixtures/custom-collections-app/source/blog/2011-01-02-another-article.html.markdown +9 -0
- data/fixtures/custom-collections-app/source/category.html.erb +7 -0
- data/fixtures/custom-collections-app/source/index.html.erb +5 -0
- data/fixtures/custom-collections-app/source/layout.erb +13 -0
- data/fixtures/custom-collections-multiblog-app/config.rb +27 -0
- data/fixtures/custom-collections-multiblog-app/source/blog1/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/custom-collections-multiblog-app/source/blog1/2011-01-02-another-article.html.markdown +7 -0
- data/fixtures/custom-collections-multiblog-app/source/blog2/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/custom-collections-multiblog-app/source/blog2/2011-01-02-another-article.html.markdown +7 -0
- data/fixtures/custom-collections-multiblog-app/source/category1.html.erb +7 -0
- data/fixtures/custom-collections-multiblog-app/source/category2.html.erb +7 -0
- data/fixtures/custom-collections-multiblog-app/source/index.html.erb +8 -0
- data/fixtures/custom-collections-multiblog-app/source/layout.erb +13 -0
- data/fixtures/custom-permalinks-app/config-directory-indexes.rb +7 -0
- data/fixtures/custom-permalinks-app/config.rb +5 -0
- data/fixtures/custom-permalinks-app/source/blog/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/custom-permalinks-app/source/blog/2011-01-02-another-article.html.markdown +7 -0
- data/fixtures/custom-permalinks-app/source/blog/2011-01-03-third-article.html.markdown +7 -0
- data/fixtures/custom-permalinks-app/source/index.html.erb +3 -0
- data/fixtures/custom-permalinks-app/source/layout.erb +13 -0
- data/fixtures/indexes-app/config.rb +0 -1
- data/fixtures/layouts-app/config.rb +0 -2
- data/fixtures/multiblog-app/source/index.html.erb +1 -3
- data/fixtures/paginate-app/config-directory-indexes.rb +0 -1
- data/fixtures/tags-app/config-directory-indexes.rb +0 -1
- data/fixtures/tags-app/config.rb +1 -1
- data/fixtures/tags-multiblog-app/config.rb +1 -1
- data/fixtures/tags-multiblog-app/source/blog1/frontmatter_blog_tags.html.erb +9 -0
- data/fixtures/tags-multiblog-app/source/blog1/named_blog_tags.html.erb +5 -0
- data/fixtures/tags-multiblog-app/source/blog2/frontmatter_blog_tags.html.erb +9 -0
- data/fixtures/tags-multiblog-app/source/blog2/named_blog_tags.html.erb +5 -0
- data/lib/middleman-blog/blog_article.rb +7 -2
- data/lib/middleman-blog/blog_data.rb +37 -20
- data/lib/middleman-blog/custom_pages.rb +85 -0
- data/lib/middleman-blog/extension_3_0.rb +28 -1
- data/lib/middleman-blog/extension_3_1.rb +71 -1
- data/lib/middleman-blog/paginator.rb +2 -2
- data/lib/middleman-blog/template/source/feed.xml.builder +1 -1
- data/lib/middleman-blog/template/source/layout.erb +1 -0
- data/lib/middleman-blog/version.rb +1 -1
- data/middleman-blog.gemspec +1 -2
- metadata +67 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 557a6f4be03e753999b53fa39a8d3310c13b8e89
|
4
|
+
data.tar.gz: a341051be4806dfdf9a6096b8efa3299bab8c57e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3423447600f0594c2a50a0553db7441c7ccf2cab3ef1eb5208c8dd2f6058c79e0f49b778fafa007ee58bbe95613908d9791978fcd384712686a6a5edf139acd0
|
7
|
+
data.tar.gz: 1910cadf0f09c54260ef60d41a9ecf89dc83d0aa65a46bcf5e3da4a67eb2b1e5cf8bab63f43dd28d92a57f536e96d2e583b31a0bf879a16312fb5d3e6a234645
|
data/Gemfile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem "middleman-core", :github => "middleman/middleman"
|
4
|
-
gem "middleman-more", :github => "middleman/middleman"
|
5
4
|
|
6
5
|
# Specify your gem's dependencies in middleman-blog.gemspec
|
7
6
|
gemspec
|
@@ -17,7 +16,7 @@ gem "rspec", "~> 2.12"
|
|
17
16
|
gem "simplecov"
|
18
17
|
|
19
18
|
gem "timecop", "~> 0.4.0"
|
20
|
-
gem "nokogiri", "~> 1.6.0
|
19
|
+
gem "nokogiri", "~> 1.5.0" # 1.6.0 requires Ruby 1.9+ but we still test on 1.8
|
21
20
|
gem "kramdown"
|
22
21
|
|
23
22
|
# Code Quality
|
data/Gemfile-3.0
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
Feature: Custom collection pages
|
2
|
+
|
3
|
+
Scenario: Collection pages are accessible from the preview server
|
4
|
+
Given the Server is running at "custom-collections-app"
|
5
|
+
When I go to "/categories/ruby-on-rails.html"
|
6
|
+
Then I should see "/2011-01-01-new-article.html"
|
7
|
+
Then I should not see "/2011-01-02-another-article.html"
|
8
|
+
When I go to "/categories/html5.html"
|
9
|
+
Then I should not see "/2011-01-01-new-article.html"
|
10
|
+
Then I should see "/2011-01-02-another-article.html"
|
11
|
+
When I go to "/index.html"
|
12
|
+
Then I should see "Category Path: '/categories/ruby-on-rails.html'"
|
13
|
+
|
14
|
+
Scenario: Collection pages are accessbile from preview server with directory_indexes
|
15
|
+
Given a fixture app "custom-collections-app"
|
16
|
+
And app "custom-collections-app" is using config "directory-indexes"
|
17
|
+
And the Server is running
|
18
|
+
When I go to "/categories/ruby-on-rails.html"
|
19
|
+
Then I should see "File Not Found"
|
20
|
+
When I go to "/categories/ruby-on-rails"
|
21
|
+
Then I should not see "/2011-01-01-new-article.html"
|
22
|
+
Then I should see "/2011-01-01-new-article"
|
23
|
+
When I go to "/index.html"
|
24
|
+
Then I should see "Category Path: '/categories/ruby-on-rails/'"
|
25
|
+
|
26
|
+
Scenario: Collection pages also get built
|
27
|
+
Given a successfully built app at "custom-collections-app"
|
28
|
+
When I cd to "build"
|
29
|
+
Then the following files should exist:
|
30
|
+
| categories/ruby-on-rails.html |
|
31
|
+
| categories/html5.html |
|
32
|
+
Then the following files should not exist:
|
33
|
+
| categories.html |
|
34
|
+
|
35
|
+
And the file "categories/ruby-on-rails.html" should contain "Category: ruby-on-rails"
|
36
|
+
And the file "categories/ruby-on-rails.html" should contain "/2011-01-01-new-article.html"
|
37
|
+
And the file "categories/ruby-on-rails.html" should not contain "/2011-01-02-another-article.html"
|
38
|
+
|
39
|
+
And the file "categories/html5.html" should contain "Category: html5"
|
40
|
+
And the file "categories/html5.html" should not contain "/2011-01-01-new-article.html"
|
41
|
+
And the file "categories/html5.html" should contain "/2011-01-02-another-article.html"
|
42
|
+
|
43
|
+
Scenario: Adding a post to a collection adds a collection page
|
44
|
+
Given the Server is running at "custom-collections-app"
|
45
|
+
When I go to "/categories/ruby-on-rails.html"
|
46
|
+
Then I should see "/2011-01-01-new-article.html"
|
47
|
+
When I go to "/categories/newcat.html"
|
48
|
+
Then I should see "Not Found"
|
49
|
+
And the file "source/blog/2011-01-01-new-article.html.markdown" has the contents
|
50
|
+
"""
|
51
|
+
---
|
52
|
+
title: "Newest Article"
|
53
|
+
date: 2011-01-01
|
54
|
+
category: newcat
|
55
|
+
---
|
56
|
+
|
57
|
+
Newer Article Content
|
58
|
+
"""
|
59
|
+
When I go to "/categories/bar.html"
|
60
|
+
Then I should see "Not Found"
|
61
|
+
When I go to "/categories/newcat.html"
|
62
|
+
Then I should see "/2011-01-01-new-article.html"
|
63
|
+
|
64
|
+
Scenario: Collection pages are properly nested when using a blog prefix
|
65
|
+
Given a fixture app "custom-collections-app"
|
66
|
+
And app "custom-collections-app" is using config "blog-prefix"
|
67
|
+
And the Server is running
|
68
|
+
When I go to "/blog/categories/ruby-on-rails.html"
|
69
|
+
Then I should see "/2011-01-01-new-article.html"
|
70
|
+
Then I should not see "/2011-01-02-another-article.html"
|
@@ -0,0 +1,58 @@
|
|
1
|
+
@three_one
|
2
|
+
Feature: Use custom collections with multiple blogs
|
3
|
+
|
4
|
+
Scenario: Custom collection pages are accessible from preview server
|
5
|
+
Given the Server is running at "custom-collections-multiblog-app"
|
6
|
+
When I go to "/blog1/categories/ruby-on-rails.html"
|
7
|
+
Then I should see "/blog1/2011-01-01-new-article.html"
|
8
|
+
Then I should not see "/blog1/2011-01-02-another-article.html"
|
9
|
+
Then I should see "Category1: ruby-on-rails"
|
10
|
+
When I go to "/blog2/categories/javascript.html"
|
11
|
+
Then I should see "/blog2/2011-01-01-new-article.html"
|
12
|
+
Then I should not see "/blog2/2011-01-02-another-article.html"
|
13
|
+
Then I should see "Category2: javascript"
|
14
|
+
When I go to "/blog1/categories/html5.html"
|
15
|
+
Then I should not see "/blog1/2011-01-01-new-article.html"
|
16
|
+
Then I should see "/blog1/2011-01-02-another-article.html"
|
17
|
+
Then I should see "Category1: html5"
|
18
|
+
When I go to "/blog2/categories/html5.html"
|
19
|
+
Then I should not see "/blog2/2011-01-01-new-article.html"
|
20
|
+
Then I should see "/blog2/2011-01-02-another-article.html"
|
21
|
+
Then I should not see "/blog1/2011-01-02-another-article.html"
|
22
|
+
Then I should see "Category2: html5"
|
23
|
+
When I go to "/index.html"
|
24
|
+
Then I should see "Category Path1: '/blog1/categories/ruby-on-rails.html'"
|
25
|
+
Then I should see "Category Path2: '/blog2/categories/javascript.html'"
|
26
|
+
|
27
|
+
Scenario: Custom pages also get built
|
28
|
+
Given a successfully built app at "custom-collections-multiblog-app"
|
29
|
+
When I cd to "build"
|
30
|
+
Then the following files should exist:
|
31
|
+
| blog1/categories/ruby-on-rails.html |
|
32
|
+
| blog1/categories/html5.html |
|
33
|
+
| blog2/categories/javascript.html |
|
34
|
+
| blog2/categories/html5.html |
|
35
|
+
Then the following files should not exist:
|
36
|
+
| category1.html |
|
37
|
+
| category2.html |
|
38
|
+
|
39
|
+
And the file "blog1/categories/ruby-on-rails.html" should contain "Category1: ruby-on-rails"
|
40
|
+
And the file "blog1/categories/ruby-on-rails.html" should contain "/blog1/2011-01-01-new-article.html"
|
41
|
+
And the file "blog1/categories/ruby-on-rails.html" should not contain "/blog1/2011-01-02-another-article.html"
|
42
|
+
And the file "blog1/categories/ruby-on-rails.html" should not contain "/blog2/2011-01-01-new-article.html"
|
43
|
+
And the file "blog1/categories/ruby-on-rails.html" should not contain "/blog2/2011-01-02-another-article.html"
|
44
|
+
|
45
|
+
And the file "blog1/categories/html5.html" should contain "Category1: html5"
|
46
|
+
And the file "blog1/categories/html5.html" should not contain "/blog1/2011-01-01-new-article.html"
|
47
|
+
And the file "blog1/categories/html5.html" should contain "/blog1/2011-01-02-another-article.html"
|
48
|
+
|
49
|
+
And the file "blog2/categories/javascript.html" should contain "Category2: javascript"
|
50
|
+
And the file "blog2/categories/javascript.html" should contain "/blog2/2011-01-01-new-article.html"
|
51
|
+
And the file "blog2/categories/javascript.html" should not contain "/blog2/2011-01-02-another-article.html"
|
52
|
+
And the file "blog2/categories/javascript.html" should not contain "/blog1/2011-01-01-new-article.html"
|
53
|
+
And the file "blog2/categories/javascript.html" should not contain "/blog1/2011-01-02-another-article.html"
|
54
|
+
|
55
|
+
And the file "blog2/categories/html5.html" should contain "Category2: html5"
|
56
|
+
And the file "blog2/categories/html5.html" should not contain "/blog2/2011-01-01-new-article.html"
|
57
|
+
And the file "blog2/categories/html5.html" should contain "/blog2/2011-01-02-another-article.html"
|
58
|
+
And the file "blog2/categories/html5.html" should not contain "/blog1/2011-01-02-another-article.html"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Custom permalinks
|
2
|
+
|
3
|
+
Scenario: Articles list links using custom permalink
|
4
|
+
Given the Server is running at "custom-permalinks-app"
|
5
|
+
When I go to "/index.html"
|
6
|
+
Then I should see "/blog/ruby-on-rails/new-article.html"
|
7
|
+
Then I should see "/blog/html5/another-article.html"
|
8
|
+
Then I should see "/blog/ruby-on-rails/third-article.html"
|
9
|
+
|
10
|
+
Scenario: Articles can be accessed through permalinks with frontmatter data
|
11
|
+
Given the Server is running at "custom-permalinks-app"
|
12
|
+
When I go to "/blog/ruby-on-rails/new-article.html"
|
13
|
+
Then I should see "Newer Article Content"
|
14
|
+
When I go to "/blog/html5/another-article.html"
|
15
|
+
Then I should see "Another Article Content"
|
16
|
+
|
17
|
+
Scenario: Custom permalinks can be accessed from preview server with directory_indexes
|
18
|
+
Given a fixture app "custom-permalinks-app"
|
19
|
+
And app "tags-app" is using config "directory-indexes"
|
20
|
+
And the Server is running
|
21
|
+
When I go to "/blog/ruby-on-rails/new-article.html"
|
22
|
+
Then I should see "File Not Found"
|
23
|
+
When I go to "/blog/ruby-on-rails/new-article"
|
24
|
+
Then I should see "Newer Article Content"
|
25
|
+
When I go to "/blog/html5/another-article"
|
26
|
+
Then I should see "Another Article Content"
|
27
|
+
|
28
|
+
Scenario: Custom permalinks also get built
|
29
|
+
Given a successfully built app at "custom-permalinks-app"
|
30
|
+
When I cd to "build"
|
31
|
+
Then the following files should exist:
|
32
|
+
| blog/ruby-on-rails/new-article.html |
|
33
|
+
| blog/html5/another-article.html |
|
@@ -89,7 +89,7 @@ Feature: Tag pages with multiple blogs
|
|
89
89
|
Then I should see "Not Found"
|
90
90
|
And the file "source/blog1/2011-01-01-new-article.html.markdown" has the contents
|
91
91
|
"""
|
92
|
-
---
|
92
|
+
---
|
93
93
|
title: "Newest Article"
|
94
94
|
date: 2011-01-01
|
95
95
|
tags: newtag1, newtagX
|
@@ -99,7 +99,7 @@ Feature: Tag pages with multiple blogs
|
|
99
99
|
"""
|
100
100
|
And the file "source/blog2/2011-01-01-new-article.html.markdown" has the contents
|
101
101
|
"""
|
102
|
-
---
|
102
|
+
---
|
103
103
|
title: "Newest Article"
|
104
104
|
date: 2011-01-01
|
105
105
|
tags: newtag2, newtagX
|
@@ -123,3 +123,29 @@ Feature: Tag pages with multiple blogs
|
|
123
123
|
When I go to "/blog2/tags/newtagx.html"
|
124
124
|
Then I should see "/blog2/2011-01-01-new-article.html"
|
125
125
|
Then I should not see "/blog1/2011-01-01-new-article.html"
|
126
|
+
|
127
|
+
Scenario: Blog data should work when blog name is specified
|
128
|
+
Given the Server is running at "tags-multiblog-app"
|
129
|
+
When I go to "/blog1/named_blog_tags.html"
|
130
|
+
Then I should see "foo1 (2)"
|
131
|
+
Then I should see "bar1 (1)"
|
132
|
+
Then I should see "fooX (2)"
|
133
|
+
Then I should see "barX (1)"
|
134
|
+
When I go to "/blog2/named_blog_tags.html"
|
135
|
+
Then I should see "foo2 (2)"
|
136
|
+
Then I should see "bar2 (1)"
|
137
|
+
Then I should see "fooX (2)"
|
138
|
+
Then I should see "barX (1)"
|
139
|
+
|
140
|
+
Scenario: Blog data should use blog name in frontmatter
|
141
|
+
Given the Server is running at "tags-multiblog-app"
|
142
|
+
When I go to "/blog1/frontmatter_blog_tags.html"
|
143
|
+
Then I should see "foo1 (2)"
|
144
|
+
Then I should see "bar1 (1)"
|
145
|
+
Then I should see "fooX (2)"
|
146
|
+
Then I should see "barX (1)"
|
147
|
+
When I go to "/blog2/frontmatter_blog_tags.html"
|
148
|
+
Then I should see "foo2 (2)"
|
149
|
+
Then I should see "bar2 (1)"
|
150
|
+
Then I should see "fooX (2)"
|
151
|
+
Then I should see "barX (1)"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "middleman-blog"
|
2
|
+
activate :blog do |blog|
|
3
|
+
blog.prefix = "blog/"
|
4
|
+
blog.sources = ":year-:month-:day-:title.html"
|
5
|
+
blog.permalink = ":year-:month-:day-:title.html"
|
6
|
+
|
7
|
+
blog.custom_collections = {
|
8
|
+
:category => {
|
9
|
+
:link => '/categories/:category.html',
|
10
|
+
:template => '/category.html'
|
11
|
+
}
|
12
|
+
}
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "middleman-blog"
|
2
|
+
activate :blog do |blog|
|
3
|
+
blog.sources = "blog/:year-:month-:day-:title.html"
|
4
|
+
blog.permalink = "blog/:year-:month-:day-:title.html"
|
5
|
+
blog.custom_collections = {
|
6
|
+
:category => {
|
7
|
+
:link => '/categories/:category.html',
|
8
|
+
:template => '/category.html'
|
9
|
+
}
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
activate :directory_indexes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "middleman-blog"
|
2
|
+
activate :blog do |blog|
|
3
|
+
blog.sources = "blog/:year-:month-:day-:title.html"
|
4
|
+
blog.permalink = "blog/:year-:month-:day-:title.html"
|
5
|
+
|
6
|
+
blog.custom_collections = {
|
7
|
+
:category => {
|
8
|
+
:link => '/categories/:category.html',
|
9
|
+
:template => '/category.html'
|
10
|
+
}
|
11
|
+
}
|
12
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
activate :blog do |blog|
|
2
|
+
blog.name = "blog_name_1"
|
3
|
+
blog.prefix = "blog1"
|
4
|
+
blog.sources = ":year-:month-:day-:title.html"
|
5
|
+
blog.permalink = ":year-:month-:day-:title.html"
|
6
|
+
|
7
|
+
blog.custom_collections = {
|
8
|
+
:category => {
|
9
|
+
:link => 'categories/:category.html',
|
10
|
+
:template => 'category1.html'
|
11
|
+
}
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
activate :blog do |blog|
|
16
|
+
blog.name = "blog_name_2"
|
17
|
+
blog.prefix = "blog2"
|
18
|
+
blog.sources = ":year-:month-:day-:title.html"
|
19
|
+
blog.permalink = ":year-:month-:day-:title.html"
|
20
|
+
|
21
|
+
blog.custom_collections = {
|
22
|
+
:category => {
|
23
|
+
:link => 'categories/:category.html',
|
24
|
+
:template => 'category2.html'
|
25
|
+
}
|
26
|
+
}
|
27
|
+
end
|