remove confusing and broken data.page variable
This commit is contained in:
parent
98e3c8aa79
commit
504a1c2eba
6 changed files with 15 additions and 21 deletions
|
@ -1,6 +1,7 @@
|
|||
master
|
||||
===
|
||||
|
||||
* Asciidoc information now available with the `asciidoc` local, which is a normal hash.
|
||||
* Remove `page` template local. Use `current_resource` instead.
|
||||
* Dropped support for `page` & `proxy` blocks.
|
||||
* Dropped support for instance variables inside templates.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= data.page.title || 'Fallback' %></title>
|
||||
<title><%= current_resource.data.title || asciidoc[:title] || 'Fallback' %></title>
|
||||
</head>
|
||||
<body>
|
||||
<%= yield %>
|
||||
|
|
|
@ -41,11 +41,19 @@ module Middleman::CoreExtensions
|
|||
fmdata = data(path).first
|
||||
|
||||
data = {}
|
||||
|
||||
[:layout, :layout_engine].each do |opt|
|
||||
data[opt] = fmdata[opt] unless fmdata[opt].nil?
|
||||
end
|
||||
|
||||
if fmdata[:renderer_options]
|
||||
data[:renderer_options] = {}
|
||||
fmdata[:renderer_options].each do |k, v|
|
||||
data[:renderer_options][k.to_sym] = v
|
||||
end
|
||||
end
|
||||
|
||||
{ :options => data, :page => ::Middleman::Util.recursively_enhance(fmdata).freeze }
|
||||
{ :options => data }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ module Middleman
|
|||
# TODO grab all the author information
|
||||
page[:author] = (doc.attr 'author') unless (doc.attr 'author').nil?
|
||||
|
||||
{:options => opts, :page => ::Middleman::Util.recursively_enhance(page)}
|
||||
{ :options => opts, :locals => { :asciidoc => page } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,7 +48,7 @@ module Middleman
|
|||
@source_file = source_file
|
||||
@destination_path = @path
|
||||
|
||||
@local_metadata = { :options => {}, :locals => {}, :page => {}}
|
||||
@local_metadata = { :options => {}, :locals => {} }
|
||||
end
|
||||
|
||||
# Whether this resource has a template file
|
||||
|
@ -104,22 +104,7 @@ module Middleman
|
|||
instrument 'render.resource', :path => relative_source do
|
||||
md = metadata.dup
|
||||
opts = md[:options].deep_merge(opts)
|
||||
|
||||
# Pass "renderer_options" hash from frontmatter along to renderer
|
||||
if md[:page]['renderer_options']
|
||||
opts[:renderer_options] = {}
|
||||
md[:page]['renderer_options'].each do |k, v|
|
||||
opts[:renderer_options][k.to_sym] = v
|
||||
end
|
||||
end
|
||||
|
||||
locs = md[:locals].deep_merge(locs)
|
||||
|
||||
# Forward remaining data to helpers
|
||||
if md.has_key?(:page)
|
||||
app.data.store('page', md[:page])
|
||||
end
|
||||
|
||||
locs[:current_path] ||= self.destination_path
|
||||
|
||||
# Certain output file types don't use layouts
|
||||
|
|
|
@ -137,7 +137,7 @@ module Middleman
|
|||
# @param [String] source_file
|
||||
# @return [Hash]
|
||||
def metadata_for_file(source_file)
|
||||
blank_metadata = { :options => {}, :locals => {}, :page => {} }
|
||||
blank_metadata = { :options => {}, :locals => {} }
|
||||
|
||||
provides_metadata.inject(blank_metadata) do |result, (callback, matcher)|
|
||||
next result if matcher && !source_file.match(matcher)
|
||||
|
@ -165,7 +165,7 @@ module Middleman
|
|||
def metadata_for_path(request_path)
|
||||
return @_cached_metadata[request_path] if @_cached_metadata[request_path]
|
||||
|
||||
blank_metadata = { :options => {}, :locals => {}, :page => {} }
|
||||
blank_metadata = { :options => {}, :locals => {} }
|
||||
|
||||
@_cached_metadata[request_path] = provides_metadata_for_path.inject(blank_metadata) do |result, (callback, matcher)|
|
||||
case matcher
|
||||
|
|
Loading…
Reference in a new issue