mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
Fix nested layouts for ERB
This commit is contained in:
parent
deb6bddaf6
commit
d8d4769702
3 changed files with 25 additions and 4 deletions
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "New Article Title"
|
||||
date: 2011-01-01
|
||||
layout: inner
|
||||
---
|
||||
|
||||
The Article Content
|
|
@ -194,7 +194,7 @@ module Middleman
|
|||
def render_individual_file(path, locs = {}, opts = {}, context = self, &block)
|
||||
path = path.to_s
|
||||
|
||||
# Save current buffere for later
|
||||
# Save current buffer for later
|
||||
@_out_buf, _buf_was = "", @_out_buf
|
||||
|
||||
# Read from disk or cache the contents of the file
|
||||
|
@ -327,9 +327,16 @@ module Middleman
|
|||
# @param [String, Symbol] layout_name
|
||||
# @return [void]
|
||||
def wrap_layout(layout_name, &block)
|
||||
# Save current buffer for later
|
||||
@_out_buf, _buf_was = "", @_out_buf
|
||||
begin
|
||||
content = capture(&block) if block_given?
|
||||
ensure
|
||||
# Reset stored buffer
|
||||
@_out_buf = _buf_was
|
||||
end
|
||||
layout_path = locate_layout(layout_name, current_engine)
|
||||
concat render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content }
|
||||
@_out_buf.concat render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content }
|
||||
end
|
||||
|
||||
# The currently rendering engine
|
||||
|
|
|
@ -7,6 +7,13 @@ Feature: Allow nesting of layouts
|
|||
And I should see "Inner"
|
||||
And I should see "Outer"
|
||||
And I should see "Master"
|
||||
When I go to "/another.html"
|
||||
And I should see "New Article Title"
|
||||
And I should see "The Article Content"
|
||||
And I should see "Inner"
|
||||
And I should see "Outer"
|
||||
And I should see "Master"
|
||||
|
||||
|
||||
Scenario: YAML Front Matter isn't clobbered with nested layouts
|
||||
Given the Server is running at "nested-layout-app"
|
||||
|
|
Loading…
Reference in a new issue