middleman-blog 3.5.1 → 3.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9607656cf709f1ad3a4cc7ec060e3c3cd5e73ae3
4
- data.tar.gz: 169bd0122267d51e7768885fdfa3a782d6a7f9af
3
+ metadata.gz: 22770d35db1f34d0390f3f54b1e81f83f82db571
4
+ data.tar.gz: 2881759a6e49a107f918874b861e582dd606091c
5
5
  SHA512:
6
- metadata.gz: 0bacecc695f007c53ba6df3b8dd259768b151b2b783f16a19762dad8fe5a90014c62c453e3c26c31614ebac8c58feb79cdaf85eeecc2eed8daeff8ec48ebe5cb
7
- data.tar.gz: fbc3ce009ad08ccce6c644b4741dde9e36cdb1d4a00ca10514d4bd9afd1fa0218af78ad70f788a3d6d7eb783e2136c6f37d6ff08e5150a509a09b9719ec5351a
6
+ metadata.gz: 50e210cc5210809498128aa105265f4056b39e31af63d0dc37faa18a015dd6b43ca10af5cd89f282bad0775472bace318f6e5aee61573f5763b866ba739fa311
7
+ data.tar.gz: 93fde692a714779f015ec18a2a6fcb46c72eba7912c90b12fdb7d6fd2c7cd15b5cf1efaefc59425ed54b92fc773d6e1f6392ab1adaa7bf38be43c7e944d61868
@@ -1,3 +1,13 @@
1
+ 3.5.2
2
+ ===
3
+
4
+ * Ignored pages won't be processed by the blog extension.
5
+ * Avoid creating an empty-string collection when a post does not have a custom collection property set. #192
6
+ * Fix blog sources matching blog entries that are in a subdirectory that's not explicitly stated as part of the blog.sources template. #196
7
+ * Fixed tag and year links in blog template. #195
8
+ * An article's language can be set via the {lang} parameter in its sources URL template. #187
9
+ * Tags that are just a number work now. #188
10
+
1
11
  3.5.1
2
12
  ===
3
13
 
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "middleman-core", :github => "middleman/middleman"
3
+ gem "middleman-core", :github => "middleman/middleman", :branch => 'v3-stable'
4
4
 
5
5
  # Specify your gem's dependencies in middleman-blog.gemspec
6
6
  gemspec
@@ -25,3 +25,8 @@ Feature: Flexible article sources
25
25
  Given the Server is running at "blog-sources-app"
26
26
  When I go to "/2013/08/08/slug-from-frontmatter.html"
27
27
  Then I should see "Article with slug specified in frontmatter"
28
+
29
+ Scenario: There can be subdirectories in the blog sources dir
30
+ Given the Server is running at "blog-sources-subdirs-app"
31
+ When I go to "/blog.html"
32
+ Then I should see "Yet another post"
@@ -10,6 +10,8 @@ Feature: Custom collection pages
10
10
  Then I should see "/2011-01-02-another-article.html"
11
11
  When I go to "/index.html"
12
12
  Then I should see "Category Path: '/categories/ruby-on-rails.html'"
13
+ When I go to "/categories/.html"
14
+ Then I should see "Not Found"
13
15
 
14
16
  Scenario: Collection pages are accessbile from preview server with directory_indexes
15
17
  Given a fixture app "custom-collections-app"
@@ -0,0 +1,25 @@
1
+ Feature: Files can be ignored from within blog
2
+ Scenario: A file can be ignored
3
+ Given a fixture app "preview-app"
4
+ And a file named "config.rb" with:
5
+ """
6
+ activate :blog do |blog|
7
+ blog.sources = ":year/:month/:day/:title.html"
8
+ end
9
+ ignore '2011/01/02/newer-article.html'
10
+ """
11
+ # This file would give an error if it weren't ignored
12
+ And a file named "source/2011/01/02/newer-article.html.markdown" with:
13
+ """
14
+ ---
15
+ title: "Newer Article"
16
+ date: 2013-01-15
17
+ ---
18
+
19
+ Newer Article Content
20
+ """
21
+ Given the Server is running
22
+ When I go to "/2011/01/01/new-article.html"
23
+ Then I should see "Article"
24
+ When I go to "/2011/01/02/newer-article.html"
25
+ Then I should see "Not Found"
@@ -23,6 +23,14 @@ Feature: Internationalized articles
23
23
  Then I should see "Некоторый текст на русском языке. Всё отлично."
24
24
  Then I should not see "Some text in English. All is OK."
25
25
 
26
+ Scenario: Article has lang in source path
27
+ Given a fixture app "lang-path-app"
28
+ Given the Server is running at "lang-path-app"
29
+ When I go to "/en/a-humble-test.html"
30
+ Then I should see "English!"
31
+ When I go to "/ru/a-humble-test.html"
32
+ Then I should see "Russian!"
33
+
26
34
  Scenario: Custom locales in articles
