From 99c004d41f5d0fbfb931d5125ad6bb363f7c0071 Mon Sep 17 00:00:00 2001 From: Eric Skogen Date: Mon, 12 Dec 2011 12:12:19 -0600 Subject: [PATCH 1/3] fix bug in sitemap_tree which referred to app out of context --- lib/middleman/extensions/sitemap_tree.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/middleman/extensions/sitemap_tree.rb b/lib/middleman/extensions/sitemap_tree.rb index 31b33867..7105ef15 100644 --- a/lib/middleman/extensions/sitemap_tree.rb +++ b/lib/middleman/extensions/sitemap_tree.rb @@ -16,7 +16,7 @@ module Middleman::Extensions if !@sitemap_tree_cache.has_key?(key) auto_hash = Hash.new{ |h,k| h[k] = Hash.new &h.default_proc } - app.sitemap.all_paths.each do |path| + sitemap.all_paths.each do |path| next if !regex.nil? && !path.match(regex) sub = auto_hash path.split( "/" ).each{ |dir| sub[dir]; sub = sub[dir] } From 6a554ae45fe6298531e733165285262e76a854aa Mon Sep 17 00:00:00 2001 From: Eric Skogen Date: Mon, 12 Dec 2011 12:12:19 -0600 Subject: [PATCH 2/3] fix bug in sitemap_tree which referred to app out of context --- lib/middleman/extensions/sitemap_tree.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/middleman/extensions/sitemap_tree.rb b/lib/middleman/extensions/sitemap_tree.rb index 31b33867..7105ef15 100644 --- a/lib/middleman/extensions/sitemap_tree.rb +++ b/lib/middleman/extensions/sitemap_tree.rb @@ -16,7 +16,7 @@ module Middleman::Extensions if !@sitemap_tree_cache.has_key?(key) auto_hash = Hash.new{ |h,k| h[k] = Hash.new &h.default_proc } - app.sitemap.all_paths.each do |path| + sitemap.all_paths.each do |path| next if !regex.nil? && !path.match(regex) sub = auto_hash path.split( "/" ).each{ |dir| sub[dir]; sub = sub[dir] } From 24664e4bbab4d1805b8c23509798e4305032ebe5 Mon Sep 17 00:00:00 2001 From: Eric Skogen Date: Thu, 22 Dec 2011 16:38:34 -0600 Subject: [PATCH 3/3] demonstrate bug with nested_layouts and YAML front matter --- features/nested_layouts.feature | 12 +++++++++++- fixtures/nested-layout-app/source/data-one.html.erb | 5 +++++ fixtures/nested-layout-app/source/data-two.html.erb | 5 +++++ fixtures/nested-layout-app/source/layouts/master.erb | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 fixtures/nested-layout-app/source/data-one.html.erb create mode 100644 fixtures/nested-layout-app/source/data-two.html.erb diff --git a/features/nested_layouts.feature b/features/nested_layouts.feature index 146443c5..a591f240 100644 --- a/features/nested_layouts.feature +++ b/features/nested_layouts.feature @@ -6,4 +6,14 @@ Feature: Allow nesting of layouts Then I should see "Template" And I should see "Inner" And I should see "Outer" - And I should see "Master" \ No newline at end of file + And I should see "Master" + + Scenario: YAML Front Matter isn't clobbered with nested layouts + Given the Server is running at "nested-layout-app" + When I go to "/data-one.html" + Then I should see "Page Number One" + When I go to "/data-two.html" + Then I should see "Page Number Two" + When I go to "/data-one.html" + Then I should see "Page Number One" + When I go to "/data-two.html" diff --git a/fixtures/nested-layout-app/source/data-one.html.erb b/fixtures/nested-layout-app/source/data-one.html.erb new file mode 100644 index 00000000..7dfb5840 --- /dev/null +++ b/fixtures/nested-layout-app/source/data-one.html.erb @@ -0,0 +1,5 @@ +--- +title: Page Number One +layout: outer +--- +Page #1 \ No newline at end of file diff --git a/fixtures/nested-layout-app/source/data-two.html.erb b/fixtures/nested-layout-app/source/data-two.html.erb new file mode 100644 index 00000000..387c9da1 --- /dev/null +++ b/fixtures/nested-layout-app/source/data-two.html.erb @@ -0,0 +1,5 @@ +--- +title: Page Number Two +layout: outer +--- +Page #2 \ No newline at end of file diff --git a/fixtures/nested-layout-app/source/layouts/master.erb b/fixtures/nested-layout-app/source/layouts/master.erb index 18dcdbb7..fbda1cc2 100644 --- a/fixtures/nested-layout-app/source/layouts/master.erb +++ b/fixtures/nested-layout-app/source/layouts/master.erb @@ -1,2 +1,3 @@ Master +<%= data.page.title %> <%= yield %> \ No newline at end of file