Homagah it all renders I think.
This commit is contained in:
parent
a15a584136
commit
37a7236e20
|
@ -7,7 +7,7 @@ Feature: Collections
|
|||
Given I have an "index.html" page that contains "Collections: {{ site.collections }}"
|
||||
And I have fixture collections
|
||||
And I have a configuration file with "collections" set to "['methods']"
|
||||
When I debug jekyll
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Collections: {\"methods\"=>#<Jekyll::Collection @label=methods docs=\[#<Jekyll::Document _methods/configuration.md collection=methods>, #<Jekyll::Document _methods/sanitized_path.md collection=methods>, #<Jekyll::Document _methods/site/generate.md collection=methods>, #<Jekyll::Document _methods/site/initialize.md collection=methods>, #<Jekyll::Document _methods/um_hi.md collection=methods>\]>}" in "_site/index.html"
|
||||
|
||||
|
@ -21,4 +21,18 @@ Feature: Collections
|
|||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Collections: methods" in "_site/index.html"
|
||||
And I should see "Whatever: foo.bar" in "_site/methods/configuration.html"
|
||||
And I should see "<p>Whatever: foo.bar</p>" 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 }}"
|
||||
And I have a default layout that contains "<div class='title'>Tom Preston-Werner</div> {{content}}"
|
||||
And I have fixture collections
|
||||
And I have a configuration file with:
|
||||
| key | value |
|
||||
| collections | ['methods'] |
|
||||
| render | ['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 "<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"
|
|
@ -31,6 +31,7 @@ module Jekyll
|
|||
payload = Utils.deep_merge_hashes({
|
||||
"page" => document.to_liquid
|
||||
}, site.site_payload)
|
||||
|
||||
info = {
|
||||
filters: [Jekyll::Filters],
|
||||
registers: { :site => site, :page => payload['page'] }
|
||||
|
@ -117,7 +118,7 @@ module Jekyll
|
|||
File.join(site.config['layouts'], layout.name)
|
||||
)
|
||||
|
||||
if layout = layouts[layout.data["layout"]]
|
||||
if layout = site.layouts[layout.data["layout"]]
|
||||
if used.include?(layout)
|
||||
layout = nil # avoid recursive chain
|
||||
else
|
||||
|
|
|
@ -92,7 +92,7 @@ module Jekyll
|
|||
end
|
||||
end
|
||||
|
||||
def render
|
||||
def to_render
|
||||
config['render'] || Array.new
|
||||
end
|
||||
|
||||
|
@ -197,9 +197,7 @@ module Jekyll
|
|||
#
|
||||
# Returns nothing.
|
||||
def read_collections
|
||||
if collections
|
||||
collections.each { |_, collection| collection.read }
|
||||
end
|
||||
collections.each { |_, collection| collection.read }
|
||||
end
|
||||
|
||||
# Run each of the Generators.
|
||||
|
@ -217,11 +215,9 @@ module Jekyll
|
|||
def render
|
||||
relative_permalinks_deprecation_method
|
||||
|
||||
if collections
|
||||
collections.each do |label, collection|
|
||||
collection.docs.each do |document|
|
||||
document.output = Jekyll::Renderer.new(self, document).run
|
||||
end
|
||||
collections.each do |label, collection|
|
||||
collection.docs.each do |document|
|
||||
document.output = Jekyll::Renderer.new(self, document).run
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -389,11 +385,9 @@ module Jekyll
|
|||
|
||||
def documents
|
||||
docs = Set.new
|
||||
if collections
|
||||
collections.each do |label, coll|
|
||||
if render.include?(label)
|
||||
docs = docs.merge(coll.docs)
|
||||
end
|
||||
collections.each do |label, coll|
|
||||
if to_render.include?(label)
|
||||
docs = docs.merge(coll.docs)
|
||||
end
|
||||
end
|
||||
docs
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
title: "Site#generate"
|
||||
layout: default
|
||||
---
|
||||
|
||||
Run your generators!
|
||||
Run your generators! {{ page.layout }}
|
||||
|
|
|
@ -12,7 +12,7 @@ class TestCollections < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
should "not contain any collections" do
|
||||
assert_nil @site.collections
|
||||
assert_equal @site.collections, Hash.new
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'helper'
|
|||
|
||||
class TestDocument < Test::Unit::TestCase
|
||||
|
||||
context "" do
|
||||
context "a document in a collection" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"collections" => ["methods"],
|
||||
|
@ -42,4 +42,7 @@ class TestDocument < Test::Unit::TestCase
|
|||
|
||||
end
|
||||
|
||||
context " a document part of a rendered collection" do
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue