Extracted `limit_posts` 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:
parent
a4adeb446b
commit
9bcad08e3a
|
@ -161,5 +161,12 @@ module Jekyll
|
|||
def aggregate_post_info(post)
|
||||
site.posts << post
|
||||
end
|
||||
|
||||
|
||||
def limit_posts()
|
||||
limit = site.posts.length < site.limit_posts ? site.posts.length : site.limit_posts
|
||||
site.posts = site.posts[-limit, limit]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -149,7 +149,7 @@ module Jekyll
|
|||
reader.read_posts(dir)
|
||||
reader.read_drafts(dir) if show_drafts
|
||||
posts.sort!
|
||||
limit_posts! if limit_posts > 0 # limit the posts if :limit_posts option is set
|
||||
reader.limit_posts() if limit_posts > 0 # limit the posts if :limit_posts option is set
|
||||
|
||||
entries.each do |f|
|
||||
f_abs = reader.in_source_dir(base, f)
|
||||
|
@ -374,11 +374,6 @@ module Jekyll
|
|||
pages.any? { |page| page.uses_relative_permalinks }
|
||||
end
|
||||
|
||||
def limit_posts!
|
||||
limit = posts.length < limit_posts ? posts.length : limit_posts
|
||||
self.posts = posts[-limit, limit]
|
||||
end
|
||||
|
||||
def site_cleaner
|
||||
@site_cleaner ||= Cleaner.new(self)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue