fix multi engine partials
This commit is contained in:
parent
6a03a60cf7
commit
833a229770
|
@ -37,5 +37,5 @@ Feature: Provide Sane Defaults for Partial Behavior
|
||||||
Scenario: Partial and Layout use different engines
|
Scenario: Partial and Layout use different engines
|
||||||
Given the Server is running at "different-engine-partial"
|
Given the Server is running at "different-engine-partial"
|
||||||
When I go to "/index.html"
|
When I go to "/index.html"
|
||||||
Then I should see "ERb Main"
|
Then I should see "ERb Header"
|
||||||
And I should see "Slim Footer"
|
And I should see "Slim Footer"
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<%= partial 'shared/erb' %>
|
<%= partial 'shared/header' %>
|
||||||
<%= partial 'shared/footer' %>
|
|
||||||
|
|
||||||
<% yield %>
|
<div id="main">
|
||||||
|
<%= yield %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= partial 'shared/footer' %>
|
|
@ -1 +0,0 @@
|
||||||
ERb Main
|
|
|
@ -0,0 +1 @@
|
||||||
|
<header>ERb Header</header>
|
|
@ -39,7 +39,6 @@ module Middleman::CoreExtensions::Rendering
|
||||||
engine = extension[1..-1].to_sym
|
engine = extension[1..-1].to_sym
|
||||||
|
|
||||||
@current_engine, engine_was = engine, @current_engine
|
@current_engine, engine_was = engine, @current_engine
|
||||||
@_out_buf, _buf_was = "", @_out_buf
|
|
||||||
|
|
||||||
while ::Tilt[path]
|
while ::Tilt[path]
|
||||||
content = render_individual_file(path, locs, opts)
|
content = render_individual_file(path, locs, opts)
|
||||||
|
@ -56,7 +55,6 @@ module Middleman::CoreExtensions::Rendering
|
||||||
content
|
content
|
||||||
ensure
|
ensure
|
||||||
@current_engine = engine_was
|
@current_engine = engine_was
|
||||||
@_out_buf = _buf_was
|
|
||||||
@content_blocks = nil
|
@content_blocks = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -104,6 +102,8 @@ module Middleman::CoreExtensions::Rendering
|
||||||
def render_individual_file(path, locs = {}, opts = {}, &block)
|
def render_individual_file(path, locs = {}, opts = {}, &block)
|
||||||
path = path.to_s
|
path = path.to_s
|
||||||
|
|
||||||
|
@_out_buf, _buf_was = "", @_out_buf
|
||||||
|
|
||||||
body = cache.fetch(:raw_template, path) do
|
body = cache.fetch(:raw_template, path) do
|
||||||
File.read(path)
|
File.read(path)
|
||||||
end
|
end
|
||||||
|
@ -117,6 +117,8 @@ module Middleman::CoreExtensions::Rendering
|
||||||
end
|
end
|
||||||
|
|
||||||
template.render(self, locs, &block)
|
template.render(self, locs, &block)
|
||||||
|
ensure
|
||||||
|
@_out_buf = _buf_was
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
|
|
Loading…
Reference in a new issue