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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -2
  3. data/Gemfile-3.0 +1 -1
  4. data/features/custom_collections.feature +70 -0
  5. data/features/custom_collections_multiblog.feature +58 -0
  6. data/features/custom_permalinks_feature.feature +33 -0
  7. data/features/tags_multiblog.feature +28 -2
  8. data/fixtures/calendar-and-tag-app/config-directory-indexes.rb +0 -1
  9. data/fixtures/calendar-app/config-directory-indexes.rb +0 -1
  10. data/fixtures/custom-collections-app/config-blog-prefix.rb +13 -0
  11. data/fixtures/custom-collections-app/config-directory-indexes.rb +13 -0
  12. data/fixtures/custom-collections-app/config.rb +12 -0
  13. data/fixtures/custom-collections-app/source/blog/2011-01-01-new-article.html.markdown +8 -0
  14. data/fixtures/custom-collections-app/source/blog/2011-01-02-another-article.html.markdown +9 -0
  15. data/fixtures/custom-collections-app/source/category.html.erb +7 -0
  16. data/fixtures/custom-collections-app/source/index.html.erb +5 -0
  17. data/fixtures/custom-collections-app/source/layout.erb +13 -0
  18. data/fixtures/custom-collections-multiblog-app/config.rb +27 -0
  19. data/fixtures/custom-collections-multiblog-app/source/blog1/2011-01-01-new-article.html.markdown +7 -0
  20. data/fixtures/custom-collections-multiblog-app/source/blog1/2011-01-02-another-article.html.markdown +7 -0
  21. data/fixtures/custom-collections-multiblog-app/source/blog2/2011-01-01-new-article.html.markdown +7 -0
  22. data/fixtures/custom-collections-multiblog-app/source/blog2/2011-01-02-another-article.html.markdown +7 -0
  23. data/fixtures/custom-collections-multiblog-app/source/category1.html.erb +7 -0
  24. data/fixtures/custom-collections-multiblog-app/source/category2.html.erb +7 -0
  25. data/fixtures/custom-collections-multiblog-app/source/index.html.erb +8 -0
  26. data/fixtures/custom-collections-multiblog-app/source/layout.erb +13 -0
  27. data/fixtures/custom-permalinks-app/config-directory-indexes.rb +7 -0
  28. data/fixtures/custom-permalinks-app/config.rb +5 -0
  29. data/fixtures/custom-permalinks-app/source/blog/2011-01-01-new-article.html.markdown +7 -0
  30. data/fixtures/custom-permalinks-app/source/blog/2011-01-02-another-article.html.markdown +7 -0
  31. data/fixtures/custom-permalinks-app/source/blog/2011-01-03-third-article.html.markdown +7 -0
  32. data/fixtures/custom-permalinks-app/source/index.html.erb +3 -0
  33. data/fixtures/custom-permalinks-app/source/layout.erb +13 -0
  34. data/fixtures/indexes-app/config.rb +0 -1
  35. data/fixtures/layouts-app/config.rb +0 -2
  36. data/fixtures/multiblog-app/source/index.html.erb +1 -3
  37. data/fixtures/paginate-app/config-directory-indexes.rb +0 -1
  38. data/fixtures/tags-app/config-directory-indexes.rb +0 -1
  39. data/fixtures/tags-app/config.rb +1 -1
  40. data/fixtures/tags-multiblog-app/config.rb +1 -1
  41. data/fixtures/tags-multiblog-app/source/blog1/frontmatter_blog_tags.html.erb +9 -0
  42. data/fixtures/tags-multiblog-app/source/blog1/named_blog_tags.html.erb +5 -0
  43. data/fixtures/tags-multiblog-app/source/blog2/frontmatter_blog_tags.html.erb +9 -0
  44. data/fixtures/tags-multiblog-app/source/blog2/named_blog_tags.html.erb +5 -0
  45. data/lib/middleman-blog/blog_article.rb +7 -2
  46. data/lib/middleman-blog/blog_data.rb +37 -20
  47. data/lib/middleman-blog/custom_pages.rb +85 -0
  48. data/lib/middleman-blog/extension_3_0.rb +28 -1
  49. data/lib/middleman-blog/extension_3_1.rb +71 -1
  50. data/lib/middleman-blog/paginator.rb +2 -2
  51. data/lib/middleman-blog/template/source/feed.xml.builder +1 -1
  52. data/lib/middleman-blog/template/source/layout.erb +1 -0
  53. data/lib/middleman-blog/version.rb +1 -1
  54. data/middleman-blog.gemspec +1 -2
  55. metadata +67 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1263e95335ae87696662040be1d7ccfdf24570c4
