Merge pull request #3670 from jekyll/bernardodiasc-collections

Merge pull request 3670
This commit is contained in:
Parker Moore 2015-04-29 13:47:35 -07:00
commit e5bbdb1c83
2 changed files with 6 additions and 4 deletions

View File

@ -14,7 +14,7 @@ Feature: Collections
Scenario: Rendered collection Scenario: Rendered collection
Given I have an "index.html" page that contains "Collections: {{ site.collections }}" Given I have an "index.html" page that contains "Collections: {{ site.collections }}"
And I have an "collection_metadata.html" page that contains "Methods metadata: {{ site.collections.methods.foo }} {{ site.collections.methods }}" And I have an "collection_metadata.html" page that contains "Methods metadata: {{ site.collections[0].foo }} {{ site.collections[0] }}"
And I have fixture collections And I have fixture collections
And I have a "_config.yml" file with content: And I have a "_config.yml" file with content:
""" """
@ -25,7 +25,8 @@ Feature: Collections
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then the _site directory should exist
And I should see "Collections: {\"methods" in "_site/index.html" And I should see "Collections: {\"output\"=>true" in "_site/index.html"
And I should see "\"label\"=>\"methods\"," in "_site/index.html"
And I should see "Methods metadata: bar" in "_site/collection_metadata.html" And I should see "Methods metadata: bar" in "_site/collection_metadata.html"
And I should see "<p>Whatever: foo.bar</p>" in "_site/methods/configuration.html" And I should see "<p>Whatever: foo.bar</p>" in "_site/methods/configuration.html"
@ -56,7 +57,8 @@ Feature: Collections
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then the _site directory should exist
And I should see "Collections: {\"methods" in "_site/index.html" And I should see "Collections: {\"output\"=>true" in "_site/index.html"
And I should see "\"label\"=>\"methods\"," in "_site/index.html"
And I should see "<p>Run your generators! default</p>" in "_site/methods/site/generate.html" And I should see "<p>Run your generators! default</p>" in "_site/methods/site/generate.html"
And I should see "<div class='title'>Tom Preston-Werner</div>" in "_site/methods/site/generate.html" And I should see "<div class='title'>Tom Preston-Werner</div>" in "_site/methods/site/generate.html"

View File

@ -251,7 +251,7 @@ module Jekyll
"html_pages" => pages.select { |page| page.html? || page.url.end_with?("/") }, "html_pages" => pages.select { |page| page.html? || page.url.end_with?("/") },
"categories" => post_attr_hash('categories'), "categories" => post_attr_hash('categories'),
"tags" => post_attr_hash('tags'), "tags" => post_attr_hash('tags'),
"collections" => collections, "collections" => collections.values.map(&:to_liquid),
"documents" => documents, "documents" => documents,
"data" => site_data "data" => site_data
})) }))