From 78fb92d497b365a3d5a9d79ce5b1881dfc3f15bc Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 11 Nov 2015 13:14:31 -0800 Subject: [PATCH] Adapt to upstream hooks API change. Fixes #1658 --- CHANGELOG.md | 7 +++++++ .../lib/middleman-core/core_extensions/rendering.rb | 12 ++++++------ middleman-core/lib/middleman-core/version.rb | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a461146..53bc0858 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ 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 === diff --git a/middleman-core/lib/middleman-core/core_extensions/rendering.rb b/middleman-core/lib/middleman-core/core_extensions/rendering.rb index aa3e4430..7dab1814 100644 --- a/middleman-core/lib/middleman-core/core_extensions/rendering.rb +++ b/middleman-core/lib/middleman-core/core_extensions/rendering.rb @@ -296,10 +296,10 @@ module Middleman # Allow hooks to manipulate the template before render self.class.callbacks_for_hook(:before_render).each do |callback| # Uber::Options::Value doesn't respond to call - newbody = if callback.respond_to?(:call) - callback.call(body, path, locs, template_class) + newbody = if callback.is_a? ::Uber::Options::Value + callback.call(self, body, path, locs, template_class) elsif callback.respond_to?(:evaluate) - callback.evaluate(self, body, path, locs, template_class) + callback.call(body, path, locs, template_class) end body = newbody if newbody # Allow the callback to return nil to skip it end @@ -315,10 +315,10 @@ module Middleman # Allow hooks to manipulate the result after render self.class.callbacks_for_hook(:after_render).each do |callback| # Uber::Options::Value doesn't respond to call - newcontent = if callback.respond_to?(:call) - callback.call(content, path, locs, template_class) + newcontent = if callback.is_a? ::Uber::Options::Value + callback.call(self, content, path, locs, template_class) elsif callback.respond_to?(:evaluate) - callback.evaluate(self, content, path, locs, template_class) + callback.call(content, path, locs, template_class) end content = newcontent if newcontent # Allow the callback to return nil to skip it end diff --git a/middleman-core/lib/middleman-core/version.rb b/middleman-core/lib/middleman-core/version.rb index 01894a8e..d8a3037f 100644 --- a/middleman-core/lib/middleman-core/version.rb +++ b/middleman-core/lib/middleman-core/version.rb @@ -1,5 +1,5 @@ module Middleman # Current Version # @return [String] - VERSION = '3.4.0' unless const_defined?(:VERSION) + VERSION = '3.4.1' unless const_defined?(:VERSION) end