fix context references

This commit is contained in:
Thomas Reynolds 2011-11-18 20:34:20 -08:00
parent 4ceb9bab41
commit d11b8388f2

View file

@ -224,7 +224,7 @@ class Middleman::Base
return unless self.class.execute_before_processing!(self, found_template) return unless self.class.execute_before_processing!(self, found_template)
context = sitemap.get_context(@original_path) || {} context = sitemap.get_context(full_path(@original_path)) || {}
@options = context.has_key?(:options) ? context[:options] : {} @options = context.has_key?(:options) ? context[:options] : {}
@locals = context.has_key?(:locals) ? context[:locals] : {} @locals = context.has_key?(:locals) ? context[:locals] : {}
@ -258,6 +258,11 @@ class Middleman::Base
layout_path, *etc = resolve_template(local_layout, :preferred_engine => layout_engine) layout_path, *etc = resolve_template(local_layout, :preferred_engine => layout_engine)
if !layout_path
local_layout = File.join("layouts", local_layout.to_s)
layout_path, *etc = resolve_template(local_layout, :preferred_engine => layout_engine)
end
throw "Could not locate layout: #{local_layout}" unless layout_path throw "Could not locate layout: #{local_layout}" unless layout_path
render(layout_path, locals) do render(layout_path, locals) do