Remove duplicated mixed case categories

This commit is contained in:
ChaYoung You 2014-07-07 15:00:22 +09:00
parent 3768d90278
commit c8d1c3d264
No known key found for this signature in database
GPG Key ID: 46D5FC2EE79FBC2D
2 changed files with 14 additions and 1 deletions

View File

@ -218,7 +218,7 @@ module Jekyll
:title => slug, :title => slug,
:i_day => date.strftime("%-d"), :i_day => date.strftime("%-d"),
:i_month => date.strftime("%-m"), :i_month => date.strftime("%-m"),
:categories => (categories || []).map { |c| c.to_s.downcase }.join('/'), :categories => (categories || []).map { |c| c.to_s.downcase }.uniq.join('/'),
:short_month => date.strftime("%b"), :short_month => date.strftime("%b"),
:short_year => date.strftime("%y"), :short_year => date.strftime("%y"),
:y_day => date.strftime("%j"), :y_day => date.strftime("%j"),

View File

@ -276,6 +276,19 @@ class TestPost < Test::Unit::TestCase
end end
end end
context "with duplicated mixed case (categories)" do
setup do
@post.categories << "MixedCase"
@post.categories << "Mixedcase"
@post.process(@fake_file)
end
should "process the url correctly" do
assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
assert_equal "/mixedcase/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