27
35
  Given a fixture app "language-app"
28
36
  And a file named "config.rb" with:
@@ -9,6 +9,9 @@ Feature: Tag pages
9
9
  Then I should see "/2011-01-01-new-article.html"
10
10
  Then I should not see "/2011-01-02-another-article.html"
11
11
  Then I should see "Tag: bar"
12
+ When I go to "/tags/120.html"
13
+ Then I should see "/2011-01-02-another-article.html"
14
+ Then I should see "Tag: 120"
12
15
  When I go to "/index.html"
13
16
  Then I should see "Tag Path: '/tags/foo.html'"
14
17
 
@@ -0,0 +1,4 @@
1
+ activate :blog do |blog|
2
+ blog.sources = "blog/:title.html"
3
+ blog.permalink = "blog/{title}"
4
+ end
@@ -0,0 +1,3 @@
1
+ <% page_articles.each do |post| %>
2
+ <li><%= link_to post.title, post %></li>
3
+ <% end %>
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: "Another post"
3
+ published: true
4
+ date: 2014/01/15
5
+ ---
6
+
7
+ Lorem ipsum dolor sit amet
8
+
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: "Yet another post"
3
+ published: true
4
+ date: 2014/01/15
5
+ ---
6
+
7
+ Lorem ipsum dolor sit amet
8
+
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: "No category"
3
+ date: 2011-01-03
4
+ ---
5
+
6
+ This post has no category!
@@ -0,0 +1,6 @@
1
+ activate :i18n
2
+
3
+ activate :blog do |blog|
4
+ blog.sources = "blog/{year}-{month}-{day}-{title}.{lang}.html"
5
+ blog.permalink = "{lang}/{title}.html"
6
+ end
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: 'A humble test'
3
+ ---
4
+
5
+ English!
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: 'A humble test'
3
+ ---
4
+
5
+ Russian!
@@ -0,0 +1,6 @@
1
+ <html>
2
+ <head></head>
3
+ <body>
4
+ <%= yield %>
5
+ </body>
6
+ </html>
@@ -1,8 +1,9 @@
1
- ---
1
+ ---
2
2
  title: "Another Article"
3
3
  date: 2011-01-02
4
4
  tags:
5
5
  - foo
6
+ - 120
6
7
  ---
7
8
 
8
9
  Another Article Content
@@ -124,7 +124,7 @@ module Middleman
124
124
  if article_tags.is_a? String
125
125
  article_tags.split(',').map(&:strip)
126
126
  else
127
- Array(article_tags)
127
+ Array(article_tags).map(&:to_s)
128
128
  end
129
129
  end
130
130
 
@@ -136,11 +136,8 @@ module Middleman
136
136
  #
137
137
  # @return [Symbol] Language code (for example, +:en+ or +:de+)
138
138
  def lang
139
- frontmatter_lang = data["lang"]
140
-
141
- if blog_options.sources.include? ":lang"
142
- filename_lang = path_part("lang")
143
- end
139
+ frontmatter_lang = data['lang']
140
+ filename_lang = path_part('lang')
144
141
 
145
142
  if frontmatter_lang && filename_lang && frontmatter_lang != filename_lang
146
143
  raise "The lang in #{path}'s filename (#{filename_lang.inspect}) doesn't match the lang in its frontmatter (#{frontmatter_lang.inspect})"
@@ -232,7 +229,7 @@ module Middleman
232
229
  # @param [String] part The part of the path, e.g. "lang", "year", "month", "day", "title"
233
230
  # @return [String]
234
231
  def path_part(part)
235
- @_path_parts ||= blog_data.source_template.extract(path)
232
+ @_path_parts ||= Blog::UriTemplates.extract_params(blog_data.source_template, path)
236
233
  @_path_parts[part.to_s]
237
234
  end
238
235
  end
@@ -78,6 +78,12 @@ module Middleman
78
78
  used_resources = []
79
79
 
80
80
  resources.each do |resource|
81
+ if resource.ignored?
82
+ # Don't bother blog-processing ignored stuff
83
+ used_resources << resource
84
+ next
85
+ end
86
+
81
87
  if (params = extract_params(@source_template, resource.path))
82
88
  article = convert_to_article(resource)
83
89
  next unless publishable?(article)
@@ -31,7 +31,7 @@ module Middleman
31
31
  desc: "The language to create the post with (defaults to I18n.default_locale if avaliable)"
32
32
  method_option "blog",
33
33
  aliases: "-b",
34
- desc: "The name of the blog to creat the post inside (for multi-blog apps, defaults to the only blog in single-blog apps)"
34
+ desc: "The name of the blog to create the post inside (for multi-blog apps, defaults to the only blog in single-blog apps)"
35
35
  def article(title)
