diff --git a/History.txt b/History.txt index b315c56c..19c0f5a9 100644 --- a/History.txt +++ b/History.txt @@ -4,6 +4,7 @@ * Expand source to full path so includes work anywhere (#101) * Fix highlighting on Ruby 1.9 (#65) * Fix extension munging when pretty permalinks are enabled (#64) + * Stop sorting categories (#33) == 0.5.7 / 2010-01-12 * Minor Enhancements diff --git a/features/post_data.feature b/features/post_data.feature index 1751f3f4..36fe9382 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -82,17 +82,17 @@ Feature: Post data And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html" Scenario: Use post.categories variable when categories are in folders - Given I have a movies directory - And I have a movies/scifi directory - And I have a movies/scifi/_posts directory + Given I have a scifi directory + And I have a scifi/movies directory + And I have a scifi/movies/_posts directory And I have a _layouts directory - And I have the following post in "movies/scifi": + And I have the following post in "scifi/movies": | title | date | layout | content | | Star Wars | 3/27/2009 | simple | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll Then the _site directory should exist - And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html" + And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in YAML Given I have a _posts directory @@ -110,11 +110,11 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | categories | content | - | Star Wars | 3/27/2009 | simple | ['movies', 'scifi'] | Luke, I am your father. | + | Star Wars | 3/27/2009 | simple | ['scifi', 'movies'] | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll Then the _site directory should exist - And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html" + And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" Scenario: Disable a post from being published Given I have a _posts directory diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index d711b67d..1e7238b4 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -124,7 +124,7 @@ module Jekyll "month" => date.strftime("%m"), "day" => date.strftime("%d"), "title" => CGI.escape(slug), - "categories" => categories.sort.join('/') + "categories" => categories.join('/') }.inject(template) { |result, token| result.gsub(/:#{token.first}/, token.last) }.gsub(/\/\//, "/") diff --git a/test/test_post.rb b/test/test_post.rb index 05f17e40..f57f530d 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -131,7 +131,7 @@ class TestPost < Test::Unit::TestCase should "process the url correctly" do assert_equal "/:categories/:year/:month/:day/:title.html", @post.template - assert_equal "/beer/food/2008/10/19/foo-bar.html", @post.url + assert_equal "/food/beer/2008/10/19/foo-bar.html", @post.url end end