output correct path in case of liquid error in layout

As with includes, an error in a layout was reported on the
page that used the layout. Fix this by passing on the path
of the layout that is rendered.
This commit is contained in:
maul.esel 2013-10-04 00:07:50 +02:00
parent 809ab5e355
commit 76ada8c672
1 changed files with 4 additions and 3 deletions

View File

@ -84,13 +84,13 @@ module Jekyll
# info - the info for Liquid # info - the info for Liquid
# #
# Returns the converted content # Returns the converted content
def render_liquid(content, payload, info) def render_liquid(content, payload, info, path = nil)
Liquid::Template.parse(content).render!(payload, info) Liquid::Template.parse(content).render!(payload, info)
rescue Tags::IncludeTagError => e rescue Tags::IncludeTagError => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}" Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}"
raise e raise e
rescue Exception => e rescue Exception => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{self.path}" Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{path || self.path}"
raise e raise e
end end
@ -121,7 +121,8 @@ module Jekyll
self.output = self.render_liquid(layout.content, self.output = self.render_liquid(layout.content,
payload, payload,
info) info,
File.join(self.site.config['layouts'], layout.name))
if layout = layouts[layout.data["layout"]] if layout = layouts[layout.data["layout"]]
if used.include?(layout) if used.include?(layout)