Merge pull request #4311 from jekyll/use-drop-hash-accessor
Merge pull request 4311
This commit is contained in:
commit
378ec5a4b8
|
@ -89,7 +89,7 @@ Feature: Hooks
|
||||||
And I have a "_plugins/ext.rb" file with content:
|
And I have a "_plugins/ext.rb" file with content:
|
||||||
"""
|
"""
|
||||||
Jekyll::Hooks.register :pages, :pre_render do |page, payload|
|
Jekyll::Hooks.register :pages, :pre_render do |page, payload|
|
||||||
payload.page['myparam'] = 'special' if page.name == 'page1.html'
|
payload['page']['myparam'] = 'special' if page.name == 'page1.html'
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
And I have a "page1.html" page that contains "{{ page.myparam }}"
|
And I have a "page1.html" page that contains "{{ page.myparam }}"
|
||||||
|
|
|
@ -210,8 +210,8 @@ module Jekyll
|
||||||
|
|
||||||
while layout
|
while layout
|
||||||
Jekyll.logger.debug "Rendering Layout:", path
|
Jekyll.logger.debug "Rendering Layout:", path
|
||||||
payload.content = output
|
payload["content"] = output
|
||||||
payload.layout = layout.data
|
payload["layout"] = Utils.deep_merge_hashes(payload["layout"] || {}, layout.data)
|
||||||
|
|
||||||
self.output = render_liquid(layout.content,
|
self.output = render_liquid(layout.content,
|
||||||
payload,
|
payload,
|
||||||
|
@ -236,7 +236,7 @@ module Jekyll
|
||||||
|
|
||||||
# Add any necessary layouts to this convertible document.
|
# Add any necessary layouts to this convertible document.
|
||||||
#
|
#
|
||||||
# payload - The site payload Hash.
|
# payload - The site payload Drop or Hash.
|
||||||
# layouts - A Hash of {"name" => "layout"}.
|
# layouts - A Hash of {"name" => "layout"}.
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
|
@ -245,11 +245,11 @@ module Jekyll
|
||||||
|
|
||||||
Jekyll.logger.debug "Pre-Render Hooks:", self.relative_path
|
Jekyll.logger.debug "Pre-Render Hooks:", self.relative_path
|
||||||
Jekyll::Hooks.trigger hook_owner, :pre_render, self, payload
|
Jekyll::Hooks.trigger hook_owner, :pre_render, self, payload
|
||||||
info = { :filters => [Jekyll::Filters], :registers => { :site => site, :page => payload.page } }
|
info = { :filters => [Jekyll::Filters], :registers => { :site => site, :page => payload["page"] } }
|
||||||
|
|
||||||
# render and transform content (this becomes the final content of the object)
|
# render and transform content (this becomes the final content of the object)
|
||||||
payload.highlighter_prefix = converters.first.highlighter_prefix
|
payload["highlighter_prefix"] = converters.first.highlighter_prefix
|
||||||
payload.highlighter_suffix = converters.first.highlighter_suffix
|
payload["highlighter_suffix"] = converters.first.highlighter_suffix
|
||||||
|
|
||||||
if render_with_liquid?
|
if render_with_liquid?
|
||||||
Jekyll.logger.debug "Rendering Liquid:", self.relative_path
|
Jekyll.logger.debug "Rendering Liquid:", self.relative_path
|
||||||
|
|
|
@ -116,8 +116,8 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def render(layouts, site_payload)
|
def render(layouts, site_payload)
|
||||||
site_payload.page = to_liquid
|
site_payload["page"] = to_liquid
|
||||||
site_payload.paginator = pager.to_liquid
|
site_payload["paginator"] = pager.to_liquid
|
||||||
|
|
||||||
do_layout(site_payload, layouts)
|
do_layout(site_payload, layouts)
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,23 +32,23 @@ module Jekyll
|
||||||
def run
|
def run
|
||||||
Jekyll.logger.debug "Rendering:", document.relative_path
|
Jekyll.logger.debug "Rendering:", document.relative_path
|
||||||
|
|
||||||
payload.page = document.to_liquid
|
payload["page"] = document.to_liquid
|
||||||
|
|
||||||
if document.collection.label == 'posts' && document.is_a?(Document)
|
if document.collection.label == 'posts' && document.is_a?(Document)
|
||||||
payload.site['related_posts'] = document.related_posts
|
payload['site']['related_posts'] = document.related_posts
|
||||||
end
|
end
|
||||||
|
|
||||||
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
|
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
|
||||||
document.trigger_hooks(:pre_render, payload)
|
document.trigger_hooks(:pre_render, payload)
|
||||||
|
|
||||||
info = {
|
info = {
|
||||||
:filters => [Jekyll::Filters],
|
:filters => [Jekyll::Filters],
|
||||||
:registers => { :site => site, :page => payload.page }
|
:registers => { :site => site, :page => payload['page'] }
|
||||||
}
|
}
|
||||||
|
|
||||||
# render and transform content (this becomes the final content of the object)
|
# render and transform content (this becomes the final content of the object)
|
||||||
payload.highlighter_prefix = converters.first.highlighter_prefix
|
payload['highlighter_prefix'] = converters.first.highlighter_prefix
|
||||||
payload.highlighter_suffix = converters.first.highlighter_suffix
|
payload['highlighter_suffix'] = converters.first.highlighter_suffix
|
||||||
|
|
||||||
output = document.content
|
output = document.content
|
||||||
|
|
||||||
|
@ -132,9 +132,9 @@ module Jekyll
|
||||||
used = Set.new([layout])
|
used = Set.new([layout])
|
||||||
|
|
||||||
while layout
|
while layout
|
||||||
payload.content = output
|
payload['content'] = output
|
||||||
payload.page = document.to_liquid
|
payload['page'] = document.to_liquid
|
||||||
payload.layout = layout.data
|
payload['layout'] = Utils.deep_merge_hashes(payload['layout'] || {}, layout.data)
|
||||||
|
|
||||||
output = render_liquid(
|
output = render_liquid(
|
||||||
layout.content,
|
layout.content,
|
||||||
|
|
Loading…
Reference in New Issue