Use the 'output' key instead of 'write' for writing out collections' document files.

This commit is contained in:
Parker Moore 2014-04-25 19:47:35 -04:00
parent 2ccf7f1cfb
commit 6225073095
3 changed files with 19 additions and 6 deletions

View File

@ -20,7 +20,7 @@ Feature: Collections
"""
collections:
methods:
write: true
output: true
foo: bar
"""
When I run jekyll build
@ -37,7 +37,7 @@ Feature: Collections
"""
collections:
methods:
write: true
output: true
foo: bar
"""
When I run jekyll build
@ -46,7 +46,7 @@ Feature: Collections
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"
Scenario: Collections directly on the site
Scenario: Collections specified as an array
Given I have an "index.html" page that contains "Collections: {% for method in site.methods %}{{ method.relative_path }} {% endfor %}"
And I have fixture collections
And I have a "_config.yml" file with content:
@ -57,3 +57,16 @@ Feature: Collections
When I run jekyll build
Then the _site directory should exist
And I should see "Collections: _methods/configuration.md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html"
Scenario: Collections specified as an hash
Given I have an "index.html" page that contains "Collections: {% for method in site.methods %}{{ method.relative_path }} {% endfor %}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
methods:
baz: bin
"""
When I run jekyll build
Then the _site directory should exist
And I should see "Collections: _methods/configuration.md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html"

View File

@ -129,7 +129,7 @@ module Jekyll
#
# Returns true if the 'write' metadata is true, false otherwise.
def write?
!!metadata['write']
!!metadata['output']
end
# Extract options for this collection from the site configuration.

View File

@ -74,9 +74,9 @@ class TestCollections < Test::Unit::TestCase
should "know whether it should be written or not" do
assert_equal @collection.write?, false
@collection.metadata['write'] = true
@collection.metadata['output'] = true
assert_equal @collection.write?, true
@collection.metadata.delete 'write'
@collection.metadata.delete 'output'
end
end