Fix c9d151ba66 for when files are outside the project

This commit is contained in:
Ben Hollis 2013-05-22 23:39:56 -07:00
parent c9d151ba66
commit dbbf84016f

View file

@ -57,15 +57,15 @@ module Middleman::CoreExtensions
def data(path) def data(path)
p = normalize_path(path) p = normalize_path(path)
@cache[p] ||= begin @cache[p] ||= begin
in_file = frontmatter_and_content(p) file_data, content = frontmatter_and_content(p)
return in_file unless @app.files.exists?("#{path}.frontmatter") return [file_data, content] unless @app.files.exists?("#{path}.frontmatter")
external_file = frontmatter_and_content("#{p}.frontmatter") external_data, _ = frontmatter_and_content("#{p}.frontmatter")
[ [
external_file[0].deep_merge(in_file[0]), external_data.deep_merge(file_data),
in_file[1] content
] ]
end end
end end
@ -145,11 +145,11 @@ module Middleman::CoreExtensions
path path
end end
return nil unless @app.files.exists?(full_path)
data = {} data = {}
content = nil content = nil
return [data, content] unless @app.files.exists?(full_path)
if !::Middleman::Util.binary?(full_path) if !::Middleman::Util.binary?(full_path)
content = File.read(full_path) content = File.read(full_path)