More trimming
This commit is contained in:
parent
d83d6e077c
commit
5c04c2f42b
1 changed files with 4 additions and 12 deletions
|
@ -55,16 +55,8 @@ 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
|
||||||
# TODO: Get rid of all this
|
# TODO: The only reason we call metadata_for_page is to power the "page" DSL
|
||||||
result = @store.metadata_for_path(path).dup
|
@store.metadata_for_path(path).deep_merge @local_metadata
|
||||||
|
|
||||||
file_meta = @store.metadata_for_file(source_file).dup
|
|
||||||
result.deep_merge!(file_meta)
|
|
||||||
|
|
||||||
local_meta = @local_metadata.dup
|
|
||||||
result.deep_merge!(local_meta)
|
|
||||||
|
|
||||||
result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Data about this resource, populated from frontmatter or extensions.
|
# Data about this resource, populated from frontmatter or extensions.
|
||||||
|
@ -81,7 +73,7 @@ module Middleman
|
||||||
# Page are data that is exposed through this resource's data member.
|
# Page are data that is exposed through this resource's data member.
|
||||||
# Note: It is named 'page' for backwards compatibility with older MM.
|
# Note: It is named 'page' for backwards compatibility with older MM.
|
||||||
def add_metadata(meta={})
|
def add_metadata(meta={})
|
||||||
@local_metadata.deep_merge!(meta.dup)
|
@local_metadata.deep_merge!(meta)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Extension of the path (i.e. '.js')
|
# Extension of the path (i.e. '.js')
|
||||||
|
@ -98,7 +90,7 @@ module Middleman
|
||||||
relative_source = Pathname(source_file).relative_path_from(Pathname(@app.root))
|
relative_source = Pathname(source_file).relative_path_from(Pathname(@app.root))
|
||||||
|
|
||||||
@app.instrument 'render.resource', path: relative_source, destination_path: destination_path do
|
@app.instrument 'render.resource', path: relative_source, destination_path: destination_path do
|
||||||
md = metadata.dup
|
md = metadata
|
||||||
opts = md[:options].deep_merge(opts)
|
opts = md[:options].deep_merge(opts)
|
||||||
locs = md[:locals].deep_merge(locs)
|
locs = md[:locals].deep_merge(locs)
|
||||||
locs[:current_path] ||= destination_path
|
locs[:current_path] ||= destination_path
|
||||||
|
|
Loading…
Add table
Reference in a new issue