Merge pull request #367 from bhollis/reorder
Reorder extensions so frontmatter is available before sitemap
This commit is contained in:
commit
c5aa707d89
|
@ -225,6 +225,9 @@ module Middleman
|
||||||
# Activate Data package
|
# Activate Data package
|
||||||
register Middleman::CoreExtensions::Data
|
register Middleman::CoreExtensions::Data
|
||||||
|
|
||||||
|
# Parse YAML from templates
|
||||||
|
register Middleman::CoreExtensions::FrontMatter
|
||||||
|
|
||||||
# Setup custom rendering
|
# Setup custom rendering
|
||||||
register Middleman::CoreExtensions::Rendering
|
register Middleman::CoreExtensions::Rendering
|
||||||
|
|
||||||
|
@ -243,9 +246,6 @@ module Middleman
|
||||||
# with_layout and page routing
|
# with_layout and page routing
|
||||||
register Middleman::CoreExtensions::Routing
|
register Middleman::CoreExtensions::Routing
|
||||||
|
|
||||||
# Parse YAML from templates
|
|
||||||
register Middleman::CoreExtensions::FrontMatter
|
|
||||||
|
|
||||||
# i18n
|
# i18n
|
||||||
register Middleman::CoreExtensions::I18n
|
register Middleman::CoreExtensions::I18n
|
||||||
|
|
||||||
|
@ -555,4 +555,4 @@ module Middleman
|
||||||
server
|
server
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,8 +50,6 @@ module Middleman::CoreExtensions::FrontMatter
|
||||||
|
|
||||||
# Override init
|
# Override init
|
||||||
def initialize
|
def initialize
|
||||||
super
|
|
||||||
|
|
||||||
exts = frontmatter_extensions.join("|").gsub(".", "\.")
|
exts = frontmatter_extensions.join("|").gsub(".", "\.")
|
||||||
|
|
||||||
static_path = source_dir.sub(root, "").sub(/^\//, "").sub(/\/$/, "") + "/"
|
static_path = source_dir.sub(root, "").sub(/^\//, "").sub(/\/$/, "") + "/"
|
||||||
|
@ -82,9 +80,11 @@ module Middleman::CoreExtensions::FrontMatter
|
||||||
|
|
||||||
{ :options => data, :page => fmdata }
|
{ :options => data, :page => fmdata }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Initialize class
|
# Initialize class
|
||||||
frontmatter_extension
|
frontmatter_extension
|
||||||
|
|
||||||
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
# Notify callbacks that the frontmatter changed
|
# Notify callbacks that the frontmatter changed
|
||||||
|
@ -153,6 +153,7 @@ module Middleman::CoreExtensions::FrontMatter
|
||||||
|
|
||||||
if result
|
if result
|
||||||
data, content = result
|
data, content = result
|
||||||
|
|
||||||
data = ::Middleman::Util.recursively_enhance(data).freeze
|
data = ::Middleman::Util.recursively_enhance(data).freeze
|
||||||
file = file.sub(@app.source_dir, "")
|
file = file.sub(@app.source_dir, "")
|
||||||
@local_data[file] = [data, content]
|
@local_data[file] = [data, content]
|
||||||
|
|
|
@ -40,8 +40,6 @@ module Middleman::CoreExtensions::Rendering
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super
|
|
||||||
|
|
||||||
static_path = source_dir.sub(self.root, "").sub(/^\//, "")
|
static_path = source_dir.sub(self.root, "").sub(/^\//, "")
|
||||||
render_regex = static_path.empty? ? // : (%r{^#{static_path + "/"}})
|
render_regex = static_path.empty? ? // : (%r{^#{static_path + "/"}})
|
||||||
|
|
||||||
|
@ -49,6 +47,8 @@ module Middleman::CoreExtensions::Rendering
|
||||||
path = File.expand_path(file, self.root)
|
path = File.expand_path(file, self.root)
|
||||||
self.cache.remove(:raw_template, path)
|
self.cache.remove(:raw_template, path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add or overwrite a default template extension
|
# Add or overwrite a default template extension
|
||||||
|
@ -364,4 +364,4 @@ module Middleman::CoreExtensions::Rendering
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,11 +53,10 @@ module Middleman::Sitemap
|
||||||
end
|
end
|
||||||
|
|
||||||
# Reset lookup cache
|
# Reset lookup cache
|
||||||
cache_structure = { :path => {}, :destination_path => {} }
|
@_lookup_cache = { :path => {}, :destination_path => {} }
|
||||||
@_lookup_cache = @resources.inject(cache_structure) do |cache, resource|
|
@resources.each do |resource|
|
||||||
cache[:path][resource.path] = resource
|
@_lookup_cache[:path][resource.path] = resource
|
||||||
cache[:destination_path][resource.destination_path] = resource
|
@_lookup_cache[:destination_path][resource.destination_path] = resource
|
||||||
cache
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -188,4 +187,4 @@ module Middleman::Sitemap
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue