middleman-blog 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +16 -0
  3. data/.gitignore +5 -1
  4. data/.travis.yml +33 -19
  5. data/.yardopts +2 -2
  6. data/CHANGELOG.md +51 -24
  7. data/CONTRIBUTING.md +5 -2
  8. data/Gemfile +23 -16
  9. data/ISSUE_TEMPLATE.md +14 -0
  10. data/LICENSE.md +15 -17
  11. data/README.md +52 -14
  12. data/Rakefile +10 -7
  13. data/features/article_dirs.feature +34 -0
  14. data/features/blog_sources.feature +35 -6
  15. data/features/filename_date.feature +4 -2
  16. data/features/language.feature +108 -77
  17. data/features/layouts.feature +3 -0
  18. data/features/multiblog.feature +1 -1
  19. data/features/next_previous.feature +10 -7
  20. data/features/permalink.feature +17 -0
  21. data/features/summary.feature +26 -2
  22. data/features/support/env.rb +7 -4
  23. data/features/support/time_steps.rb +7 -3
  24. data/features/tags.feature +68 -34
  25. data/fixtures/article-dirs-app/config-directory-indexes.rb +6 -0
  26. data/fixtures/article-dirs-app/config-permalink-with-dot.rb +6 -0
  27. data/fixtures/blog-sources-app/config.rb +6 -3
  28. data/fixtures/blog-sources-app/source/blog/2011-01-01-new-article.html.markdown +5 -3
  29. data/fixtures/blog-sources-app/source/blog/2013-08-08-slug-from-filename.html.markdown +5 -3
  30. data/fixtures/blog-sources-app/source/index.html.erb +12 -8
  31. data/fixtures/blog-sources-app/source/layout.erb +21 -10
  32. data/fixtures/blog-sources-no-date-app/config.rb +6 -0
  33. data/fixtures/blog-sources-no-date-app/source/blog/new-article.html.markdown +8 -0
  34. data/fixtures/blog-sources-no-date-app/source/index.html.erb +13 -0
  35. data/fixtures/blog-sources-no-date-app/source/layout.erb +24 -0
  36. data/fixtures/blog-sources-no-day-app/config.rb +6 -0
  37. data/fixtures/blog-sources-no-day-app/source/2012-08-testing.html.markdown +8 -0
  38. data/fixtures/blog-sources-no-day-app/source/layout.erb +24 -0
  39. data/fixtures/{no-title-app → blog-sources-no-title-app}/config.rb +3 -0
  40. data/fixtures/blog-sources-no-title-app/source/2013-08-07.html.markdown +8 -0
  41. data/fixtures/blog-sources-no-title-app/source/2013-08-08.html.markdown +9 -0
  42. data/fixtures/{no-date-app → blog-sources-no-title-app}/source/layout.erb +11 -0
  43. data/fixtures/blog-sources-subdirs-app/config.rb +6 -3
  44. data/fixtures/blog-sources-subdirs-app/source/blog.html.erb +6 -3
  45. data/fixtures/blog-sources-subdirs-app/source/blog/another-post.html.markdown +9 -0
  46. data/fixtures/blog-sources-subdirs-app/source/blog/subdir/yet-another-post.html.markdown +9 -0
  47. data/fixtures/blog-sources-subdirs-app/source/layout.erb +24 -1
  48. data/fixtures/calendar-app/config-directory-indexes.rb +6 -4
  49. data/fixtures/calendar-app/config-only-year.rb +8 -6
  50. data/fixtures/calendar-app/config.rb +6 -4
  51. data/fixtures/calendar-app/source/layout.erb +17 -12
  52. data/fixtures/language-app/locales/en.yml +5 -4
  53. data/fixtures/language-app/locales/ru.yml +5 -4
  54. data/fixtures/language-app/source/2013-09-05-previous-english-article.html.erb +9 -0
  55. data/fixtures/language-app/source/2013-09-06-previous-russian-article.html.erb +9 -0
  56. data/fixtures/language-app/source/2013-09-07-english-article-with-lang-in-frontmatter.html.erb +5 -2
  57. data/fixtures/language-app/source/2013-09-07-russian-article-with-lang-in-frontmatter.html.erb +5 -2
  58. data/fixtures/language-app/source/2013-09-08-next-russian-article.html.erb +9 -0
  59. data/fixtures/language-app/source/2013-09-09-next-english-article.html.erb +9 -0
  60. data/fixtures/language-app/source/layouts/layout.erb +12 -1
  61. data/fixtures/language-app/source/localizable/index.html.erb +3 -1
  62. data/fixtures/layouts-app/source/2011/01/01/fourth-article.html.markdown +7 -0
  63. data/fixtures/paginate-app/config-directory-indexes.rb +14 -12
  64. data/fixtures/paginate-app/config-paginate-off.rb +14 -12
  65. data/fixtures/paginate-app/config.rb +16 -13
  66. data/fixtures/permalink-app/config.rb +7 -0
  67. data/fixtures/permalink-app/source/index.html.erb +13 -0
  68. data/fixtures/permalink-app/source/layout.erb +26 -0
  69. data/fixtures/permalink-app/source/news/2011-01-01-new-article.html.markdown +9 -0
  70. data/fixtures/summary-app/source/2013-05-08-article-with-custom-separator.html.markdown +1 -1
  71. data/fixtures/summary-app/source/2016-05-21-article-with-comment-separator.html.markdown +7 -0
  72. data/fixtures/tags-app/config-directory-indexes.rb +2 -1
  73. data/fixtures/tags-app/config-filters.rb +8 -0
  74. data/fixtures/tags-app/config-no-tags.rb +5 -3
  75. data/fixtures/tags-app/config.rb +2 -1
  76. data/fixtures/tags-app/source/blog/2011-01-03-no-taga.html.markdown +6 -0
  77. data/lib/middleman-blog.rb +7 -4
  78. data/lib/middleman-blog/blog_article.rb +157 -34
  79. data/lib/middleman-blog/blog_data.rb +83 -29
  80. data/lib/middleman-blog/calendar_pages.rb +1 -1
  81. data/lib/middleman-blog/commands/article.rb +88 -30
  82. data/lib/middleman-blog/commands/article.tt +4 -1
  83. data/lib/middleman-blog/custom_pages.rb +1 -1
  84. data/lib/middleman-blog/helpers.rb +2 -2
  85. data/lib/middleman-blog/paginator.rb +5 -4
  86. data/lib/middleman-blog/tag_pages.rb +61 -24
  87. data/lib/middleman-blog/truncate_html.rb +4 -9
  88. data/lib/middleman-blog/uri_templates.rb +44 -30
  89. data/lib/middleman-blog/version.rb +3 -1
  90. data/middleman-blog.gemspec +19 -17
  91. data/spec/spec_helper.rb +1 -1
  92. data/spec/uri_templates_spec.rb +21 -6
  93. metadata +68 -52
  94. data/.gemtest +0 -0
  95. data/features/no_date.feature +0 -9
  96. data/features/permalink-data.feature +0 -12
  97. data/fixtures/blog-sources-app/source/_article_template.erb +0 -1
  98. data/fixtures/blog-sources-subdirs-app/source/blog/another-post.html.md.erb +0 -8
  99. data/fixtures/blog-sources-subdirs-app/source/blog/subdir/yet-another-post.html.md.erb +0 -8
  100. data/fixtures/no-date-app/config.rb +0 -3
  101. data/fixtures/no-date-app/source/_article_template.erb +0 -1
  102. data/fixtures/no-date-app/source/blog/new-article.html.markdown +0 -6
  103. data/fixtures/no-date-app/source/index.html.erb +0 -9
  104. data/fixtures/no-day-app/config.rb +0 -3
  105. data/fixtures/no-day-app/source/2012-08-testing.html.markdown +0 -6
  106. data/fixtures/no-day-app/source/layout.erb +0 -13
  107. data/fixtures/no-title-app/source/2013-08-07.html.markdown +0 -6
  108. data/fixtures/no-title-app/source/2013-08-08.html.markdown +0 -7
  109. data/fixtures/no-title-app/source/layout.erb +0 -13
  110. data/fixtures/permalink-data-app/config.rb +0 -5
  111. data/fixtures/permalink-data-app/source/index.html.erb +0 -3
  112. data/fixtures/permalink-data-app/source/layout.erb +0 -14
  113. data/fixtures/permalink-data-app/source/news/2011-01-01-new-article.html.markdown +0 -7
