Proxy Convertible#render_all_layouts to Renderer.place_in_layouts

This commit is contained in:
Parker Moore 2016-08-30 14:04:57 -07:00
parent 17883b77c6
commit b781b9967d
No known key found for this signature in database
GPG Key ID: 193CDEBA72063C58
2 changed files with 7 additions and 36 deletions

View File

@ -4,7 +4,6 @@ AllCops:
Include: Include:
- lib/**/*.rb - lib/**/*.rb
Exclude: Exclude:
- lib/jekyll/convertible.rb
- lib/jekyll/renderer.rb - lib/jekyll/renderer.rb
- bin/**/* - bin/**/*
- benchmark/**/* - benchmark/**/*

View File

@ -95,7 +95,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
Jekyll::Renderer.new(site, self).output_ext _renderer.output_ext
end end
# Determine which converter to use based on this convertible's # Determine which converter to use based on this convertible's
@ -211,40 +211,7 @@ module Jekyll
# #
# Returns nothing # Returns nothing
def render_all_layouts(layouts, payload, info) def render_all_layouts(layouts, payload, info)
# recursively render layouts _renderer.place_in_layouts(output, payload, info)
layout = layouts[data["layout"]]
Jekyll.logger.warn(
"Build Warning:",
"Layout '#{data["layout"]}' requested in #{path} does not exist."
) if invalid_layout? layout
used = Set.new([layout])
# Reset the payload layout data to ensure it starts fresh for each page.
payload["layout"] = nil
while layout
Jekyll.logger.debug "Rendering Layout:", path
payload["content"] = output
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
self.output = render_liquid(layout.content,
payload,
info,
layout.relative_path)
# Add layout to dependency tree
site.regenerator.add_dependency(
site.in_source_dir(path),
site.in_source_dir(layout.path)
)
if (layout = layouts[layout.data["layout"]])
break if used.include?(layout)
used << layout
end
end
end end
# Add any necessary layouts to this convertible document. # Add any necessary layouts to this convertible document.
@ -306,5 +273,10 @@ module Jekyll
data[property] data[property]
end end
end end
private
def _renderer
@_renderer ||= Jekyll::Renderer.new(site, self)
end
end end
end end