Given file-based metadata precedence over config/path metadata. Fixes #552
This commit is contained in:
parent
0625d96e43
commit
80e36b7c53
|
@ -1,6 +1,7 @@
|
||||||
Master
|
Master
|
||||||
===
|
===
|
||||||
|
|
||||||
|
* Give file metadata (such as frontmatter) precedence over path meta. #552
|
||||||
* Add `sass_assets_paths` option for arbitrary sass partial locations.
|
* Add `sass_assets_paths` option for arbitrary sass partial locations.
|
||||||
* Don't catch CoffeeScript errors when in build mode.
|
* Don't catch CoffeeScript errors when in build mode.
|
||||||
* Extract load_paths so they aren't locked into the binary
|
* Extract load_paths so they aren't locked into the binary
|
||||||
|
|
|
@ -37,7 +37,7 @@ module Middleman::CoreExtensions
|
||||||
%w(layout layout_engine).each do |opt|
|
%w(layout layout_engine).each do |opt|
|
||||||
data[opt.to_sym] = fmdata[opt] unless fmdata[opt].nil?
|
data[opt.to_sym] = fmdata[opt] unless fmdata[opt].nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
{ :options => data, :page => fmdata }
|
{ :options => data, :page => fmdata }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,13 +54,13 @@ module Middleman
|
||||||
# Get the metadata for both the current source_file and the current path
|
# Get the metadata for both the current source_file and the current path
|
||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
def metadata
|
def metadata
|
||||||
result = store.metadata_for_file(source_file).dup
|
result = store.metadata_for_path(path).dup
|
||||||
|
|
||||||
path_meta = store.metadata_for_path(path).dup
|
file_meta = store.metadata_for_file(source_file).dup
|
||||||
if path_meta.has_key?(:blocks)
|
if file_meta.has_key?(:blocks)
|
||||||
result[:blocks] << path_meta.delete(:blocks)
|
result[:blocks] << file_meta.delete(:blocks)
|
||||||
end
|
end
|
||||||
result.deep_merge!(path_meta)
|
result.deep_merge!(file_meta)
|
||||||
|
|
||||||
local_meta = @local_metadata.dup
|
local_meta = @local_metadata.dup
|
||||||
if local_meta.has_key?(:blocks)
|
if local_meta.has_key?(:blocks)
|
||||||
|
@ -114,7 +114,7 @@ module Middleman
|
||||||
return File.open(source_file).read unless template?
|
return File.open(source_file).read unless template?
|
||||||
|
|
||||||
relative_source = Pathname(source_file).relative_path_from(Pathname(app.root))
|
relative_source = Pathname(source_file).relative_path_from(Pathname(app.root))
|
||||||
|
|
||||||
instrument "render.resource", :path => relative_source do
|
instrument "render.resource", :path => relative_source do
|
||||||
md = metadata.dup
|
md = metadata.dup
|
||||||
opts = md[:options].deep_merge(opts)
|
opts = md[:options].deep_merge(opts)
|
||||||
|
|
Loading…
Reference in a new issue