4
- data.tar.gz: dc2e80fe5ab676711441c0b69b516df06e8b9c04
3
+ metadata.gz: 557a6f4be03e753999b53fa39a8d3310c13b8e89
4
+ data.tar.gz: a341051be4806dfdf9a6096b8efa3299bab8c57e
5
5
  SHA512:
6
- metadata.gz: 066c202dd003d01b12ff4a06feb4dc9dba7fc04feba63a66c5fa1c3d7e5c9637a971c0f4dcef6be2f737fe6b9eb051c8ac1bb2c18599f6f450b9d0de51cc9677
7
- data.tar.gz: 2a2e7c2332d3beb2132103cc12ee3ebe5769f50b19cb438ae67481925b6bebad26b37902593a5e5316b0ee41ad2dedc80fb4f4908034e9ed5c08aca115bfe1dd
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
@@ -16,7 +16,7 @@ gem "rspec", "~> 2.12"
16
16
  gem "simplecov"
17
17
 
18
18
  gem "timecop", "~> 0.4.0"
19
- 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
20
20
  gem "kramdown"
21
21
 
22
22
  # Code Quality
@@ -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)"
@@ -6,5 +6,4 @@ activate :blog do |blog|
6
6
  blog.calendar_template = 'calendar.html'
7
7
  end
8
8
 
9
- require "middleman-more"
10
9
  activate :directory_indexes
@@ -6,5 +6,4 @@ activate :blog do |blog|
6
6
  blog.calendar_template = 'calendar.html'
7
7
  end
8
8
 
9
- require "middleman-more"
10
9
  activate :directory_indexes
@@ -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,8 @@
1
+ ---
2
+ title: "Newer Article"
3
+ date: 2011-01-01
4
+ category: ruby-on-rails
5
+ tags: foo, bar
6
+ ---
7
+
8
+ Newer Article Content
@@ -0,0 +1,9 @@
1
+ ---
2
+ title: "Another Article"
3
+ date: 2011-01-02
4
+ category: "html5"
5
+ tags:
6
+ - foo
7
+ ---
8
+
9
+ Another Article Content
@@ -0,0 +1,7 @@
1
+ Category: <%= category %>
2
+
3
+ <% if articles %>
4
+ <% articles[0...12].each do |article| %>
5
+ <li><a href="<%= article.url %>"><%= article.title %></a> <time><%= article.date.strftime('%b %e') %></time></li>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% blog.articles[0...12].each do |article| %>
2
+ <li><a href="<%= article.url %>"><%= article.title %></a> <time><%= article.date.strftime('%b %e') %></time></li>
3
+ <% end %>
4
+
5
+ Category Path: '<%= category_path("ruby-on-rails") %>'
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ </head>
5
+ <body>
6
+ <% if is_blog_article? %>
7
+ <%= current_article.url %>
8
+ <%= yield %>
9
+ <% else %>
10
+ <%= yield %>
11
+ <% end %>
12
+ </body>
13
+ </html>
@@ -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
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: "Newer Article"
3
+ date: 2011-01-01
4
+ category: ruby-on-rails
5
+ ---
6
+
7
+ Newer Article Content
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: "Another Article"
3
+ date: 2011-01-02
4
+ category: html5
5
+ ---
6
+
7
+ Another Article Content
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: "Newer Article"
3
+ date: 2011-01-01
4
+ category: javascript
5
+ ---
6
+
7
+ Newer Article Content
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: "Another Article"
3
+ date: 2011-01-02
4
+ category: html5
5
+ ---
6
+
7
+ Another Article Content
@@ -0,0 +1,7 @@
1
+ Category1: <%= category %>
2
+
3
+ <% if articles %>
4
+ <% articles[0...12].each do |article| %>
5
+ <li><a href="<%= article.url %>"><%= article.title %></a> <time><%= article.date.strftime('%b %e') %></time></li>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ Category2: <%= category %>
2
+
3
+ <% if articles %>
4
+ <% articles[0...12].each do |article| %>
5
+ <li><a href="<%= article.url %>"><%= article.title %></a> <time><%= article.date.strftime('%b %e') %></time></li>
6
+ <% end %>
7
+ <% end %>