@@ -0,0 +1,9 @@
1
+ ---
2
+
3
+ title : "Newer Article"
4
+ date : 2011-01-01
5
+ custom : "A custom string"
6
+
7
+ ---
8
+
9
+ Newer Article Content
@@ -3,5 +3,5 @@ title: "Article with custom summary separator"
3
3
  ---
4
4
 
5
5
  Summary from article with custom separator.
6
- /SPLIT_SUMMARY_BEFORE_THIS/
6
+ SPLIT_SUMMARY_BEFORE_THIS
7
7
  Extended part from article with custom separator.
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: "Article with HTML comment summary separator"
3
+ ---
4
+
5
+ Summary from article with HTML comment separator.
6
+ <!--more-->
7
+ Extended part from article with HTML comment separator.
@@ -1,5 +1,6 @@
1
1
  require "middleman-blog"
2
- activate :blog do |blog|
2
+
3
+ activate :blog do | blog |
3
4
  blog.sources = "blog/:year-:month-:day-:title.html"
4
5
  blog.permalink = "blog/:year-:month-:day-:title.html"
5
6
  blog.tag_template = "/tag.html"
@@ -0,0 +1,8 @@
1
+ require 'middleman-blog'
2
+
3
+ activate :blog do |blog|
4
+ blog.sources = 'blog/:year-:month-:day-:title.html'
5
+ blog.permalink = 'blog/:year-:month-:day-:title.html'
6
+ blog.tag_template = '/tag.html'
7
+ blog.filter = proc { |article| !article.title.start_with?('Another') }
8
+ end
@@ -1,6 +1,8 @@
1
+ require 'middleman-blog'
2
+
1
3
  activate :blog do |blog|
