use before hooks to simplify server and move other code into features and extensions
This commit is contained in:
parent
7ffd5ccea9
commit
ca5921a72e
|
@ -10,21 +10,24 @@ module Middleman::CoreExtensions::FrontMatter
|
||||||
::Tilt::register RedClothTemplate, 'textile'
|
::Tilt::register RedClothTemplate, 'textile'
|
||||||
::Tilt::register ERBTemplate, 'erb', 'rhtml'
|
::Tilt::register ERBTemplate, 'erb', 'rhtml'
|
||||||
::Tilt::register ErubisTemplate, 'erb', 'rhtml', 'erubis'
|
::Tilt::register ErubisTemplate, 'erb', 'rhtml', 'erubis'
|
||||||
#
|
|
||||||
# app.before do
|
app.before do
|
||||||
# full_file_path = "#{extensionless_path}.#{template_engine}"
|
result = resolve_template(request.path_info, :raise_exceptions => false)
|
||||||
# system_path = File.join(settings.views, full_file_path)
|
if result
|
||||||
# data, content = self.class.parse_front_matter(File.read(system_path))
|
full_file_path = "#{extensionless_path}.#{template_engine}"
|
||||||
#
|
system_path = File.join(settings.views, full_file_path)
|
||||||
# %w(layout layout_engine).each do |opt|
|
data, content = app.parse_front_matter(File.read(system_path))
|
||||||
# if data.has_key?(opt)
|
|
||||||
# options[opt.to_sym] = data.delete(opt)
|
%w(layout layout_engine).each do |opt|
|
||||||
# end
|
if data.has_key?(opt)
|
||||||
# end
|
options[opt.to_sym] = data.delete(opt)
|
||||||
#
|
end
|
||||||
# # Forward remaining data to helpers
|
end
|
||||||
# self.class.data_content("page", data)
|
|
||||||
# end
|
# Forward remaining data to helpers
|
||||||
|
app.data_content("page", data)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
alias :included :registered
|
alias :included :registered
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue