diff options
Diffstat (limited to 'lib/page/index.js')
-rw-r--r-- | lib/page/index.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/page/index.js b/lib/page/index.js index e8c4de7..8b4fcc9 100644 --- a/lib/page/index.js +++ b/lib/page/index.js @@ -7,6 +7,7 @@ var pathUtil = require('../utils/path'); var location = require('../utils/location'); var parsers = require('../parsers'); var gitbook = require('../gitbook'); +var pluginCompatibility = require('../plugins/compatibility'); var HTMLPipeline = require('./html'); /* @@ -142,10 +143,14 @@ Page.prototype.toHTML = function(output) { this.log.debug.ln('start parsing file', this.path); + // Call a hook in the output + // using an utility to "keep" compatibility with gitbook 2 function hook(name) { - return output.plugins.hook(name, that.getContext().page) + return pluginCompatibility.pageHook(that, function(ctx) { + return output.plugins.hook(name, ctx); + }) .then(function(result) { - if(result) that.update(result.content); + if(_.isString(result)) that.update(result); }); } |