Fix before_render after change to hooks-0.4.0. Related to #1278.
This commit is contained in:
parent
5f9dec3dc8
commit
1a7da200d1
|
@ -53,7 +53,11 @@ module Middleman
|
|||
template_class = ::Tilt[path]
|
||||
# Allow hooks to manipulate the template before render
|
||||
@app.class.callbacks_for_hook(:before_render).each do |callback|
|
||||
newbody = callback.call(body, path, locs, template_class)
|
||||
newbody = if callback.respond_to?(:call)
|
||||
callback.call(body, path, locs, template_class)
|
||||
elsif callback.respond_to?(:evaluate)
|
||||
callback.evaluate(self, body, path, locs, template_class)
|
||||
end
|
||||
body = newbody if newbody # Allow the callback to return nil to skip it
|
||||
end
|
||||
|
||||
|
@ -68,11 +72,12 @@ module Middleman
|
|||
# Allow hooks to manipulate the result after render
|
||||
@app.class.callbacks_for_hook(:after_render).each do |callback|
|
||||
# Uber::Options::Value doesn't respond to call
|
||||
if callback.respond_to?(:call)
|
||||
content = callback.call(content, path, locs, template_class)
|
||||
newcontent = if callback.respond_to?(:call)
|
||||
callback.call(content, path, locs, template_class)
|
||||
elsif callback.respond_to?(:evaluate)
|
||||
content = callback.evaluate(self, content, path, locs, template_class)
|
||||
callback.evaluate(self, content, path, locs, template_class)
|
||||
end
|
||||
content = newcontent if newcontent # Allow the callback to return nil to skip it
|
||||
end
|
||||
|
||||
output = ::ActiveSupport::SafeBuffer.new ''
|
||||
|
|
Loading…
Reference in a new issue