mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-06 03:01:43 -04:00
Merge pull request #3172 from alfredxing/docs-output-overrides
This commit is contained in:
@@ -40,7 +40,7 @@ module Jekyll
|
||||
if Utils.has_yaml_header? full_path
|
||||
doc = Jekyll::Document.new(full_path, { site: site, collection: self })
|
||||
doc.read
|
||||
docs << doc
|
||||
docs << doc if site.publisher.publish?(doc)
|
||||
else
|
||||
relative_dir = Jekyll.sanitized_path(relative_directory, File.dirname(file_path)).chomp("/.")
|
||||
files << StaticFile.new(site, site.source, relative_dir, File.basename(full_path), self)
|
||||
@@ -183,6 +183,5 @@ module Jekyll
|
||||
{}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -494,6 +494,10 @@ module Jekyll
|
||||
override['full_rebuild'] || config['full_rebuild']
|
||||
end
|
||||
|
||||
def publisher
|
||||
@publisher ||= Publisher.new(self)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def has_relative_page?
|
||||
@@ -514,9 +518,5 @@ module Jekyll
|
||||
name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
|
||||
name.gsub(/\s+/, '_')
|
||||
end
|
||||
|
||||
def publisher
|
||||
@publisher ||= Publisher.new(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
7
test/source/_slides/non-outputted-slide.html
Normal file
7
test/source/_slides/non-outputted-slide.html
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Non outputted slide
|
||||
layout: slide
|
||||
published: false
|
||||
---
|
||||
|
||||
This should not be output
|
||||
@@ -241,6 +241,34 @@ class TestDocument < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "documents in a collection" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true
|
||||
}
|
||||
},
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir
|
||||
}))
|
||||
@site.process
|
||||
@files = @site.collections["slides"].docs
|
||||
end
|
||||
|
||||
context "without output overrides" do
|
||||
should "be output according to collection defaults" do
|
||||
assert_not_nil @files.find { |doc| doc.relative_path == "_slides/example-slide-4.html" }
|
||||
end
|
||||
end
|
||||
|
||||
context "with output overrides" do
|
||||
should "be output according its front matter" do
|
||||
assert_nil @files.find { |doc| doc.relative_path == "_slides/non-outputted-slide.html" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "a static file in a collection" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
|
||||
Reference in New Issue
Block a user