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 = {} data = {}
%w(layout layout_engine).each do |opt| %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 end
{ :options => data, :page => fmdata } { :options => data, :page => fmdata }

View file

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

View file

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

View file

@ -10,9 +10,3 @@ Feature: Markdown support
Given the Server is running at "markdown-app" Given the Server is running at "markdown-app"
When I go to "/smarty_pants.html" When I go to "/smarty_pants.html"
Then I should see "&quot;" 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>"