mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-30 01:08:26 -05:00
Extracted read_content from site.rb into reader.rb
- Extracted - Updated References - Ran Tests Signed-off-by: Martin Jorn Rogalla <martin@martinrogalla.com>
This commit is contained in:
@@ -74,6 +74,14 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
def read_content(dir, magic_dir, klass)
|
||||
get_entries(dir, magic_dir).map do |entry|
|
||||
klass.new(site, site.source, dir, entry) if klass.valid?(entry)
|
||||
end.reject do |entry|
|
||||
entry.nil?
|
||||
end
|
||||
end
|
||||
|
||||
# Read and parse all yaml files under <source>/<dir>
|
||||
#
|
||||
# Returns nothing
|
||||
|
||||
@@ -175,7 +175,7 @@ module Jekyll
|
||||
#
|
||||
# Returns nothing.
|
||||
def read_posts(dir)
|
||||
posts = read_content(dir, '_posts', Post)
|
||||
posts = reader.read_content(dir, '_posts', Post)
|
||||
|
||||
posts.each do |post|
|
||||
aggregate_post_info(post) if publisher.publish?(post)
|
||||
@@ -189,7 +189,7 @@ module Jekyll
|
||||
#
|
||||
# Returns nothing.
|
||||
def read_drafts(dir)
|
||||
drafts = read_content(dir, '_drafts', Draft)
|
||||
drafts = reader.read_content(dir, '_drafts', Draft)
|
||||
|
||||
drafts.each do |draft|
|
||||
if draft.published?
|
||||
@@ -198,14 +198,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
def read_content(dir, magic_dir, klass)
|
||||
reader.get_entries(dir, magic_dir).map do |entry|
|
||||
klass.new(self, source, dir, entry) if klass.valid?(entry)
|
||||
end.reject do |entry|
|
||||
entry.nil?
|
||||
end
|
||||
end
|
||||
|
||||
# Read in all collections specified in the configuration
|
||||
#
|
||||
# Returns nothing.
|
||||
|
||||
Reference in New Issue
Block a user