36
36
  shared_instance = ::Middleman::Application.server.inst
37
37
 
@@ -26,7 +26,9 @@ module Middleman
26
26
  end
27
27
 
28
28
  def manipulate_resource_list(resources)
29
- articles_by_property = @blog_data.articles.group_by { |a| a.metadata[:page][property.to_s] }
29
+ articles_by_property = @blog_data.articles.
30
+ select {|a| a.metadata[:page][property.to_s] }.
31
+ group_by {|a| a.metadata[:page][property.to_s] }
30
32
  resources + articles_by_property.map do |property_value, articles|
31
33
  build_resource(link(property_value), property_value, articles)
32
34
  end
@@ -23,14 +23,14 @@
23
23
  <h2>Tags</h2>
24
24
  <ol>
25
25
  <% blog.tags.each do |tag, articles| %>
26
- <li><%= link_to tag, tag_path(tag) %> (<%= articles.size %>)</a></li>
26
+ <li><%= link_to "#{tag} (#{articles.size})", tag_path(tag) %></li>
27
27
  <% end %>
28
28
  </ol>
29
29
 
30
30
  <h2>By Year</h2>
31
31
  <ol>
32
32
  <% blog.articles.group_by {|a| a.date.year }.each do |year, articles| %>
33
- <li><%= link_to year, blog_year_path(year) %> (<%= articles.size %>)</a></li>
33
+ <li><%= link_to "#{year} (#{articles.size})", blog_year_path(year) %></li>
34
34
  <% end %>
35
35
  </ol>
36
36
  </aside>
@@ -49,7 +49,7 @@ module Middleman
49
49
  sep = '-'
50
50
 
51
51
  # Reimplementation of http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-parameterize that preserves un-transliterate-able multibyte chars.
52
- parameterized_string = ActiveSupport::Inflector.transliterate(str).downcase
52
+ parameterized_string = ActiveSupport::Inflector.transliterate(str.to_s).downcase
53
53
  parameterized_string.gsub!(/[^a-z0-9\-_\?]+/, sep)
54
54
 
55
55
  parameterized_string.chars.to_a.each_with_index do |char, i|
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Blog
3
- VERSION = "3.5.1"
3
+ VERSION = "3.5.2"
4
4
  end
5
5
  end
@@ -22,6 +22,10 @@ describe 'Middleman::Blog::UriTemplates' do
22
22
  it "can handle mixed strings" do
23
23
  safe_parameterize('What ☆☆☆!').should == 'what-☆☆☆'
24
24
  end
25
+
26
+ it "can handle numbers" do
27
+ safe_parameterize(1).should == '1'
28
+ end
25
29
  end
26
30
 
27
31
  describe 'extract_params' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -9,48 +9,48 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-16 00:00:00.000000000 Z
12
+ date: 2014-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '3.2'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '3.2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: tzinfo
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.3.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: 0.3.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: addressable
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 2.3.5
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: 2.3.5
56
56
  description: Blog engine for Middleman
@@ -61,10 +61,10 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
- - .gemtest
65
- - .gitignore
66
- - .travis.yml
67
- - .yardopts
64
+ - ".gemtest"
65
+ - ".gitignore"
66
+ - ".travis.yml"
67
+ - ".yardopts"
68
68
  - CHANGELOG.md
69
69
  - CONTRIBUTING.md
70
70
  - Gemfile
@@ -83,6 +83,7 @@ files:
83
83
  - features/directory_indexes.feature
84
84
  - features/filename_date.feature
85
85
  - features/future_date.feature
86
+ - features/ignored_files.feature
86
87
  - features/language.feature
87
88
  - features/layouts.feature
88
89
  - features/multiblog.feature
@@ -110,6 +111,11 @@ files:
110
111
  - fixtures/blog-sources-app/source/blog/2013-08-08-slug-from-filename.html.markdown
111
112
  - fixtures/blog-sources-app/source/index.html.erb
112
113
  - fixtures/blog-sources-app/source/layout.erb
114
+ - fixtures/blog-sources-subdirs-app/config.rb
115
+ - fixtures/blog-sources-subdirs-app/source/blog.html.erb
116
+ - fixtures/blog-sources-subdirs-app/source/blog/another-post.md.erb
117
+ - fixtures/blog-sources-subdirs-app/source/blog/subdir/yet-another-post.md.erb
118
+ - fixtures/blog-sources-subdirs-app/source/layout.erb
113
119
  - fixtures/calendar-and-tag-app/config-directory-indexes.rb
114
120
  - fixtures/calendar-and-tag-app/config.rb
115
121
  - fixtures/calendar-and-tag-app/source/archive.html.erb
@@ -142,6 +148,7 @@ files:
142
148
  - fixtures/custom-collections-app/config.rb
