Merge commit '0a1e3cd2508c797d7b8d1038636a6e7111e5cd3d'. Fixes #33.

Conflicts:
	features/post_data.feature
This commit is contained in:
Tom Preston-Werner 2010-01-14 20:00:19 -08:00
commit a4f3f5c583
4 changed files with 10 additions and 9 deletions

View File

@ -4,6 +4,7 @@
* Expand source to full path so includes work anywhere (#101) * Expand source to full path so includes work anywhere (#101)
* Fix highlighting on Ruby 1.9 (#65) * Fix highlighting on Ruby 1.9 (#65)
* Fix extension munging when pretty permalinks are enabled (#64) * Fix extension munging when pretty permalinks are enabled (#64)
* Stop sorting categories (#33)
== 0.5.7 / 2010-01-12 == 0.5.7 / 2010-01-12
* Minor Enhancements * Minor Enhancements

View File

@ -82,17 +82,17 @@ Feature: Post data
And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html" 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 Scenario: Use post.categories variable when categories are in folders
Given I have a movies directory Given I have a scifi directory
And I have a movies/scifi directory And I have a scifi/movies directory
And I have a movies/scifi/_posts directory And I have a scifi/movies/_posts directory
And I have a _layouts 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 | | title | date | layout | content |
| Star Wars | 3/27/2009 | simple | Luke, I am your father. | | 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 }}" And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll When I run jekyll
Then the _site directory should exist 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 Scenario: Use post.categories variable when category is in YAML
Given I have a _posts directory Given I have a _posts directory
@ -110,11 +110,11 @@ Feature: Post data
And I have a _layouts directory And I have a _layouts directory
And I have the following post: And I have the following post:
| title | date | layout | categories | content | | 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 }}" And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll When I run jekyll
Then the _site directory should exist 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 Scenario: Disable a post from being published
Given I have a _posts directory Given I have a _posts directory

View File

@ -124,7 +124,7 @@ module Jekyll
"month" => date.strftime("%m"), "month" => date.strftime("%m"),
"day" => date.strftime("%d"), "day" => date.strftime("%d"),
"title" => CGI.escape(slug), "title" => CGI.escape(slug),
"categories" => categories.sort.join('/') "categories" => categories.join('/')
}.inject(template) { |result, token| }.inject(template) { |result, token|
result.gsub(/:#{token.first}/, token.last) result.gsub(/:#{token.first}/, token.last)
}.gsub(/\/\//, "/") }.gsub(/\/\//, "/")

View File

@ -131,7 +131,7 @@ class TestPost < Test::Unit::TestCase
should "process the url correctly" do should "process the url correctly" do
assert_equal "/:categories/:year/:month/:day/:title.html", @post.template 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
end end