Adapt to upstream hooks API change. Fixes #1658
This commit is contained in:
parent
e86110f506
commit
78fb92d497
3 changed files with 14 additions and 7 deletions
|
@ -1,6 +1,13 @@
|
||||||
master
|
master
|
||||||
===
|
===
|
||||||
|
|
||||||
|
3.4.1
|
||||||
|
===
|
||||||
|
|
||||||
|
* Adapt to upstream hooks API change, fixing `after_render` hook bugs. (#1658)
|
||||||
|
* Add a bunch of requires to help Windows users.
|
||||||
|
* Refator Data Loader to prevent middleman from crashing due to invalid data file. (#1633)
|
||||||
|
|
||||||
3.4.0
|
3.4.0
|
||||||
===
|
===
|
||||||
|
|
||||||
|
|
|
@ -296,10 +296,10 @@ module Middleman
|
||||||
# Allow hooks to manipulate the template before render
|
# Allow hooks to manipulate the template before render
|
||||||
self.class.callbacks_for_hook(:before_render).each do |callback|
|
self.class.callbacks_for_hook(:before_render).each do |callback|
|
||||||
# Uber::Options::Value doesn't respond to call
|
# Uber::Options::Value doesn't respond to call
|
||||||
newbody = if callback.respond_to?(:call)
|
newbody = if callback.is_a? ::Uber::Options::Value
|
||||||
callback.call(body, path, locs, template_class)
|
callback.call(self, body, path, locs, template_class)
|
||||||
elsif callback.respond_to?(:evaluate)
|
elsif callback.respond_to?(:evaluate)
|
||||||
callback.evaluate(self, body, path, locs, template_class)
|
callback.call(body, path, locs, template_class)
|
||||||
end
|
end
|
||||||
body = newbody if newbody # Allow the callback to return nil to skip it
|
body = newbody if newbody # Allow the callback to return nil to skip it
|
||||||
end
|
end
|
||||||
|
@ -315,10 +315,10 @@ module Middleman
|
||||||
# Allow hooks to manipulate the result after render
|
# Allow hooks to manipulate the result after render
|
||||||
self.class.callbacks_for_hook(:after_render).each do |callback|
|
self.class.callbacks_for_hook(:after_render).each do |callback|
|
||||||
# Uber::Options::Value doesn't respond to call
|
# Uber::Options::Value doesn't respond to call
|
||||||
newcontent = if callback.respond_to?(:call)
|
newcontent = if callback.is_a? ::Uber::Options::Value
|
||||||
callback.call(content, path, locs, template_class)
|
callback.call(self, content, path, locs, template_class)
|
||||||
elsif callback.respond_to?(:evaluate)
|
elsif callback.respond_to?(:evaluate)
|
||||||
callback.evaluate(self, content, path, locs, template_class)
|
callback.call(content, path, locs, template_class)
|
||||||
end
|
end
|
||||||
content = newcontent if newcontent # Allow the callback to return nil to skip it
|
content = newcontent if newcontent # Allow the callback to return nil to skip it
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module Middleman
|
module Middleman
|
||||||
# Current Version
|
# Current Version
|
||||||
# @return [String]
|
# @return [String]
|
||||||
VERSION = '3.4.0' unless const_defined?(:VERSION)
|
VERSION = '3.4.1' unless const_defined?(:VERSION)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue