Merge branch 'categories_with_space' of https://github.com/spk/jekyll into spk-categories_with_space
This commit is contained in:
commit
65890da3d1
|
@ -131,7 +131,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.join('/'),
|
"categories" => categories.map {|c| URI.escape(c) }.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)
|
||||||
|
|
|
@ -141,6 +141,19 @@ class TestPost < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with space (categories)" do
|
||||||
|
setup do
|
||||||
|
@post.categories << "French cuisine"
|
||||||
|
@post.categories << "Belgian beer"
|
||||||
|
@post.process(@fake_file)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "process the url correctly" do
|
||||||
|
assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
|
||||||
|
assert_equal "/French%20cuisine/Belgian%20beer/2008/09/09/foo-bar.html", @post.url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "with none style" do
|
context "with none style" do
|
||||||
setup do
|
setup do
|
||||||
@post.site.permalink_style = :none
|
@post.site.permalink_style = :none
|
||||||
|
|
Loading…
Reference in New Issue