diff --git a/lib/jekyll/readers/post_reader.rb b/lib/jekyll/readers/post_reader.rb index f7a44ca7..ec5bc7ad 100644 --- a/lib/jekyll/readers/post_reader.rb +++ b/lib/jekyll/readers/post_reader.rb @@ -12,7 +12,7 @@ module Jekyll # # Returns nothing. def read_drafts(dir) - read_publishable(dir, '_drafts', Document::DATELESS_FILENAME_MATCHER) + read_publishable(dir, "_drafts", Document::DATELESS_FILENAME_MATCHER) end # Read all the files in //_posts and create a new Document @@ -22,7 +22,7 @@ module Jekyll # # Returns nothing. def read_posts(dir) - read_publishable(dir, '_posts', Document::DATE_FILENAME_MATCHER) + read_publishable(dir, "_posts", Document::DATE_FILENAME_MATCHER) end # Read all the files in // and create a new @@ -32,9 +32,10 @@ module Jekyll # # Returns nothing. def read_publishable(dir, magic_dir, matcher) - read_content(dir, magic_dir, matcher).tap do |docs| + documents = read_content(dir, magic_dir, matcher).tap do |docs| docs.each(&:read) - end.select do |doc| + end + documents.select do |doc| site.publisher.publish?(doc).tap do |will_publish| if !will_publish && site.publisher.hidden_in_the_future?(doc) Jekyll.logger.debug "Skipping:", "#{doc.relative_path} has a future date" @@ -57,7 +58,7 @@ module Jekyll next unless entry =~ matcher path = @site.in_source_dir(File.join(dir, magic_dir, entry)) Document.new(path, { - :site => @site, + :site => @site, :collection => @site.posts }) end.reject(&:nil?)