middleman-blog 3.4.1 → 3.5.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/.travis.yml +0 -6
- data/CHANGELOG.md +32 -1
- data/Gemfile +5 -9
- data/README.md +3 -2
- data/features/article_cli.feature +10 -1
- data/features/custom_collections.feature +11 -0
- data/features/language.feature +82 -0
- data/features/multiblog.feature +4 -2
- data/features/permalink-data.feature +12 -0
- data/features/summary.feature +13 -0
- data/features/support/env.rb +3 -0
- data/features/tags.feature +18 -1
- data/features/time_zone.feature +1 -1
- data/fixtures/custom-article-template-app/config.rb +3 -0
- data/fixtures/custom-article-template-app/my_custom_article.tt +7 -0
- data/fixtures/custom-article-template-app/source/index.html.erb +9 -0
- data/fixtures/custom-article-template-app/source/layout.erb +30 -0
- data/fixtures/custom-collections-sources-app/config.rb +11 -0
- data/fixtures/custom-collections-sources-app/source/articles/2011-01-02-another-article.html.markdown +8 -0
- data/fixtures/custom-collections-sources-app/source/category.html.erb +7 -0
- data/fixtures/custom-collections-sources-app/source/index.html.erb +5 -0
- data/fixtures/custom-collections-sources-app/source/layout.erb +13 -0
- data/fixtures/custom-collections-sources-app/source/news/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/language-app/config.rb +2 -0
- data/fixtures/language-app/locales/en.yml +4 -0
- data/fixtures/language-app/locales/ru.yml +4 -0
- data/fixtures/language-app/source/2013-09-07-english-article-with-lang-in-frontmatter.html.erb +6 -0
- data/fixtures/language-app/source/2013-09-07-russian-article-with-lang-in-frontmatter.html.erb +6 -0
- data/fixtures/language-app/source/en/2013-09-07-english-article-with-lang-in-path.html.erb +5 -0
- data/fixtures/language-app/source/layouts/layout.erb +8 -0
- data/fixtures/language-app/source/localizable/index.html.erb +5 -0
- data/fixtures/language-app/source/ru/2013-09-07-russian-article-with-lang-in-path.html.erb +5 -0
- data/fixtures/multiblog-app/source/blog1/index.html.erb +7 -0
- data/fixtures/permalink-data-app/config.rb +5 -0
- data/fixtures/permalink-data-app/source/index.html.erb +3 -0
- data/fixtures/permalink-data-app/source/layout.erb +14 -0
- data/fixtures/permalink-data-app/source/news/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/time-zone-app/source/blog/2013-06-24-hello.html.erb +1 -0
- data/lib/middleman-blog.rb +3 -8
- data/lib/middleman-blog/blog_article.rb +96 -60
- data/lib/middleman-blog/blog_data.rb +78 -76
- data/lib/middleman-blog/calendar_pages.rb +87 -119
- data/lib/middleman-blog/commands/article.rb +20 -14
- data/lib/middleman-blog/custom_pages.rb +30 -64
- data/lib/middleman-blog/extension.rb +175 -0
- data/lib/middleman-blog/helpers.rb +152 -0
- data/lib/middleman-blog/paginator.rb +127 -123
- data/lib/middleman-blog/tag_pages.rb +27 -45
- data/lib/middleman-blog/template.rb +17 -15
- data/lib/middleman-blog/template/config.tt +30 -33
- data/lib/middleman-blog/template/source/layout.erb +1 -0
- data/lib/middleman-blog/uri_templates.rb +58 -0
- data/lib/middleman-blog/version.rb +1 -1
- data/middleman-blog.gemspec +4 -1
- metadata +75 -9
- data/Gemfile-3.0 +0 -27
- data/lib/middleman-blog/extension_3_0.rb +0 -248
- data/lib/middleman-blog/extension_3_1.rb +0 -278
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08ba0a40e858e3199220173897c437db62c6513e
|
4
|
+
data.tar.gz: 9d38d7176eb91b89ad0c8f125a2271553d3dbacc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 888e2bf9c611950366eeb2c65d2cee9f08914d0e0ceec9acdb65f42a940f581b23aedcf38cacf5108005f19009263f607b39a0ae6308c899d391be8aa6d5da50
|
7
|
+
data.tar.gz: 18a3c29946fc65bf638b736a8fde6873ebc67eb9e9c99491e2dbd11598d37e0705795ec0e16a21d2bd50b99ff70d5acf3a273e4fa1807d36ac33a01fe640888d
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,35 @@
|
|
1
1
|
master
|
2
2
|
===
|
3
3
|
|
4
|
+
* Add support for internationalization and locale-specific articles. #156
|
5
|
+
* Drop support for Ruby 1.8 and Middleman 3.0.
|
6
|
+
* Removed backwards compatibility patch that set instance variables for tag and calendar pages. Use locals instead.
|
7
|
+
* Templated paths like :sources, :taglink, :year_link, :month_link, :day_link, :page_link, and custom_collections links can now be optionally expressed as RFC 6570 URI templates.
|
8
|
+
* Arbitrary data from page frontmatter can be used in the :permalink template. Simply add a key to your :permalink template that matches a field from your frontmatter.
|
9
|
+
* Data extracted from the :sources URL template can be used in the :permalink template. This information can also be used from templates via current_article.metadata[:page][<key>].
|
10
|
+
* UTF-8 strings substituted into URLs are now preserved rather than being omitted. #176
|
11
|
+
* "middleman article" command now works even when there are multiple blogs. Specify the blog you want using "--blog".
|
12
|
+
* The template used to generate new articles via "middleman article" can be overridden by setting :new_article_template.
|
13
|
+
* Removed `:blog_name`, `:blog_author`, `:blog_avatar` options and the `page_title` helper.
|
14
|
+
|
15
|
+
3.4.1
|
16
|
+
====
|
17
|
+
|
18
|
+
* Require Middleman 3.2
|
19
|
+
|
20
|
+
3.4.0
|
21
|
+
====
|
22
|
+
|
23
|
+
* Add `inspect` methods to `BlogData` and `BlogArticle` to avoid hangs on exceptions. #157
|
24
|
+
* Generated feed.xml now works on blogs with no posts. #155
|
25
|
+
* No longer depend on `middleman-more`.
|
26
|
+
* Don't try to replace tokens that don't exist in the source path. #161
|
27
|
+
* Support for including arbitrary frontmatter data in blog permalinks. #164
|
28
|
+
* When using multiblog, fail immediately if the blog name isn't specified. #168
|
29
|
+
|
30
|
+
3.3.0
|
31
|
+
====
|
32
|
+
|
4
33
|
* Experimental support for multiple blogs in a single site by activating
|
5
34
|
`:blog` multiple times.
|
6
35
|
* Works as a Middleman 3.1-style extension.
|
@@ -18,12 +47,14 @@ master
|
|
18
47
|
* Fix setting time zone with `set :time_zone` in `config.rb`. #140
|
19
48
|
* Articles can omit their :title from the filename and specify it in frontmatter
|
20
49
|
instead. #148
|
50
|
+
* Pages can choose which blog to use in multi-blog mode by specifying the correct
|
51
|
+
blog in frontmatter. #150
|
21
52
|
|
22
53
|
3.2.0
|
23
54
|
====
|
24
55
|
|
25
56
|
* The `summary` method on articles is now HTML-aware, and can be provided with
|
26
|
-
a different summary length or ellipsis string: `summary(1000, '…')`.
|
57
|
+
a different summary length or ellipsis string: `summary(1000, '…')`.
|
27
58
|
Nokogiri is required to use the summary.
|
28
59
|
* The `summary_generator` option now recieves the rendered article (without
|
29
60
|
layout) instead of the template source.
|
data/Gemfile
CHANGED
@@ -5,7 +5,7 @@ gem "middleman-core", :github => "middleman/middleman"
|
|
5
5
|
# Specify your gem's dependencies in middleman-blog.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem "rake", "~> 10.0
|
8
|
+
gem "rake", "~> 10.1.0", :require => false
|
9
9
|
gem "yard", "~> 0.8.0", :require => false
|
10
10
|
|
11
11
|
# Test tools
|
@@ -15,18 +15,14 @@ gem "aruba", "~> 0.5.1"
|
|
15
15
|
gem "rspec", "~> 2.12"
|
16
16
|
gem "simplecov"
|
17
17
|
|
18
|
-
gem "timecop", "~> 0.
|
19
|
-
gem "nokogiri"
|
18
|
+
gem "timecop", "~> 0.6.3"
|
19
|
+
gem "nokogiri"
|
20
20
|
gem "kramdown"
|
21
21
|
|
22
22
|
# Code Quality
|
23
23
|
gem "cane", :platforms => [:mri_19, :mri_20], :require => false
|
24
|
+
gem 'coveralls', :require => false
|
24
25
|
|
25
26
|
platforms :ruby do
|
26
|
-
gem "redcarpet",
|
27
|
-
end
|
28
|
-
|
29
|
-
# Cross-templating language block fix for Ruby 1.8
|
30
|
-
platforms :mri_18 do
|
31
|
-
gem "ruby18_source_location"
|
27
|
+
gem "redcarpet", "~> 3.0"
|
32
28
|
end
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ Additionally, up-to-date generated code documentation is available on [RubyDoc].
|
|
31
31
|
[][travis]
|
32
32
|
[][gemnasium]
|
33
33
|
[][codeclimate]
|
34
|
-
|
34
|
+
[][coveralls]
|
35
35
|
## Community
|
36
36
|
|
37
37
|
The official community forum is available at: http://forum.middlemanapp.com
|
@@ -62,5 +62,6 @@ Copyright (c) 2010-2013 Thomas Reynolds. MIT Licensed, see [LICENSE] for details
|
|
62
62
|
[travis]: http://travis-ci.org/middleman/middleman-blog
|
63
63
|
[gemnasium]: https://gemnasium.com/middleman/middleman-blog
|
64
64
|
[codeclimate]: https://codeclimate.com/github/middleman/middleman-blog
|
65
|
+
[coveralls]: https://coveralls.io/r/middleman/middleman-blog
|
65
66
|
[rubydoc]: http://rubydoc.info/github/middleman/middleman-blog
|
66
|
-
[LICENSE]: https://github.com/middleman/middleman-blog/blob/master/LICENSE.md
|
67
|
+
[LICENSE]: https://github.com/middleman/middleman-blog/blob/master/LICENSE.md
|
@@ -4,4 +4,13 @@ Feature: New article CLI command
|
|
4
4
|
And I run `middleman article "My New Article" --date 2012-03-17`
|
5
5
|
Then the exit status should be 0
|
6
6
|
Then the following files should exist:
|
7
|
-
| source/blog/2012-03-17-my-new-article.html.markdown |
|
7
|
+
| source/blog/2012-03-17-my-new-article.html.markdown |
|
8
|
+
And the file "source/blog/2012-03-17-my-new-article.html.markdown" should contain "tags"
|
9
|
+
|
10
|
+
Scenario: Create a new blog article with the CLI using a custom template
|
11
|
+
Given a fixture app "custom-article-template-app"
|
12
|
+
And I run `middleman article "My New Article" --date 2012-03-17`
|
13
|
+
Then the exit status should be 0
|
14
|
+
Then the following files should exist:
|
15
|
+
| source/2012-03-17-my-new-article.html.markdown |
|
16
|
+
And the file "source/2012-03-17-my-new-article.html.markdown" should contain "From a template!"
|
@@ -68,3 +68,14 @@ Feature: Custom collection pages
|
|
68
68
|
When I go to "/blog/categories/ruby-on-rails.html"
|
69
69
|
Then I should see "/2011-01-01-new-article.html"
|
70
70
|
Then I should not see "/2011-01-02-another-article.html"
|
71
|
+
|
72
|
+
Scenario: Collection property can use source path data
|
73
|
+
Given the Server is running at "custom-collections-sources-app"
|
74
|
+
When I go to "/categories/news.html"
|
75
|
+
Then I should see "/2011-01-01-new-article.html"
|
76
|
+
Then I should not see "/2011-01-02-another-article.html"
|
77
|
+
When I go to "/categories/articles.html"
|
78
|
+
Then I should not see "/2011-01-01-new-article.html"
|
79
|
+
Then I should see "/2011-01-02-another-article.html"
|
80
|
+
When I go to "/index.html"
|
81
|
+
Then I should see "Category Path: '/categories/articles.html'"
|
@@ -0,0 +1,82 @@
|
|
1
|
+
Feature: Internationalized articles
|
2
|
+
Scenario: Article has lang in frontmatter
|
3
|
+
Given the Server is running at "language-app"
|
4
|
+
When I go to "/index.html"
|
5
|
+
Then I should see "Some text in English. All is OK."
|
6
|
+
Then I should not see "Некоторый текст на русском языке. Всё отлично."
|
7
|
+
When I go to "/ru/index.html"
|
8
|
+
Then I should see "Некоторый текст на русском языке. Всё отлично."
|
9
|
+
Then I should not see "Some text in English. All is OK."
|
10
|
+
|
11
|
+
Scenario: Article has lang in path
|
12
|
+
Given a fixture app "language-app"
|
13
|
+
And a file named "config.rb" with:
|
14
|
+
"""
|
15
|
+
activate :i18n
|
16
|
+
activate :blog, prefix: ":lang"
|
17
|
+
"""
|
18
|
+
Given the Server is running at "language-app"
|
19
|
+
When I go to "/index.html"
|
20
|
+
Then I should see "Some text in English. All is OK."
|
21
|
+
Then I should not see "Некоторый текст на русском языке. Всё отлично."
|
22
|
+
When I go to "/ru/index.html"
|
23
|
+
Then I should see "Некоторый текст на русском языке. Всё отлично."
|
24
|
+
Then I should not see "Some text in English. All is OK."
|
25
|
+
|
26
|
+
Scenario: Custom locales in articles
|
27
|
+
Given a fixture app "language-app"
|
28
|
+
And a file named "config.rb" with:
|
29
|
+
"""
|
30
|
+
activate :i18n
|
31
|
+
activate :blog, preserve_locale: true
|
32
|
+
"""
|
33
|
+
Given the Server is running at "language-app"
|
34
|
+
When I go to "/index.html"
|
35
|
+
Then I should see "Some text in English. All is OK."
|
36
|
+
When I go to "/ru/index.html"
|
37
|
+
Then I should see "Некоторый текст на русском языке. Всё OK."
|
38
|
+
|
39
|
+
Scenario: Layout's locale match article's locale on article page
|
40
|
+
Given a fixture app "language-app"
|
41
|
+
Given the Server is running at "language-app"
|
42
|
+
When I go to "/2013/09/07/english-article-with-lang-in-frontmatter.html"
|
43
|
+
Then I should see "Language: en"
|
44
|
+
Then I should see "Hello, world!"
|
45
|
+
Then I should not see "Язык: ru"
|
46
|
+
Then I should not see "Привет, мир!"
|
47
|
+
When I go to "/2013/09/07/russian-article-with-lang-in-frontmatter.html"
|
48
|
+
Then I should see "Язык: ru"
|
49
|
+
Then I should see "Привет, мир!"
|
50
|
+
Then I should not see "Language: en"
|
51
|
+
Then I should not see "Hello, world!"
|
52
|
+
|
53
|
+
Scenario: Custom locales on article pages
|
54
|
+
Given a fixture app "language-app"
|
55
|
+
And a file named "config.rb" with:
|
56
|
+
"""
|
57
|
+
activate :i18n
|
58
|
+
activate :blog, preserve_locale: true
|
59
|
+
"""
|
60
|
+
Given the Server is running at "language-app"
|
61
|
+
When I go to "/2013/09/07/english-article-with-lang-in-frontmatter.html"
|
62
|
+
Then I should see "Language: en"
|
63
|
+
Then I should see "Hello, world!"
|
64
|
+
Then I should not see "Язык: ru"
|
65
|
+
Then I should not see "Привет, мир!"
|
66
|
+
When I go to "/2013/09/07/russian-article-with-lang-in-frontmatter.html"
|
67
|
+
Then I should see "Language: en"
|
68
|
+
Then I should see "Hello, world!"
|
69
|
+
Then I should not see "Язык: ru"
|
70
|
+
Then I should not see "Привет, мир!"
|
71
|
+
|
72
|
+
Scenario: Creating article with lang from CLI
|
73
|
+
Given a fixture app "language-app"
|
74
|
+
And a file named "config.rb" with:
|
75
|
+
"""
|
76
|
+
activate :i18n
|
77
|
+
activate :blog, prefix: ":lang"
|
78
|
+
"""
|
79
|
+
And I run `middleman article "My New Article" --date 2013-09-07 --lang ru`
|
80
|
+
Then the exit status should be 0
|
81
|
+
Then the following files should exist:
|
82
|
+
| source/ru/2013-09-07-my-new-article.html.markdown |
|
data/features/multiblog.feature
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
@three_one
|
2
2
|
|
3
3
|
Feature: Host Multiple Blogs with Middleman 3.1+
|
4
|
-
|
4
|
+
|
5
5
|
Scenario: Preview
|
6
6
|
Given a fixture app "multiblog-app"
|
7
7
|
And a file named "config.rb" with:
|
8
8
|
"""
|
9
|
-
activate :blog, :name => "blog_number_1", :prefix => "blog1", :sources => ":year-:month-:day-:title.html"
|
9
|
+
activate :blog, :name => "blog_number_1", :prefix => "blog1", :sources => ":year-:month-:day-:title.html", :paginate => true
|
10
10
|
|
11
11
|
activate :blog do |blog|
|
12
12
|
blog.name = "blog_number_2"
|
@@ -24,6 +24,8 @@ Feature: Host Multiple Blogs with Middleman 3.1+
|
|
24
24
|
Then I should see "blog_number_1 title: Other Article"
|
25
25
|
Then I should see "blog_number_2 length: 1"
|
26
26
|
Then I should see "blog_number_2 title: Newer Article"
|
27
|
+
When I go to "/blog1/index.html"
|
28
|
+
Then I should see "Paginate: true"
|
27
29
|
|
28
30
|
Scenario: Build
|
29
31
|
Given a fixture app "multiblog-app"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Permalinks can include arbitrary data from frontmatter
|
2
|
+
|
3
|
+
Scenario: Articles list links using permalink with frontmatter data
|
4
|
+
Given the Server is running at "permalink-data-app"
|
5
|
+
When I go to "/index.html"
|
6
|
+
Then I should see "news/a-custom-string-2011-01-01-new-article.html"
|
7
|
+
|
8
|
+
Scenario: Articles can be accessed through permalinks with frontmatter data
|
9
|
+
Given the Server is running at "permalink-data-app"
|
10
|
+
When I go to "news/a-custom-string-2011-01-01-new-article.html"
|
11
|
+
Then I should see "Newer Article Content"
|
12
|
+
And I should see "Category: news"
|
data/features/summary.feature
CHANGED
@@ -41,3 +41,16 @@ Feature: Article summary generation
|
|
41
41
|
When I go to "/index.html"
|
42
42
|
Then I should see "Summary from article with no summary separator and comments in the summary."
|
43
43
|
Then I should not see "Extended part from article from article with no summary separator and comments in the summary."
|
44
|
+
|
45
|
+
Scenario: Summary is only limited by a optional summary separator and not by length
|
46
|
+
Given a fixture app "summary-app"
|
47
|
+
And a file named "config.rb" with:
|
48
|
+
"""
|
49
|
+
activate :blog do |blog|
|
50
|
+
blog.summary_length = -1
|
51
|
+
end
|
52
|
+
"""
|
53
|
+
Given the Server is running at "summary-app"
|
54
|
+
When I go to "/index.html"
|
55
|
+
Then I should see "Extended part from article with no separator."
|
56
|
+
Then I should not see "Extended part from article with separator."
|
data/features/support/env.rb
CHANGED
data/features/tags.feature
CHANGED
@@ -49,7 +49,7 @@ Feature: Tag pages
|
|
49
49
|
Then I should see "Not Found"
|
50
50
|
And the file "source/blog/2011-01-01-new-article.html.markdown" has the contents
|
51
51
|
"""
|
52
|
-
---
|
52
|
+
---
|
53
53
|
title: "Newest Article"
|
54
54
|
date: 2011-01-01
|
55
55
|
tags: newtag
|
@@ -61,3 +61,20 @@ Feature: Tag pages
|
|
61
61
|
Then I should see "Not Found"
|
62
62
|
When I go to "/tags/newtag.html"
|
63
63
|
Then I should see "/2011-01-01-new-article.html"
|
64
|
+
|
65
|
+
Scenario: Adding a non-ASCII tag to a post in preview adds a tag page
|
66
|
+
Given the Server is running at "tags-app"
|
67
|
+
When I go to "/tags/☆☆☆.html"
|
68
|
+
Then I should see "Not Found"
|
69
|
+
And the file "source/blog/2011-01-01-new-article.html.markdown" has the contents
|
70
|
+
"""
|
71
|
+
---
|
72
|
+
title: "Newest Article"
|
73
|
+
date: 2011-01-01
|
74
|
+
tags: ☆☆☆
|
75
|
+
---
|
76
|
+
|
77
|
+
Newer Article Content
|
78
|
+
"""
|
79
|
+
When I go to "/tags/☆☆☆.html"
|
80
|
+
Then I should see "/2011-01-01-new-article.html"
|
data/features/time_zone.feature
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
<% data.blog.articles[0...5].each_with_index do |article, i| %>
|
2
|
+
<article class="<%= (i == 0) ? 'first' : '' %>">
|
3
|
+
<h1><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e %Y') %></span></h1>
|
4
|
+
|
5
|
+
<%= article.summary %>
|
6
|
+
|
7
|
+
<div class="more"><a href="<%= article.url %>">read on »</a></div>
|
8
|
+
</article>
|
9
|
+
<% end %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta http-equiv='X-UA-Compatible' content='IE=edge;chrome=1' />
|
6
|
+
|
7
|
+
<% if is_blog_article? %>
|
8
|
+
<title><%= current_article.title %></title>
|
9
|
+
<% end %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
|
13
|
+
<div id="main" role="main">
|
14
|
+
<% if is_blog_article? %>
|
15
|
+
<article class="hentry">
|
16
|
+
<h1 class="entry-title">
|
17
|
+
<%= current_article.title %>
|
18
|
+
<time class="updated"><%= current_article.date.strftime('%b %e %Y') %></time>
|
19
|
+
</h1>
|
20
|
+
|
21
|
+
<div class="entry-content">
|
22
|
+
<%= yield %>
|
23
|
+
</div>
|
24
|
+
</article>
|
25
|
+
<% else %>
|
26
|
+
<%= yield %>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
activate :blog do |blog|
|
2
|
+
blog.sources = ":category/:year-:month-:day-:title.html"
|
3
|
+
blog.permalink = "blog/:year-:month-:day-:title.html"
|
4
|
+
|
5
|
+
blog.custom_collections = {
|
6
|
+
:category => {
|
7
|
+
:link => '/categories/:category.html',
|
8
|
+
:template => '/category.html'
|
9
|
+
}
|
10
|
+
}
|
11
|
+
end
|