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.
- checksums.yaml +4 -4
- data/.editorconfig +16 -0
- data/.gitignore +5 -1
- data/.travis.yml +33 -19
- data/.yardopts +2 -2
- data/CHANGELOG.md +51 -24
- data/CONTRIBUTING.md +5 -2
- data/Gemfile +23 -16
- data/ISSUE_TEMPLATE.md +14 -0
- data/LICENSE.md +15 -17
- data/README.md +52 -14
- data/Rakefile +10 -7
- data/features/article_dirs.feature +34 -0
- data/features/blog_sources.feature +35 -6
- data/features/filename_date.feature +4 -2
- data/features/language.feature +108 -77
- data/features/layouts.feature +3 -0
- data/features/multiblog.feature +1 -1
- data/features/next_previous.feature +10 -7
- data/features/permalink.feature +17 -0
- data/features/summary.feature +26 -2
- data/features/support/env.rb +7 -4
- data/features/support/time_steps.rb +7 -3
- data/features/tags.feature +68 -34
- data/fixtures/article-dirs-app/config-directory-indexes.rb +6 -0
- data/fixtures/article-dirs-app/config-permalink-with-dot.rb +6 -0
- data/fixtures/blog-sources-app/config.rb +6 -3
- data/fixtures/blog-sources-app/source/blog/2011-01-01-new-article.html.markdown +5 -3
- data/fixtures/blog-sources-app/source/blog/2013-08-08-slug-from-filename.html.markdown +5 -3
- data/fixtures/blog-sources-app/source/index.html.erb +12 -8
- data/fixtures/blog-sources-app/source/layout.erb +21 -10
- data/fixtures/blog-sources-no-date-app/config.rb +6 -0
- data/fixtures/blog-sources-no-date-app/source/blog/new-article.html.markdown +8 -0
- data/fixtures/blog-sources-no-date-app/source/index.html.erb +13 -0
- data/fixtures/blog-sources-no-date-app/source/layout.erb +24 -0
- data/fixtures/blog-sources-no-day-app/config.rb +6 -0
- data/fixtures/blog-sources-no-day-app/source/2012-08-testing.html.markdown +8 -0
- data/fixtures/blog-sources-no-day-app/source/layout.erb +24 -0
- data/fixtures/{no-title-app → blog-sources-no-title-app}/config.rb +3 -0
- data/fixtures/blog-sources-no-title-app/source/2013-08-07.html.markdown +8 -0
- data/fixtures/blog-sources-no-title-app/source/2013-08-08.html.markdown +9 -0
- data/fixtures/{no-date-app → blog-sources-no-title-app}/source/layout.erb +11 -0
- data/fixtures/blog-sources-subdirs-app/config.rb +6 -3
- data/fixtures/blog-sources-subdirs-app/source/blog.html.erb +6 -3
- data/fixtures/blog-sources-subdirs-app/source/blog/another-post.html.markdown +9 -0
- data/fixtures/blog-sources-subdirs-app/source/blog/subdir/yet-another-post.html.markdown +9 -0
- data/fixtures/blog-sources-subdirs-app/source/layout.erb +24 -1
- data/fixtures/calendar-app/config-directory-indexes.rb +6 -4
- data/fixtures/calendar-app/config-only-year.rb +8 -6
- data/fixtures/calendar-app/config.rb +6 -4
- data/fixtures/calendar-app/source/layout.erb +17 -12
- data/fixtures/language-app/locales/en.yml +5 -4
- data/fixtures/language-app/locales/ru.yml +5 -4
- data/fixtures/language-app/source/2013-09-05-previous-english-article.html.erb +9 -0
- data/fixtures/language-app/source/2013-09-06-previous-russian-article.html.erb +9 -0
- data/fixtures/language-app/source/2013-09-07-english-article-with-lang-in-frontmatter.html.erb +5 -2
- data/fixtures/language-app/source/2013-09-07-russian-article-with-lang-in-frontmatter.html.erb +5 -2
- data/fixtures/language-app/source/2013-09-08-next-russian-article.html.erb +9 -0
- data/fixtures/language-app/source/2013-09-09-next-english-article.html.erb +9 -0
- data/fixtures/language-app/source/layouts/layout.erb +12 -1
- data/fixtures/language-app/source/localizable/index.html.erb +3 -1
- data/fixtures/layouts-app/source/2011/01/01/fourth-article.html.markdown +7 -0
- data/fixtures/paginate-app/config-directory-indexes.rb +14 -12
- data/fixtures/paginate-app/config-paginate-off.rb +14 -12
- data/fixtures/paginate-app/config.rb +16 -13
- data/fixtures/permalink-app/config.rb +7 -0
- data/fixtures/permalink-app/source/index.html.erb +13 -0
- data/fixtures/permalink-app/source/layout.erb +26 -0
- data/fixtures/permalink-app/source/news/2011-01-01-new-article.html.markdown +9 -0
- data/fixtures/summary-app/source/2013-05-08-article-with-custom-separator.html.markdown +1 -1
- data/fixtures/summary-app/source/2016-05-21-article-with-comment-separator.html.markdown +7 -0
- data/fixtures/tags-app/config-directory-indexes.rb +2 -1
- data/fixtures/tags-app/config-filters.rb +8 -0
- data/fixtures/tags-app/config-no-tags.rb +5 -3
- data/fixtures/tags-app/config.rb +2 -1
- data/fixtures/tags-app/source/blog/2011-01-03-no-taga.html.markdown +6 -0
- data/lib/middleman-blog.rb +7 -4
- data/lib/middleman-blog/blog_article.rb +157 -34
- data/lib/middleman-blog/blog_data.rb +83 -29
- data/lib/middleman-blog/calendar_pages.rb +1 -1
- data/lib/middleman-blog/commands/article.rb +88 -30
- data/lib/middleman-blog/commands/article.tt +4 -1
- data/lib/middleman-blog/custom_pages.rb +1 -1
- data/lib/middleman-blog/helpers.rb +2 -2
- data/lib/middleman-blog/paginator.rb +5 -4
- data/lib/middleman-blog/tag_pages.rb +61 -24
- data/lib/middleman-blog/truncate_html.rb +4 -9
- data/lib/middleman-blog/uri_templates.rb +44 -30
- data/lib/middleman-blog/version.rb +3 -1
- data/middleman-blog.gemspec +19 -17
- data/spec/spec_helper.rb +1 -1
- data/spec/uri_templates_spec.rb +21 -6
- metadata +68 -52
- data/.gemtest +0 -0
- data/features/no_date.feature +0 -9
- data/features/permalink-data.feature +0 -12
- data/fixtures/blog-sources-app/source/_article_template.erb +0 -1
- data/fixtures/blog-sources-subdirs-app/source/blog/another-post.html.md.erb +0 -8
- data/fixtures/blog-sources-subdirs-app/source/blog/subdir/yet-another-post.html.md.erb +0 -8
- data/fixtures/no-date-app/config.rb +0 -3
- data/fixtures/no-date-app/source/_article_template.erb +0 -1
- data/fixtures/no-date-app/source/blog/new-article.html.markdown +0 -6
- data/fixtures/no-date-app/source/index.html.erb +0 -9
- data/fixtures/no-day-app/config.rb +0 -3
- data/fixtures/no-day-app/source/2012-08-testing.html.markdown +0 -6
- data/fixtures/no-day-app/source/layout.erb +0 -13
- data/fixtures/no-title-app/source/2013-08-07.html.markdown +0 -6
- data/fixtures/no-title-app/source/2013-08-08.html.markdown +0 -7
- data/fixtures/no-title-app/source/layout.erb +0 -13
- data/fixtures/permalink-data-app/config.rb +0 -5
- data/fixtures/permalink-data-app/source/index.html.erb +0 -3
- data/fixtures/permalink-data-app/source/layout.erb +0 -14
- data/fixtures/permalink-data-app/source/news/2011-01-01-new-article.html.markdown +0 -7
@@ -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 =
|
3
|
-
blog.permalink =
|
4
|
-
blog.tag_template =
|
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
|
data/fixtures/tags-app/config.rb
CHANGED
data/lib/middleman-blog.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require "middleman-core"
|
2
2
|
require "middleman-blog/version"
|
3
3
|
|
4
|
-
::Middleman::Extensions.register(:blog) do
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
9
|
-
|
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
|
-
|
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[
|
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[
|
93
|
+
data['published'] != false && (blog_options.publish_future_dated || date <= Time.current)
|
65
94
|
end
|
66
95
|
|
67
|
-
|
68
|
-
#
|
69
|
-
# articles
|
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
|
79
|
-
# custom summary generation. The +Proc+ is provided
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
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
|
-
#
|
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
|
-
|
109
|
-
|
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
|
-
|
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
|
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
|
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
|
-
|
212
|
-
#
|
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
|
-
|
282
|
+
article_previous()
|
216
283
|
end
|
284
|
+
deprecate :previous_article, :article_previous, 2017, 5
|
217
285
|
|
218
|
-
|
219
|
-
#
|
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
|
-
|
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
|