From 9b5d1f17d0704ff293f1971fd5a72f5edf4adc78 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Sun, 25 Mar 2012 01:02:46 -0700 Subject: [PATCH] Test showing wrap_layout is still broken when used with haml --- .../nested-layout-app/source/haml-test.html.markdown | 7 +++++++ .../nested-layout-app/source/layouts/inner_haml.haml | 3 +++ .../nested-layout-app/source/layouts/master_haml.haml | 3 +++ .../nested-layout-app/source/layouts/outer_haml.haml | 3 +++ .../lib/middleman-core/core_extensions/rendering.rb | 5 +++++ middleman-more/features/nested_layouts.feature | 6 ++++++ 6 files changed, 27 insertions(+) create mode 100644 middleman-core/fixtures/nested-layout-app/source/haml-test.html.markdown create mode 100644 middleman-core/fixtures/nested-layout-app/source/layouts/inner_haml.haml create mode 100644 middleman-core/fixtures/nested-layout-app/source/layouts/master_haml.haml create mode 100644 middleman-core/fixtures/nested-layout-app/source/layouts/outer_haml.haml diff --git a/middleman-core/fixtures/nested-layout-app/source/haml-test.html.markdown b/middleman-core/fixtures/nested-layout-app/source/haml-test.html.markdown new file mode 100644 index 00000000..38a7bee8 --- /dev/null +++ b/middleman-core/fixtures/nested-layout-app/source/haml-test.html.markdown @@ -0,0 +1,7 @@ +--- +title: "New Article Title" +date: 2011-01-01 +layout: inner_haml +--- + +The Article Content diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/inner_haml.haml b/middleman-core/fixtures/nested-layout-app/source/layouts/inner_haml.haml new file mode 100644 index 00000000..e3976d7c --- /dev/null +++ b/middleman-core/fixtures/nested-layout-app/source/layouts/inner_haml.haml @@ -0,0 +1,3 @@ +- wrap_layout :outer_haml do + Inner + = yield \ No newline at end of file diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/master_haml.haml b/middleman-core/fixtures/nested-layout-app/source/layouts/master_haml.haml new file mode 100644 index 00000000..bdc6ccc5 --- /dev/null +++ b/middleman-core/fixtures/nested-layout-app/source/layouts/master_haml.haml @@ -0,0 +1,3 @@ +Master += data.page.title += yield \ No newline at end of file diff --git a/middleman-core/fixtures/nested-layout-app/source/layouts/outer_haml.haml b/middleman-core/fixtures/nested-layout-app/source/layouts/outer_haml.haml new file mode 100644 index 00000000..641e42c5 --- /dev/null +++ b/middleman-core/fixtures/nested-layout-app/source/layouts/outer_haml.haml @@ -0,0 +1,3 @@ +- wrap_layout :master_haml do + Outer + = yield diff --git a/middleman-core/lib/middleman-core/core_extensions/rendering.rb b/middleman-core/lib/middleman-core/core_extensions/rendering.rb index e848aaba..fea8659f 100644 --- a/middleman-core/lib/middleman-core/core_extensions/rendering.rb +++ b/middleman-core/lib/middleman-core/core_extensions/rendering.rb @@ -336,6 +336,11 @@ module Middleman @_out_buf = _buf_was end layout_path = locate_layout(layout_name, current_engine) + + if !@_out_buf + raise "wrap_layout is currently broken for this templating system" + end + @_out_buf.concat render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content } end diff --git a/middleman-more/features/nested_layouts.feature b/middleman-more/features/nested_layouts.feature index f475d9d1..2267f23a 100644 --- a/middleman-more/features/nested_layouts.feature +++ b/middleman-more/features/nested_layouts.feature @@ -13,6 +13,12 @@ Feature: Allow nesting of layouts And I should see "Inner" And I should see "Outer" And I should see "Master" + When I go to "/haml-test.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