2
- blog.sources = "blog/:year-:month-:day-:title.html"
3
- blog.permalink = "blog/:year-:month-:day-:title.html"
4
- blog.tag_template = "/tag.html"
4
+ blog.sources = 'blog/:year-:month-:day-:title.html'
5
+ blog.permalink = 'blog/:year-:month-:day-:title.html'
6
+ blog.tag_template = '/tag.html'
5
7
  blog.generate_tag_pages = false
6
8
  end
@@ -1,5 +1,6 @@
1
1
  require "middleman-blog"
2
- activate :blog do |blog|
2
+
3
+ activate :blog do | blog |
3
4
  blog.sources = "blog/:year-:month-:day-:title.html"
4
5
  blog.permalink = "blog/:year-:month-:day-:title.html"
5
6
  blog.tag_template = "/tag.html"
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: "Article"
3
+ date: 2011-01-03
4
+ ---
5
+
6
+ No tags here
@@ -1,8 +1,11 @@
1
1
  require "middleman-core"
2
2
  require "middleman-blog/version"
3
3
 
4
- ::Middleman::Extensions.register(:blog) do
5
- require "middleman-blog/extension"
6
- require "middleman-blog/commands/article"
7
- ::Middleman::BlogExtension
4
+ ::Middleman::Extensions.register( :blog ) do
5
+
6
+ require "middleman-blog/extension"
7
+ require "middleman-blog/commands/article"
8
+
9
+ ::Middleman::BlogExtension
10
+
8
11
  end
@@ -4,89 +4,122 @@ require 'active_support/core_ext/time/acts_like'
4
4
  require 'active_support/core_ext/time/calculations'
5
5
 
6
6
  module Middleman
7
+
7
8
  module Blog
8
- # A module that adds blog-article-specific methods to Resources.
9
- # A {BlogArticle} can be retrieved via {Blog::Helpers#current_article} or
9
+
10
+ ##
11
+ # A module that adds blog-article-specific methods to Resources. A
12
+ # {BlogArticle} can be retrieved via {Blog::Helpers#current_article} or
10
13
  # methods on {BlogData} (like {BlogData#articles}).
14
+ #
11
15
  # @see http://rdoc.info/github/middleman/middleman/Middleman/Sitemap/Resource Middleman::Sitemap::Resource
16
+ ##
12
17
  module BlogArticle
18
+
19
+ extend Gem::Deprecate
20
+
21
+ ##
22
+ #
23
+ ##
13
24
  def self.extended(base)
14
25
  base.class.send(:attr_accessor, :blog_controller)
15
26
  end
16
27
 
28
+ ##
17
29
  # A reference to the {BlogData} for this article's blog.
30
+ #
18
31
  # @return [BlogData]
32
+ ##
19
33
  def blog_data
20
34
  blog_controller.data
21
35
  end
22
36
 
37
+ ##
23
38
  # The options for this article's blog.