143
149
  - fixtures/custom-collections-app/source/blog/2011-01-01-new-article.html.markdown
144
150
  - fixtures/custom-collections-app/source/blog/2011-01-02-another-article.html.markdown
151
+ - fixtures/custom-collections-app/source/blog/2011-01-03-no-category-article.html.markdown
145
152
  - fixtures/custom-collections-app/source/category.html.erb
146
153
  - fixtures/custom-collections-app/source/index.html.erb
147
154
  - fixtures/custom-collections-app/source/layout.erb
@@ -193,6 +200,10 @@ files:
193
200
  - fixtures/indexes-app/source/2011/01/01/new-article.html.markdown
194
201
  - fixtures/indexes-app/source/index.html.erb
195
202
  - fixtures/indexes-app/source/layout.erb
203
+ - fixtures/lang-path-app/config.rb
204
+ - fixtures/lang-path-app/source/blog/2013-12-24-a-humble-test.en.html.markdown
205
+ - fixtures/lang-path-app/source/blog/2013-12-24-a-humble-test.ru.html.markdown
206
+ - fixtures/lang-path-app/source/layouts/layout.erb
196
207
  - fixtures/language-app/config.rb
197
208
  - fixtures/language-app/locales/en.yml
198
209
  - fixtures/language-app/locales/ru.yml
@@ -353,17 +364,17 @@ require_paths:
353
364
  - lib
354
365
  required_ruby_version: !ruby/object:Gem::Requirement
355
366
  requirements:
356
- - - '>='
367
+ - - ">="
357
368
  - !ruby/object:Gem::Version
358
369
  version: 1.9.3
359
370
  required_rubygems_version: !ruby/object:Gem::Requirement
360
371
  requirements:
361
- - - '>='
372
+ - - ">="
362
373
  - !ruby/object:Gem::Version
363
374
  version: '0'
364
375
  requirements: []
365
376
  rubyforge_project:
366
- rubygems_version: 2.0.6
377
+ rubygems_version: 2.2.2
367
378
  signing_key:
368
379
  specification_version: 4
369
380
  summary: Blog engine for Middleman
@@ -380,6 +391,7 @@ test_files:
380
391
  - features/directory_indexes.feature
381
392
  - features/filename_date.feature
382
393
  - features/future_date.feature
394
+ - features/ignored_files.feature
383
395
  - features/language.feature
384
396
  - features/layouts.feature
385
397
  - features/multiblog.feature
@@ -407,6 +419,11 @@ test_files:
407
419
  - fixtures/blog-sources-app/source/blog/2013-08-08-slug-from-filename.html.markdown
408
420
  - fixtures/blog-sources-app/source/index.html.erb
409
421
  - fixtures/blog-sources-app/source/layout.erb
422
+ - fixtures/blog-sources-subdirs-app/config.rb
423
+ - fixtures/blog-sources-subdirs-app/source/blog.html.erb
424
+ - fixtures/blog-sources-subdirs-app/source/blog/another-post.md.erb
425
+ - fixtures/blog-sources-subdirs-app/source/blog/subdir/yet-another-post.md.erb
426
+ - fixtures/blog-sources-subdirs-app/source/layout.erb
410
427
  - fixtures/calendar-and-tag-app/config-directory-indexes.rb
411
428
  - fixtures/calendar-and-tag-app/config.rb
412
429
  - fixtures/calendar-and-tag-app/source/archive.html.erb
@@ -439,6 +456,7 @@ test_files:
439
456
  - fixtures/custom-collections-app/config.rb
440
457
  - fixtures/custom-collections-app/source/blog/2011-01-01-new-article.html.markdown
441
458
  - fixtures/custom-collections-app/source/blog/2011-01-02-another-article.html.markdown
459
+ - fixtures/custom-collections-app/source/blog/2011-01-03-no-category-article.html.markdown
442
460
  - fixtures/custom-collections-app/source/category.html.erb
443
461
  - fixtures/custom-collections-app/source/index.html.erb
444
462
  - fixtures/custom-collections-app/source/layout.erb
@@ -490,6 +508,10 @@ test_files:
490
508
  - fixtures/indexes-app/source/2011/01/01/new-article.html.markdown
491
509
  - fixtures/indexes-app/source/index.html.erb
492
510
  - fixtures/indexes-app/source/layout.erb
511
+ - fixtures/lang-path-app/config.rb
512
+ - fixtures/lang-path-app/source/blog/2013-12-24-a-humble-test.en.html.markdown
513
+ - fixtures/lang-path-app/source/blog/2013-12-24-a-humble-test.ru.html.markdown
514
+ - fixtures/lang-path-app/source/layouts/layout.erb
493
515
  - fixtures/language-app/config.rb
494
516
  - fixtures/language-app/locales/en.yml
495
517
  - fixtures/language-app/locales/ru.yml