From c8d1c3d2640a88cb6fb719f78402c1a7d0eb8836 Mon Sep 17 00:00:00 2001 From: ChaYoung You Date: Mon, 7 Jul 2014 15:00:22 +0900 Subject: [PATCH] Remove duplicated mixed case categories --- lib/jekyll/post.rb | 2 +- test/test_post.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index b1496de3..4afe82e6 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -218,7 +218,7 @@ module Jekyll :title => slug, :i_day => date.strftime("%-d"), :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_year => date.strftime("%y"), :y_day => date.strftime("%j"), diff --git a/test/test_post.rb b/test/test_post.rb index 44cc9664..0e6861ce 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -276,6 +276,19 @@ class TestPost < Test::Unit::TestCase 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 setup do @post.site.permalink_style = :none