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 }}"
|
Given I have an "index.html" page that contains "Collections: {{ site.collections }}"
|
||||||
And I have fixture collections
|
And I have fixture collections
|
||||||
And I have a configuration file with "collections" set to "['methods']"
|
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
|
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"
|
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
|
When I run jekyll
|
||||||
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: 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({
|
payload = Utils.deep_merge_hashes({
|
||||||
"page" => document.to_liquid
|
"page" => document.to_liquid
|
||||||
}, site.site_payload)
|
}, site.site_payload)
|
||||||
|
|
||||||
info = {
|
info = {
|
||||||
filters: [Jekyll::Filters],
|
filters: [Jekyll::Filters],
|
||||||
registers: { :site => site, :page => payload['page'] }
|
registers: { :site => site, :page => payload['page'] }
|
||||||
|
@ -117,7 +118,7 @@ module Jekyll
|
||||||
File.join(site.config['layouts'], layout.name)
|
File.join(site.config['layouts'], layout.name)
|
||||||
)
|
)
|
||||||
|
|
||||||
if layout = layouts[layout.data["layout"]]
|
if layout = site.layouts[layout.data["layout"]]
|
||||||
if used.include?(layout)
|
if used.include?(layout)
|
||||||
layout = nil # avoid recursive chain
|
layout = nil # avoid recursive chain
|
||||||
else
|
else
|
||||||
|
|
|
@ -92,7 +92,7 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render
|
def to_render
|
||||||
config['render'] || Array.new
|
config['render'] || Array.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -197,10 +197,8 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def read_collections
|
def read_collections
|
||||||
if collections
|
|
||||||
collections.each { |_, collection| collection.read }
|
collections.each { |_, collection| collection.read }
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Run each of the Generators.
|
# Run each of the Generators.
|
||||||
#
|
#
|
||||||
|
@ -217,13 +215,11 @@ module Jekyll
|
||||||
def render
|
def render
|
||||||
relative_permalinks_deprecation_method
|
relative_permalinks_deprecation_method
|
||||||
|
|
||||||
if collections
|
|
||||||
collections.each do |label, collection|
|
collections.each do |label, collection|
|
||||||
collection.docs.each do |document|
|
collection.docs.each do |document|
|
||||||
document.output = Jekyll::Renderer.new(self, document).run
|
document.output = Jekyll::Renderer.new(self, document).run
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
payload = site_payload
|
payload = site_payload
|
||||||
[posts, pages].flatten.each do |page_or_post|
|
[posts, pages].flatten.each do |page_or_post|
|
||||||
|
@ -389,13 +385,11 @@ module Jekyll
|
||||||
|
|
||||||
def documents
|
def documents
|
||||||
docs = Set.new
|
docs = Set.new
|
||||||
if collections
|
|
||||||
collections.each do |label, coll|
|
collections.each do |label, coll|
|
||||||
if render.include?(label)
|
if to_render.include?(label)
|
||||||
docs = docs.merge(coll.docs)
|
docs = docs.merge(coll.docs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
docs
|
docs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
title: "Site#generate"
|
title: "Site#generate"
|
||||||
|
layout: default
|
||||||
---
|
---
|
||||||
|
|
||||||
Run your generators!
|
Run your generators! {{ page.layout }}
|
||||||
|
|
|
@ -12,7 +12,7 @@ class TestCollections < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not contain any collections" do
|
should "not contain any collections" do
|
||||||
assert_nil @site.collections
|
assert_equal @site.collections, Hash.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'helper'
|
||||||
|
|
||||||
class TestDocument < Test::Unit::TestCase
|
class TestDocument < Test::Unit::TestCase
|
||||||
|
|
||||||
context "" do
|
context "a document in a collection" do
|
||||||
setup do
|
setup do
|
||||||
@site = Site.new(Jekyll.configuration({
|
@site = Site.new(Jekyll.configuration({
|
||||||
"collections" => ["methods"],
|
"collections" => ["methods"],
|
||||||
|
@ -42,4 +42,7 @@ class TestDocument < Test::Unit::TestCase
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context " a document part of a rendered collection" do
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue