Merge pull request #767 from mojombo/string-categories
Force Categories to be Strings
This commit is contained in:
commit
409eedafd8
|
@ -154,7 +154,7 @@ module Jekyll
|
||||||
"title" => CGI.escape(slug),
|
"title" => CGI.escape(slug),
|
||||||
"i_day" => date.strftime("%d").to_i.to_s,
|
"i_day" => date.strftime("%d").to_i.to_s,
|
||||||
"i_month" => date.strftime("%m").to_i.to_s,
|
"i_month" => date.strftime("%m").to_i.to_s,
|
||||||
"categories" => categories.map { |c| URI.escape(c) }.join('/'),
|
"categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'),
|
||||||
"output_ext" => self.output_ext
|
"output_ext" => self.output_ext
|
||||||
}.inject(template) { |result, token|
|
}.inject(template) { |result, token|
|
||||||
result.gsub(/:#{Regexp.escape token.first}/, token.last)
|
result.gsub(/:#{Regexp.escape token.first}/, token.last)
|
||||||
|
|
|
@ -128,6 +128,18 @@ class TestPost < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with unspecified (date) style and a numeric category" do
|
||||||
|
setup do
|
||||||
|
@post.categories << 2013
|
||||||
|
@post.process(@fake_file)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "process the url correctly" do
|
||||||
|
assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
|
||||||
|
assert_equal "/2013/2008/09/09/foo-bar.html", @post.url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "with unspecified layout" do
|
context "with unspecified layout" do
|
||||||
setup do
|
setup do
|
||||||
file = '2013-01-12-no-layout.textile'
|
file = '2013-01-12-no-layout.textile'
|
||||||
|
|
Loading…
Reference in New Issue