diff --git a/features/collections.feature b/features/collections.feature index 4eb526d3..451c84d8 100644 --- a/features/collections.feature +++ b/features/collections.feature @@ -4,15 +4,15 @@ Feature: Collections And render them Scenario: Unrendered collection - Given I have an "index.html" page that contains "Collections: {{ site.collections }}" + Given I have an "index.html" page that contains "Collections: {{ site.methods }}" And I have fixture collections And I have a configuration file with "collections" set to "['methods']" When I run jekyll Then the _site directory should exist - And I should see "Collections: {\"methods\"=>#, #, #, #, #\]>}" in "_site/index.html" + And I should see "Collections: Use `{{ page.title }}` to build a full configuration for use w/Jekyll.\n\nWhatever: {{ page.whatever }}\n`{{ page.title }}` is used to make sure your path is in your source.\nRun your generators! {{ page.layout }}\nCreate dat site.\nRun your generators! {{ page.layout }}" in "_site/index.html" Scenario: Rendered collection - Given I have an "index.html" page that contains "Collections: {{ site.collections.methods.label }}" + Given I have an "index.html" page that contains "Collections: {{ site.collections }}" And I have fixture collections And I have a configuration file with: | key | value | @@ -24,7 +24,7 @@ Feature: Collections And I should see "

Whatever: foo.bar

" in "_site/methods/configuration.html" Scenario: Rendered document in a layout - Given I have an "index.html" page that contains "Collections: {{ site.collections.methods.label }}" + Given I have an "index.html" page that contains "Collections: {{ site.collections }}" And I have a default layout that contains "
Tom Preston-Werner
{{content}}" And I have fixture collections And I have a configuration file with: diff --git a/lib/jekyll/collection.rb b/lib/jekyll/collection.rb index 1aa563e7..6f9be70e 100644 --- a/lib/jekyll/collection.rb +++ b/lib/jekyll/collection.rb @@ -86,10 +86,7 @@ module Jekyll # # Returns a representation of this collection for use in Liquid. def to_liquid - { - "label" => label, - "docs" => docs - } + docs end end diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 97a2360a..c35b9101 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -209,6 +209,13 @@ module Jekyll "#" end + # The string representation for this document. + # + # Returns the content of the document + def to_s + output || content + end + # Compare this document against another document. # Comparison is a comparison between the 2 paths of the documents. # diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 2bdf1898..7b84b8b9 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -215,8 +215,8 @@ module Jekyll def render relative_permalinks_deprecation_method - collections.each do |label, collection| - collection.docs.each do |document| + to_render.each do |label| + collections[label].docs.each do |document| document.output = Jekyll::Renderer.new(self, document).run end end @@ -296,7 +296,8 @@ module Jekyll # See Site#post_attr_hash for type info. def site_payload {"jekyll" => { "version" => Jekyll::VERSION }, - "site" => config.merge({ + "site" => Utils.deep_merge_hashes(config, + Utils.deep_merge_hashes(collections, { "time" => time, "posts" => posts.sort { |a, b| b <=> a }, "pages" => pages, @@ -304,8 +305,9 @@ module Jekyll "html_pages" => pages.reject { |page| !page.html? }, "categories" => post_attr_hash('categories'), "tags" => post_attr_hash('tags'), - "data" => site_data, - "collections" => collections})} + "data" => site_data + })) + } end # Filter out any files/directories that are hidden or backup files (start