Skip to content

Commit

Permalink
Merge branch 'categories_with_space' of https://github.com/spk/jekyll
Browse files Browse the repository at this point in the history
…into spk-categories_with_space
  • Loading branch information
mojombo committed Jan 22, 2012
2 parents fa6d013 + 1356e75 commit 65890da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jekyll/post.rb
Expand Up @@ -131,7 +131,7 @@ def url
"title" => CGI.escape(slug),
"i_day" => date.strftime("%d").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
}.inject(template) { |result, token|
result.gsub(/:#{Regexp.escape token.first}/, token.last)
Expand Down
13 changes: 13 additions & 0 deletions test/test_post.rb
Expand Up @@ -141,6 +141,19 @@ def do_render(post)
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
setup do
@post.site.permalink_style = :none
Expand Down

0 comments on commit 65890da

Please sign in to comment.