fix multi engine partials

This commit is contained in:
Thomas Reynolds 2011-12-01 22:43:41 -08:00
parent 6a03a60cf7
commit 833a229770
5 changed files with 12 additions and 7 deletions

View file

@ -37,5 +37,5 @@ Feature: Provide Sane Defaults for Partial Behavior
Scenario: Partial and Layout use different engines
Given the Server is running at "different-engine-partial"
When I go to "/index.html"
Then I should see "ERb Main"
Then I should see "ERb Header"
And I should see "Slim Footer"

View file

@ -1,4 +1,7 @@
<%= partial 'shared/erb' %>
<%= partial 'shared/footer' %>
<%= partial 'shared/header' %>
<% yield %>
<div id="main">
<%= yield %>
</div>
<%= partial 'shared/footer' %>

View file

@ -0,0 +1 @@
<header>ERb Header</header>

View file

@ -39,7 +39,6 @@ module Middleman::CoreExtensions::Rendering
engine = extension[1..-1].to_sym
@current_engine, engine_was = engine, @current_engine
@_out_buf, _buf_was = "", @_out_buf
while ::Tilt[path]
content = render_individual_file(path, locs, opts)
@ -56,7 +55,6 @@ module Middleman::CoreExtensions::Rendering
content
ensure
@current_engine = engine_was
@_out_buf = _buf_was
@content_blocks = nil
end
@ -104,6 +102,8 @@ module Middleman::CoreExtensions::Rendering
def render_individual_file(path, locs = {}, opts = {}, &block)
path = path.to_s
@_out_buf, _buf_was = "", @_out_buf
body = cache.fetch(:raw_template, path) do
File.read(path)
end
@ -117,6 +117,8 @@ module Middleman::CoreExtensions::Rendering
end
template.render(self, locs, &block)
ensure
@_out_buf = _buf_was
end
# @private