39
+ #
24
40
  # @return [ConfigurationManager]
41
+ ###
25
42
  def blog_options
26
43
  blog_controller.options
27
44
  end
28
45
 
46
+ ##
29
47
  # Render this resource to a string with the appropriate layout.
30
48
  # Called automatically by Middleman.
49
+ #
31
50
  # @return [String]
51
+ ##
32
52
  def render(opts={}, locs={}, &block)
33
- unless opts.has_key?(:layout)
53
+
54
+ unless opts.has_key?( :layout )
55
+
34
56
  opts[:layout] = metadata[:options][:layout]
35
- opts[:layout] = blog_options.layout if opts[:layout].nil?
57
+ opts[:layout] = blog_options.layout if opts[:layout].nil? || opts[:layout] == :_auto_layout
58
+
36
59
  # Convert to a string unless it's a boolean
37
60
  opts[:layout] = opts[:layout].to_s if opts[:layout].is_a? Symbol
61
+
38
62
  end
39
63
 
40
64
  content = super(opts, locs, &block)
41
65
 
42
66
  unless opts[:keep_separator]
43
- content.sub!(blog_options.summary_separator, "")
67
+ content.sub!(blog_options.summary_separator, '')
44
68
  end
45
69
 
46
70
  content
47
71
  end
48
72
 
73
+ ##
49
74
  # The title of the article, set from frontmatter.
75
+ #
50
76
  # @return [String]
77
+ ##
51
78
  def title
52
- data["title"]
79
+ data['title']
53
80
  end
54
81
 
82
+ ##
55
83
  # Whether or not this article has been published.
56
- #
57
84
  # An article is considered published in the following scenarios:
58
85
  #
59
86
  # 1. Frontmatter does not set +published+ to false and either
60
87
  # 2. The blog option +publish_future_dated+ is true or
61
88
  # 3. The article's date is after the current time
89
+ #
62
90
  # @return [Boolean]
91
+ ##
63
92
  def published?
64
- data["published"] != false && (blog_options.publish_future_dated || date <= Time.current)
93
+ data['published'] != false && (blog_options.publish_future_dated || date <= Time.current)
65
94
  end
66
95
 
67
- # The body of this article, in HTML (no layout). This is for
68
- # things like RSS feeds or lists of articles - individual
69
- # articles will automatically be rendered from their
70
- # template.
96
+ ##
97
+ # The body of this article, in HTML (no layout). This is for things like
98
+ # RSS feeds or lists of articles - individual articles will automatically
99
+ # be rendered from their template.
100
+ #
71
101
  # @return [String]
102
+ ##
72
103
  def body
73
104
  render layout: false
74
105
  end
75
106
 
107
+ ##
76
108
  # The summary for this article, in HTML.
77
109
  #
78
- # The blog option +summary_generator+ can be set to a +Proc+ in order to provide
79
- # custom summary generation. The +Proc+ is provided
80
- # the rendered content of the article (without layout), the
81
- # desired length to trim the summary to, and the ellipsis string to use.
82
- # Otherwise the {#default_summary_generator} will be used, which returns either
110
+ # The blog option +summary_generator+ can be set to a +Proc+ in order to
111
+ # provide custom summary generation. The +Proc+ is provided the rendered
112
+ # content of the article (without layout), the desired length to trim the
113
+ # summary to, and the ellipsis string to use. Otherwise the
114
+ # {#default_summary_generator} will be used, which returns either
83
115
  # everything before the summary separator (set via the blog option
84
- # +summary_separator+ and defaulting to "READMORE") if it is found,
85
- # or the first +summary_length+ characters of the post.
116
+ # +summary_separator+ and defaulting to "READMORE") if it is found, or the
117
+ # first +summary_length+ characters of the post.
86
118
  #
87
119
  # @param [Number] length How many characters to trim the summary to.
88
120
  # @param [String] ellipsis The ellipsis string to use when content is trimmed.
89
121
  # @return [String]
122
+ ##
90
123
  def summary(length=nil, ellipsis='...')
91
124
  rendered = render layout: false, keep_separator: true
92
125
 
@@ -95,8 +128,10 @@ module Middleman
95
128
  else
96
129
  default_summary_generator(rendered, length, ellipsis)
97
130
  end
131
+
98
132
  end
99
133
 
134
+ ##
100
135
  # The default summary generator first tries to find the +summary_separator+ and
