middleman-blog 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/.travis.yml +5 -7
- data/CHANGELOG.md +21 -0
- data/CONTRIBUTING.md +43 -0
- data/Gemfile +22 -14
- data/Gemfile-3.0 +27 -0
- data/{LICENSE → LICENSE.md} +2 -2
- data/README.md +33 -28
- data/Rakefile +17 -1
- data/features/blog_sources.feature +13 -0
- data/features/calendar_multiblog.feature +153 -0
- data/features/multiblog.feature +51 -0
- data/features/paginate_multiblog.feature +270 -0
- data/features/summary.feature +43 -0
- data/features/support/env.rb +6 -1
- data/features/tags_multiblog.feature +125 -0
- data/features/time_zone.feature +5 -0
- data/fixtures/blog-sources-app/source/blog/2013-08-08-slug-from-filename.html.markdown +7 -0
- data/fixtures/calendar-multiblog-app/config.rb +17 -0
- data/fixtures/calendar-multiblog-app/source/blog1/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/calendar-multiblog-app/source/blog1/2011-01-02-another-article.html.markdown +8 -0
- data/fixtures/calendar-multiblog-app/source/blog2/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/calendar-multiblog-app/source/blog2/2011-01-02-another-article.html.markdown +8 -0
- data/fixtures/calendar-multiblog-app/source/calendar1.html.erb +13 -0
- data/fixtures/calendar-multiblog-app/source/calendar2.html.erb +13 -0
- data/fixtures/calendar-multiblog-app/source/index.html.erb +15 -0
- data/fixtures/calendar-multiblog-app/source/layout.erb +15 -0
- data/fixtures/default-template-app/Gemfile +6 -0
- data/fixtures/default-template-app/config.rb +35 -0
- data/fixtures/default-template-app/source/2013-04-01-new-article.html.markdown +25 -0
- data/{features/encoding.feature → fixtures/default-template-app/source/about-me.html.erb} +0 -0
- data/fixtures/default-template-app/source/archives.html.erb +10 -0
- data/fixtures/default-template-app/source/index.html.erb +11 -0
- data/fixtures/default-template-app/source/javascripts/_zepto.pjax.js +744 -0
- data/fixtures/default-template-app/source/javascripts/app.js +11 -0
- data/fixtures/default-template-app/source/javascripts/modernizr.js +1 -0
- data/fixtures/default-template-app/source/layouts/layout.erb +62 -0
- data/fixtures/default-template-app/source/stylesheets/app.css.scss +109 -0
- data/fixtures/multiblog-app/config.rb +0 -0
- data/fixtures/multiblog-app/source/blog1/2012-12-12-other-article.html.markdown +5 -0
- data/fixtures/multiblog-app/source/blog2/2011/01/01/new-article.html.markdown +6 -0
- data/fixtures/multiblog-app/source/index.html.erb +7 -0
- data/fixtures/multiblog-app/source/layout.erb +30 -0
- data/fixtures/no-title-app/config.rb +3 -0
- data/fixtures/no-title-app/source/2013-08-07.html.markdown +6 -0
- data/fixtures/no-title-app/source/2013-08-08.html.markdown +7 -0
- data/fixtures/no-title-app/source/layout.erb +13 -0
- data/fixtures/paginate-multiblog-app/config.rb +31 -0
- data/fixtures/paginate-multiblog-app/source/blog1/2011-01-01-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog1/2011-01-02-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog1/2011-01-03-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog1/2011-01-04-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog1/2011-01-05-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog1/2011-02-01-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog1/index.html.erb +27 -0
- data/fixtures/paginate-multiblog-app/source/blog2/2011-01-01-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog2/2011-01-02-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog2/2011-01-03-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog2/2011-01-04-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog2/2011-01-05-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog2/index.html.erb +27 -0
- data/fixtures/paginate-multiblog-app/source/blog3/2011-01-01-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog3/2011-01-02-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog3/2011-01-03-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog3/2011-01-04-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog3/2011-01-05-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog3/2011-02-01-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog3/2011-02-02-test-article.html.markdown +6 -0
- data/fixtures/paginate-multiblog-app/source/blog3/index.html.erb +28 -0
- data/fixtures/paginate-multiblog-app/source/calendar1.html.erb +28 -0
- data/fixtures/paginate-multiblog-app/source/calendar2.html.erb +28 -0
- data/fixtures/paginate-multiblog-app/source/calendar3.html.erb +28 -0
- data/fixtures/paginate-multiblog-app/source/layout.erb +15 -0
- data/fixtures/paginate-multiblog-app/source/tag1.html.erb +23 -0
- data/fixtures/paginate-multiblog-app/source/tag2.html.erb +23 -0
- data/fixtures/paginate-multiblog-app/source/tag3.html.erb +19 -0
- data/fixtures/summary-app/config.rb +1 -0
- data/fixtures/summary-app/source/2011-01-01-article-with-no-summary-separator-and-comments-in-the-summary.html.erb +10 -0
- data/fixtures/summary-app/source/2011-01-01-article-with-standard-summary-separator.html.markdown +7 -0
- data/fixtures/summary-app/source/2012-06-19-article-with-no-summary-separator.html.markdown +9 -0
- data/fixtures/summary-app/source/2013-05-08-article-with-custom-separator.html.markdown +7 -0
- data/fixtures/summary-app/source/index.html.erb +5 -0
- data/fixtures/tags-multiblog-app/config.rb +15 -0
- data/fixtures/tags-multiblog-app/source/blog1/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/tags-multiblog-app/source/blog1/2011-01-02-another-article.html.markdown +9 -0
- data/fixtures/tags-multiblog-app/source/blog2/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/tags-multiblog-app/source/blog2/2011-01-02-another-article.html.markdown +9 -0
- data/fixtures/tags-multiblog-app/source/index.html.erb +8 -0
- data/fixtures/tags-multiblog-app/source/layout.erb +13 -0
- data/fixtures/tags-multiblog-app/source/tag1.html.erb +7 -0
- data/fixtures/tags-multiblog-app/source/tag2.html.erb +7 -0
- data/fixtures/time-zone-app/config.rb +5 -0
- data/fixtures/time-zone-app/source/blog/2013-06-24-hello.html.erb +5 -0
- data/lib/middleman-blog.rb +9 -4
- data/lib/middleman-blog/blog_article.rb +47 -21
- data/lib/middleman-blog/blog_data.rb +11 -4
- data/lib/middleman-blog/calendar_pages.rb +40 -25
- data/lib/middleman-blog/{extension.rb → extension_3_0.rb} +20 -16
- data/lib/middleman-blog/extension_3_1.rb +208 -0
- data/lib/middleman-blog/paginator.rb +33 -7
- data/lib/middleman-blog/tag_pages.rb +26 -9
- data/lib/middleman-blog/template/shared/Gemfile.tt +4 -2
- data/lib/middleman-blog/template/source/calendar.html.erb +1 -1
- data/lib/middleman-blog/template/source/feed.xml.builder +8 -7
- data/lib/middleman-blog/template/source/index.html.erb +1 -1
- data/lib/middleman-blog/template/source/tag.html.erb +1 -1
- data/lib/middleman-blog/truncate_html.rb +10 -1
- data/lib/middleman-blog/version.rb +1 -1
- data/middleman-blog.gemspec +12 -15
- metadata +180 -14
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
blog: blog_name_3
|
3
|
+
pageable: false
|
4
|
+
---
|
5
|
+
Index: blog3
|
6
|
+
|
7
|
+
Paginate3: <%= paginate %>
|
8
|
+
Article Count3: <%= page_articles.size %>
|
9
|
+
<% if paginate %>
|
10
|
+
Page Num3: <%= page_number %>
|
11
|
+
Num Pages3: <%= num_pages %>
|
12
|
+
Per Page3: <%= per_page %>
|
13
|
+
Page Start3: <%= page_start %>
|
14
|
+
Page End3: <%= page_end %>
|
15
|
+
Next Page3: '<%= next_page.url if next_page %>'
|
16
|
+
Prev Page3: '<%= prev_page.url if prev_page %>'
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%# Page articles doesn't scope correctly if pageable isn't specified.%>
|
20
|
+
<% page_articles.each_with_index do |article, i| %>
|
21
|
+
<article class="<%= (i == 0) ? 'first' : '' %>">
|
22
|
+
<h1><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e %Y') %></span></h1>
|
23
|
+
|
24
|
+
<%= article.summary %>
|
25
|
+
|
26
|
+
<div class="more"><a href="<%= article.url %>">read on »</a></div>
|
27
|
+
</article>
|
28
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
pageable: true
|
3
|
+
---
|
4
|
+
Year1: '<%= year %>'
|
5
|
+
Month1: '<%= month if defined?(month) %>'
|
6
|
+
Day1: '<%= day if defined?(day) %>'
|
7
|
+
|
8
|
+
Paginate1: <%= paginate %>
|
9
|
+
Article Count1: <%= page_articles.size %>
|
10
|
+
<% if paginate %>
|
11
|
+
Page Num1: <%= page_number %>
|
12
|
+
Num Pages1: <%= num_pages %>
|
13
|
+
Per Page1: <%= per_page %>
|
14
|
+
Page Start1: <%= page_start %>
|
15
|
+
Page End1: <%= page_end %>
|
16
|
+
Next Page1: '<%= next_page.url if next_page %>'
|
17
|
+
Prev Page1: '<%= prev_page.url if prev_page %>'
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% page_articles.each_with_index do |article, i| %>
|
21
|
+
<article class="<%= (i == 0) ? 'first' : '' %>">
|
22
|
+
<h1><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e %Y') %></span></h1>
|
23
|
+
|
24
|
+
<%= article.summary %>
|
25
|
+
|
26
|
+
<div class="more"><a href="<%= article.url %>">read on »</a></div>
|
27
|
+
</article>
|
28
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
pageable: true
|
3
|
+
---
|
4
|
+
Year2: '<%= year %>'
|
5
|
+
Month2: '<%= month if defined?(month) %>'
|
6
|
+
Day2: '<%= day if defined?(day) %>'
|
7
|
+
|
8
|
+
Paginate2: <%= paginate %>
|
9
|
+
Article Count2: <%= page_articles.size %>
|
10
|
+
<% if paginate %>
|
11
|
+
Page Num2: <%= page_number %>
|
12
|
+
Num Pages2: <%= num_pages %>
|
13
|
+
Per Page2: <%= per_page %>
|
14
|
+
Page Start2: <%= page_start %>
|
15
|
+
Page End2: <%= page_end %>
|
16
|
+
Next Page2: '<%= next_page.url if next_page %>'
|
17
|
+
Prev Page2: '<%= prev_page.url if prev_page %>'
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% page_articles.each_with_index do |article, i| %>
|
21
|
+
<article class="<%= (i == 0) ? 'first' : '' %>">
|
22
|
+
<h1><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e %Y') %></span></h1>
|
23
|
+
|
24
|
+
<%= article.summary %>
|
25
|
+
|
26
|
+
<div class="more"><a href="<%= article.url %>">read on »</a></div>
|
27
|
+
</article>
|
28
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
pageable: true
|
3
|
+
---
|
4
|
+
Year3: '<%= year %>'
|
5
|
+
Month3: '<%= month if defined?(month) %>'
|
6
|
+
Day3: '<%= day if defined?(day) %>'
|
7
|
+
|
8
|
+
Paginate3: <%= paginate %>
|
9
|
+
Article Count3: <%= page_articles.size %>
|
10
|
+
<% if paginate %>
|
11
|
+
Page Num3: <%= page_number %>
|
12
|
+
Num Pages3: <%= num_pages %>
|
13
|
+
Per Page3: <%= per_page %>
|
14
|
+
Page Start3: <%= page_start %>
|
15
|
+
Page End3: <%= page_end %>
|
16
|
+
Next Page3: '<%= next_page.url if next_page %>'
|
17
|
+
Prev Page3: '<%= prev_page.url if prev_page %>'
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% page_articles.each_with_index do |article, i| %>
|
21
|
+
<article class="<%= (i == 0) ? 'first' : '' %>">
|
22
|
+
<h1><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e %Y') %></span></h1>
|
23
|
+
|
24
|
+
<%= article.summary %>
|
25
|
+
|
26
|
+
<div class="more"><a href="<%= article.url %>">read on »</a></div>
|
27
|
+
</article>
|
28
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<% if is_blog_article? %>
|
7
|
+
<%= yield %>
|
8
|
+
Url: <%= current_article.url %>
|
9
|
+
Previous: <%= current_article.previous_article.try(:url) %>
|
10
|
+
Next: <%= current_article.next_article.try(:url) %>
|
11
|
+
<% else %>
|
12
|
+
<%= yield %>
|
13
|
+
<% end %>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
pageable: true
|
3
|
+
per_page: 2
|
4
|
+
---
|
5
|
+
Tag1: <%= tagname %>
|
6
|
+
|
7
|
+
Paginate1: <%= paginate %>
|
8
|
+
Article Count1: <%= page_articles.size %>
|
9
|
+
<% if paginate %>
|
10
|
+
Page Num1: <%= page_number %>
|
11
|
+
Num Pages1: <%= num_pages %>
|
12
|
+
Per Page1: <%= per_page %>
|
13
|
+
Page Start1: <%= page_start %>
|
14
|
+
Page End1: <%= page_end %>
|
15
|
+
Next Page1: '<%= next_page.url if next_page %>'
|
16
|
+
Prev Page1: '<%= prev_page.url if prev_page %>'
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<% if page_articles %>
|
20
|
+
<% page_articles.each do |article| %>
|
21
|
+
<li><a href="<%= article.url %>"><%= article.title %></a> <time><%= article.date.strftime('%b %e') %></time></li>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
pageable: true
|
3
|
+
per_page: 1
|
4
|
+
---
|
5
|
+
Tag2: <%= tagname %>
|
6
|
+
|
7
|
+
Paginate2: <%= paginate %>
|
8
|
+
Article Count2: <%= page_articles.size %>
|
9
|
+
<% if paginate %>
|
10
|
+
Page Num2: <%= page_number %>
|
11
|
+
Num Pages2: <%= num_pages %>
|
12
|
+
Per Page2: <%= per_page %>
|
13
|
+
Page Start2: <%= page_start %>
|
14
|
+
Page End2: <%= page_end %>
|
15
|
+
Next Page2: '<%= next_page.url if next_page %>'
|
16
|
+
Prev Page2: '<%= prev_page.url if prev_page %>'
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<% if page_articles %>
|
20
|
+
<% page_articles.each do |article| %>
|
21
|
+
<li><a href="<%= article.url %>"><%= article.title %></a> <time><%= article.date.strftime('%b %e') %></time></li>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Tag3: <%= tagname %>
|
2
|
+
|
3
|
+
Paginate3: <%= paginate %>
|
4
|
+
Article Count3: <%= page_articles.size %>
|
5
|
+
<% if paginate %>
|
6
|
+
Page Num3: <%= page_number %>
|
7
|
+
Num Pages3: <%= num_pages %>
|
8
|
+
Per Page3: <%= per_page %>
|
9
|
+
Page Start3: <%= page_start %>
|
10
|
+
Page End3: <%= page_end %>
|
11
|
+
Next Page3: '<%= next_page.url if next_page %>'
|
12
|
+
Prev Page3: '<%= prev_page.url if prev_page %>'
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<% if page_articles %>
|
16
|
+
<% page_articles.each do |article| %>
|
17
|
+
<li><a href="<%= article.url %>"><%= article.title %></a> <time><%= article.date.strftime('%b %e') %></time></li>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
activate :blog
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
title: "Article with no summary separator and comments in the summary"
|
3
|
+
---
|
4
|
+
|
5
|
+
<p>Summary from article with no summary separator and comments in the summary.</p>
|
6
|
+
|
7
|
+
<p>Lorem ipsum <!-- html comment --> dolor sit amet, consectetur adipiscing elit. Nullam tempus, sem non bibendum placerat, urna augue bibendum lectus, id fringilla ligula turpis semper quam. Mauris malesuada g
|
8
|
+
ravida viverra. Sed quis turpis neque, eu posuere dolor. Integer risus nulla, molestie sit amet convallis eu, vulputate eget ligula. Aenean aliquet euismod magna, convallis ultrices diam tristique in. Suspendisse potenti. In nunc odio, lobortis at ullamcorper sit amet, placerat eget massa. Sed ultrices sapien in sapien vulputate sed tincidunt turpis viverra. Vestibulum aliquam lacus nec ante rutrum tempus nec non nisi. Quisque imperdiet ultricies lectus in feugiat. Praesent vel aliquet odio. Quisque sed dui non metus congue ullamcorper. Donec quis libero tellus. Nulla ullamcorper turpis eget felis facilisis ut tincidunt lorem porta. Integer id quam elit, quis sollicitudin felis. Vestibulum eu arcu orci, a tristique nunc.</p>
|
9
|
+
|
10
|
+
<p>Extended part from article with no summary separator and comments in the summary.</p>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
---
|
2
|
+
title: "Article with no summary separator"
|
3
|
+
---
|
4
|
+
|
5
|
+
Summary from article with no separator.
|
6
|
+
|
7
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam tempus, sem non bibendum placerat, urna augue bibendum lectus, id fringilla ligula turpis semper quam. Mauris malesuada gravida viverra. Sed quis turpis neque, eu posuere dolor. Integer risus nulla, molestie sit amet convallis eu, vulputate eget ligula. Aenean aliquet euismod magna, convallis ultrices diam tristique in. Suspendisse potenti. In nunc odio, lobortis at ullamcorper sit amet, placerat eget massa. Sed ultrices sapien in sapien vulputate sed tincidunt turpis viverra. Vestibulum aliquam lacus nec ante rutrum tempus nec non nisi. Quisque imperdiet ultricies lectus in feugiat. Praesent vel aliquet odio. Quisque sed dui non metus congue ullamcorper. Donec quis libero tellus. Nulla ullamcorper turpis eget felis facilisis ut tincidunt lorem porta. Integer id quam elit, quis sollicitudin felis. Vestibulum eu arcu orci, a tristique nunc.
|
8
|
+
|
9
|
+
Extended part from article with no separator.
|
@@ -0,0 +1,15 @@
|
|
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
|
+
blog.tag_template = "tag1.html"
|
7
|
+
end
|
8
|
+
|
9
|
+
activate :blog do |blog|
|
10
|
+
blog.name = "blog_name_2"
|
11
|
+
blog.prefix = "blog2"
|
12
|
+
blog.sources = ":year-:month-:day-:title.html"
|
13
|
+
blog.permalink = ":year-:month-:day-:title.html"
|
14
|
+
blog.tag_template = "tag2.html"
|
15
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% blog(:blog_name_1).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
|
+
<% blog(:blog_name_2).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
|
+
Tag Path1: '<%= tag_path("fooX", :blog_name_1) %>'
|
8
|
+
Tag Path2: '<%= tag_path("fooX", :blog_name_2) %>'
|
data/lib/middleman-blog.rb
CHANGED
@@ -3,8 +3,13 @@ require "middleman-core"
|
|
3
3
|
require "middleman-blog/version"
|
4
4
|
require "middleman-blog/template"
|
5
5
|
require "middleman-blog/commands/article"
|
6
|
-
|
6
|
+
|
7
7
|
::Middleman::Extensions.register(:blog) do
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
if defined?(::Middleman::Extension)
|
9
|
+
require "middleman-blog/extension_3_1"
|
10
|
+
::Middleman::BlogExtension
|
11
|
+
else
|
12
|
+
require "middleman-blog/extension_3_0"
|
13
|
+
::Middleman::Blog
|
14
|
+
end
|
15
|
+
end
|