middleman-blog-drafts 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ 0.3.3
2
+ ====
3
+ * Fix handling of paths containing non-uri chars (PR by @cu39)
4
+ * Drafts without title now default to "(UNTITLED DRAFT)" (fix #11)
5
+
1
6
  0.3.2
2
7
  ====
3
8
  * Add CHANGELOG info for 0.3.1 and 0.3.2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- middleman-blog-drafts (0.3.2)
4
+ middleman-blog-drafts (0.3.3)
5
5
  middleman-blog (~> 3.5)
6
6
  middleman-core (~> 3.2)
7
7
 
@@ -5,3 +5,4 @@ Feature: Listing drafts
5
5
  Then I should see "New Draft Title"
6
6
  And I should see "Other Draft Title"
7
7
  And I should see "Drafts List"
8
+ And I should see "(UNTITLED DRAFT)"
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+ <h1>New Draft Without Title</h1>
4
+ <p>Date: <%= current_article.date.iso8601 %></p>
@@ -6,6 +6,12 @@ module Middleman
6
6
  # methods on {Blog::Drafts::Data} (accessible through BlogData#drafts).
7
7
  # @see http://rdoc.info/github/middleman/middleman/Middleman/Sitemap/Resource Middleman::Sitemap::Resource
8
8
  module DraftArticle
9
+ # The title of the draft article, or "(UNTITLED DRAFT)" if no title was provided
10
+ # @return [String]
11
+ def title
12
+ data["title"] || "(UNTITLED DRAFT)"
13
+ end
14
+
9
15
  # The "slug" of the draft article that shows up in its URL.
10
16
  # @return [String]
11
17
  def slug
@@ -16,7 +22,8 @@ module Middleman
16
22
  # @param [String] The part of the path, e.g. "title"
17
23
  # @return [String]
18
24
  def path_part(part)
19
- @_path_parts ||= blog_data.drafts.source_template.extract(path)
25
+ normalized_path = Addressable::URI.parse(path).normalize.to_s
26
+ @_path_parts ||= blog_data.drafts.source_template.extract(normalized_path)
20
27
  @_path_parts[part.to_s]
21
28
  end
22
29
 
@@ -1,7 +1,7 @@
1
1
  module Middleman
2
2
  module Blog
3
3
  module Drafts
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-blog-drafts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-12 00:00:00.000000000 Z
13
+ date: 2014-06-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: middleman-core
@@ -71,6 +71,7 @@ files:
71
71
  - fixtures/drafts-app/config.rb
72
72
  - fixtures/drafts-app/source/drafts/draft-build-false.html.erb
73
73
  - fixtures/drafts-app/source/drafts/draft-build-true.html.erb
74
+ - fixtures/drafts-app/source/drafts/draft-without-title.html.erb
74
75
  - fixtures/drafts-app/source/drafts/listing_drafts.html.erb
75
76
  - fixtures/drafts-app/source/drafts/new-draft.html.erb
76
77
  - fixtures/drafts-app/source/drafts/other-draft.html.erb
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  version: '0'
114
115
  segments:
115
116
  - 0
116
- hash: 4459154393451666075
117
+ hash: -1904865189572897641
117
118
  requirements: []
118
119
  rubyforge_project:
119
120
  rubygems_version: 1.8.25
@@ -131,6 +132,7 @@ test_files:
131
132
  - fixtures/drafts-app/config.rb
132
133
  - fixtures/drafts-app/source/drafts/draft-build-false.html.erb
133
134
  - fixtures/drafts-app/source/drafts/draft-build-true.html.erb
135
+ - fixtures/drafts-app/source/drafts/draft-without-title.html.erb
134
136
  - fixtures/drafts-app/source/drafts/listing_drafts.html.erb
135
137
  - fixtures/drafts-app/source/drafts/new-draft.html.erb
136
138
  - fixtures/drafts-app/source/drafts/other-draft.html.erb