101
136
  # take the text before it. If that doesn't work, it will truncate text without splitting
102
137
  # the middle of an HTML tag, using a Nokogiri-based {TruncateHTML} utility.
@@ -104,33 +139,46 @@ module Middleman
104
139
  # @param [String] rendered The rendered blog article
105
140
  # @param [Integer] length The length in characters to truncate to.
106
141
  # -1 or +nil+ will return the whole article.
142
+ # @param [String] ellipsis The ellipsis string to use when content is trimmed.
143
+ ##
107
144
  def default_summary_generator(rendered, length, ellipsis)
108
- if length && length >= 0
109
- require 'middleman-blog/truncate_html'
110
- TruncateHTML.truncate_at_length(rendered, length, ellipsis)
111
- elsif blog_options.summary_separator && rendered.match(blog_options.summary_separator)
145
+
146
+ if blog_options.summary_separator && rendered.match(blog_options.summary_separator)
112
147
  require 'middleman-blog/truncate_html'
113
148
  TruncateHTML.truncate_at_separator(rendered, blog_options.summary_separator)
149
+
150
+ elsif length && length >= 0
151
+ require 'middleman-blog/truncate_html'
152
+ TruncateHTML.truncate_at_length(rendered, length, ellipsis)
153
+
114
154
  elsif blog_options.summary_length && blog_options.summary_length > 0
115
155
  require 'middleman-blog/truncate_html'
116
156
  TruncateHTML.truncate_at_length(rendered, blog_options.summary_length, ellipsis)
157
+
117
158
  else
118
159
  rendered
119
160
  end
161
+
120
162
  end
121
163
 
164
+ ##
122
165
  # A list of tags for this article, set from frontmatter.
166
+ #
123
167
  # @return [Array<String>] (never +nil+)
168
+ ##
124
169
  def tags
125
- article_tags = data["tags"]
170
+
171
+ article_tags = data['tags']
126
172
 
127
173
  if article_tags.is_a? String
128
174
  article_tags.split(',').map(&:strip)
129
175
  else
130
176
  Array(article_tags).map(&:to_s)
131
177
  end
178
+
132
179
  end
133
180
 
181
+ ##
134
182
  # The language of the article. The language can be present in the
135
183
  # frontmatter or in the source path. If both are present, they
136
184
  # must match. If neither specifies a lang, I18n's default_locale will
@@ -138,9 +186,11 @@ module Middleman
138
186
  # activated at all, +nil+ will be returned.
139
187
  #
140
188
  # @return [Symbol] Language code (for example, +:en+ or +:de+)
189
+ ##
141
190
  def locale
191
+
142
192
  frontmatter_locale = data['locale'] || data['lang']
143
- filename_locale = path_part('locale') || path_part('lang')
193
+ filename_locale = path_part('locale') || path_part('lang')
144
194
 
145
195
  if frontmatter_locale && filename_locale && frontmatter_locale != filename_locale
146
196
  raise "The locale in #{path}'s filename (#{filename_locale.inspect}) doesn't match the lang in its frontmatter (#{frontmatter_locale.inspect})"
@@ -154,13 +204,16 @@ module Middleman
154
204
 
155
205
  alias_method :lang, :locale
156
206
 
207
+ ##
157
208
  # Attempt to figure out the date of the post. The date should be
158
209
  # present in the source path, but users may also provide a date
159
210
  # in the frontmatter in order to provide a time of day for sorting
160
211
  # reasons.
161
212
  #
162
213
  # @return [TimeWithZone]
214
+ ##
163
215
  def date
216
+
164
217
  return @_date if @_date
165
218
 
166
219
  frontmatter_date = data['date']
@@ -174,6 +227,7 @@ module Middleman
174
227
 
175
228
  # Next figure out the date from the filename
176
229
  source_vars = blog_data.source_template.variables
230
+
177
231
  if source_vars.include?('year') &&
178
232
  source_vars.include?('month') &&
179
233
  source_vars.include?('day')
@@ -184,59 +238,128 @@ module Middleman
184
238
  else
185
239
  @_date = filename_date.to_time.in_time_zone
186
240
  end
241
+
187
242
  end
188
243
 
189
244
  raise "Blog post #{path} needs a date in its filename or frontmatter" unless @_date
190
245
 
191
246
  @_date
247
+
192
248
  end
193
249
 
