Couple of fixes, specifically an issue with frontmatter layout setting

This commit is contained in:
Thomas Reynolds 2012-05-22 19:11:54 -07:00
parent f0d781cce3
commit 2c058ee3de
4 changed files with 10 additions and 12 deletions

View file

@ -35,7 +35,7 @@ module Middleman::CoreExtensions
data = {}
%w(layout layout_engine).each do |opt|
data[opt.to_sym] = fmdata[opt] if fmdata[opt]
data[opt.to_sym] = fmdata[opt] unless fmdata[opt].nil?
end
{ :options => data, :page => fmdata }

View file

@ -45,7 +45,9 @@ module Middleman
# @param [Hash] opts
# @return [void]
def page(url, opts={}, &block)
a_block = block_given? ? block : nil
blocks = []
blocks << block if block_given?
# Default layout
opts[:layout] = layout if opts[:layout].nil?
@ -55,7 +57,7 @@ module Middleman
# Use the metadata loop for matching against paths at runtime
sitemap.provides_metadata_for_path url do |url|
{ :options => opts, :blocks => [a_block] }
{ :options => opts, :blocks => blocks }
end
return
@ -83,7 +85,7 @@ module Middleman
# Setup a metadata matcher for rendering those options
sitemap.provides_metadata_for_path url do |url|
{ :options => opts, :blocks => [a_block] }
{ :options => opts, :blocks => blocks }
end
end
end

View file

@ -69,6 +69,8 @@ module Middleman
end
result.deep_merge!(local_meta)
result[:blocks] = result[:blocks].flatten.compact
result
end
@ -125,7 +127,7 @@ module Middleman
app.data.store("page", md[:page])
end
md[:blocks].flatten.compact.each do |block|
md[:blocks].each do |block|
app.instance_eval(&block)
end

View file

@ -10,9 +10,3 @@ Feature: Markdown support
Given the Server is running at "markdown-app"
When I go to "/smarty_pants.html"
Then I should see "&quot;"
When I go to "/no_intra_emphasis.html"
Then I should not see "<em>"
When I go to "/tables.html"
Then I should see "<table>"
When I go to "/space_after_headers.html"
Then I should not see "<h1>"