Merge pull request #1638 from maul-esel/render-page-or-post

Refactor Site#render
This commit is contained in:
Matt Rogers 2013-10-17 06:21:10 -07:00
commit 1fd549c01f
1 changed files with 9 additions and 9 deletions

View File

@ -231,14 +231,11 @@ module Jekyll
#
# Returns nothing.
def render
payload = site_payload
self.posts.each do |post|
post.render(self.layouts, payload)
end
relative_permalinks_deprecation_method
self.pages.each do |page|
relative_permalinks_deprecation_method if page.uses_relative_permalinks
page.render(self.layouts, payload)
payload = site_payload
[self.posts, self.pages].flatten.each do |page_or_post|
page_or_post.render(self.layouts, payload)
end
self.categories.values.map { |ps| ps.sort! { |a, b| b <=> a } }
@ -389,7 +386,7 @@ module Jekyll
end
def relative_permalinks_deprecation_method
if config['relative_permalinks'] && !@deprecated_relative_permalinks
if config['relative_permalinks'] && has_relative_page?
$stderr.puts # Places newline after "Generating..."
Jekyll.logger.warn "Deprecation:", "Starting in 1.1, permalinks for pages" +
" in subfolders must be relative to the" +
@ -397,7 +394,6 @@ module Jekyll
" directory. Check http://jekyllrb.com/docs/upgrading/"+
" for more info."
$stderr.print Jekyll.logger.formatted_topic("") + "..." # for "done."
@deprecated_relative_permalinks = true
end
end
@ -411,6 +407,10 @@ module Jekyll
private
def has_relative_page?
self.pages.any? { |page| page.uses_relative_permalinks }
end
def has_yaml_header?(file)
"---" == File.open(file) { |fd| fd.read(3) }
end