250
+ ##
194
251
  # The "slug" of the article that shows up in its URL. The article slug
195
- # is a parameterized version of the {#title} (lowercase, spaces replaced
252
+ # is a parametrized version of the {#title} (lowercase, spaces replaced
196
253
  # with dashes, etc) and can be used in the blog +permalink+ as +:title+.
197
254
  #
198
255
  # @return [String]
256
+ ##
199
257
  def slug
200
258
  if data['slug']
201
- data['slug']
259
+ Blog::UriTemplates.safe_parameterize(data['slug'])
260
+
202
261
  elsif blog_data.source_template.variables.include?('title')
203
- path_part('title')
262
+ Blog::UriTemplates.safe_parameterize(path_part('title'))
263
+
204
264
  elsif title
205
265
  Blog::UriTemplates.safe_parameterize(title)
266
+
206
267
  else
207
268
  raise "Can't generate a slug for #{path} because it has no :title in its path pattern or title/slug in its frontmatter."
269
+
208
270
  end
209
271
  end
210
272
 
211
- # The previous (chronologically earlier) article before this one
212
- # or +nil+ if this is the first article.
273
+ ##
274
+ # The previous (chronologically earlier) article before this one or
275
+ # +nil+ if this is the first article.
276
+ #
277
+ # @deprecated Use {#article_previous} instead.
278
+ #
213
279
  # @return [BlogArticle]
280
+ ##
214
281
  def previous_article
215
- blog_data.articles.find {|a| a.date < self.date }
282
+ article_previous()
216
283
  end
284
+ deprecate :previous_article, :article_previous, 2017, 5
217
285
 
218
- # The next (chronologically later) article after this one
219
- # or +nil+ if this is the most recent article.
286
+ ##
287
+ # The next (chronologically later) article after this one or +nil+ if
288
+ # this is the most recent article.
289
+ #
290
+ # @deprecated Use {#article_next} instead.
291
+ #
220
292
  # @return [Middleman::Sitemap::Resource]
293
+ ##
221
294
  def next_article
222
- blog_data.articles.reverse.find {|a| a.date > self.date }
295
+ article_next()
296
+ end
297
+ deprecate :next_article, :article_next, 2017, 5
298
+
299
+ ##
300
+ # The previous (chronologically earlier) article before this one or
301
+ # +nil+ if this is the first article.
302
+ #
303
+ # @return [BlogArticle]
304
+ ##
305
+ def article_previous
306
+ blog_data.articles.find { |a| a.date < self.date }
307
+ end
308
+
309
+ ##
310
+ # The next (chronologically later) article after this one or +nil+ if
311
+ # this is the most recent article.
312
+ #
313
+ # @return [Middleman::Sitemap::Resource]
314
+ ##
315
+ def article_next
316
+ blog_data.articles.reverse.find { |a| a.date > self.date }
317
+ end
318
+
319
+ ##
320
+ # The previous (chronologically earlier) article before this one in the
321
+ # current locale, or +nil+ if this is the first article.
322
+ #
323
+ # @return [BlogArticle]
324
+ ##
325
+ def article_locale_previous
326
+ blog_data.local_articles.find { |a| a.date < self.date }
327
+ end
328
+
329
+ ##
330
+ # The next (chronologically later) article after this one in the current
331
+ # locale or +nil+ if this is the most recent article.
332
+ #
333
+ # @return [Middleman::Sitemap::Resource]
334
+ ##
335
+ def article_locale_next
336
+ blog_data.local_articles.reverse.find { |a| a.date > self.date }
223
337
  end
224
338
 
339
+ ##
225
340
  # This is here to prevent out-of-memory on exceptions.
341
+ #
226
342
  # @private
343
+ ##
227
344
  def inspect
228
345
  "#<Middleman::Blog::BlogArticle: #{data.inspect}>"
229
346
  end
230
347
 
231
348
  private
232
349
 
350
+ ##
233
351
  # Retrieve a section of the source path template.
352
+ #
234
353
  # @param [String] part The part of the path, e.g. "lang", "year", "month", "day", "title"
235
354
  # @return [String]
355
+ ##
236
356
  def path_part(part)
237
357
  @_path_parts ||= Blog::UriTemplates.extract_params(blog_data.source_template, path)
238
358
  @_path_parts[part.to_s]
239
359
  end
360
+
240
361
  end
362
+
241
363
  end
364
+
242
365
  end