Page: pipe through Renderer instead of using Convertible

This commit is contained in:
Parker Moore 2016-01-18 11:41:05 -08:00
parent 9676b775de
commit d343da61eb
4 changed files with 10 additions and 9 deletions

View File

@ -97,13 +97,7 @@ module Jekyll
# Returns the String extension for the output file. # Returns the String extension for the output file.
# e.g. ".html" for an HTML output file. # e.g. ".html" for an HTML output file.
def output_ext def output_ext
if converters.all? { |c| c.is_a?(Jekyll::Converters::Identity) } Jekyll::Renderer.new(site, self).output_ext
ext
else
converters.map do |c|
c.output_ext(ext) unless c.is_a?(Jekyll::Converters::Identity)
end.compact.last
end
end end
# Determine which converter to use based on this convertible's # Determine which converter to use based on this convertible's

View File

@ -7,6 +7,8 @@ module Jekyll
attr_accessor :name, :ext, :basename attr_accessor :name, :ext, :basename
attr_accessor :data, :content, :output attr_accessor :data, :content, :output
alias_method :extname, :ext
# Attributes for Liquid templates # Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w( ATTRIBUTES_FOR_LIQUID = %w(
content content
@ -160,5 +162,9 @@ module Jekyll
def index? def index?
basename == 'index' basename == 'index'
end end
def trigger_hooks(hook_name, *args)
Jekyll::Hooks.trigger :pages, hook_name, self, *args
end
end end
end end

View File

@ -38,7 +38,7 @@ module Jekyll
payload["page"] = document.to_liquid payload["page"] = document.to_liquid
if document.collection.label == 'posts' && document.is_a?(Document) if document.is_a?(Document) && document.collection.label == 'posts'
payload['site']['related_posts'] = document.related_posts payload['site']['related_posts'] = document.related_posts
end end

View File

@ -176,7 +176,8 @@ module Jekyll
pages.flatten.each do |page| pages.flatten.each do |page|
if regenerator.regenerate?(page) if regenerator.regenerate?(page)
page.render(layouts, payload) page.output = Jekyll::Renderer.new(self, page, payload).run
page.trigger_hooks(:post_render)
end end
end end