summaryrefslogtreecommitdiffstats
path: root/lib/template/index.js
diff options
context:
space:
mode:
authorJohan Preynat <johan.preynat@gmail.com>2016-04-20 15:59:53 +0200
committerJohan Preynat <johan.preynat@gmail.com>2016-04-20 15:59:53 +0200
commit71b59b1950dbbb02e95b34dfdb26e8ad8c6e31a0 (patch)
tree982f1c027490667230bb01d0171e4e8fded08f2b /lib/template/index.js
parenta3300ad9c63c12faf9049234dff0b515edb3a870 (diff)
downloadgitbook-71b59b1950dbbb02e95b34dfdb26e8ad8c6e31a0.zip
gitbook-71b59b1950dbbb02e95b34dfdb26e8ad8c6e31a0.tar.gz
gitbook-71b59b1950dbbb02e95b34dfdb26e8ad8c6e31a0.tar.bz2
Correctly detect promises from block.process in TemplateEngine.applyBlock()
Diffstat (limited to 'lib/template/index.js')
-rw-r--r--lib/template/index.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/template/index.js b/lib/template/index.js
index 3177ae0..ae11bc9 100644
--- a/lib/template/index.js
+++ b/lib/template/index.js
@@ -391,7 +391,7 @@ TemplateEngine.prototype.applyBlock = function(name, blk, ctx) {
func = this.bindContext(block.process);
r = func.call(ctx || {}, blk);
- if (Promise.isPromise(r)) return r.then(normBlockResult);
+ if (Promise.isPromiseAlike(r)) return Promise(r).then(normBlockResult);
else return normBlockResult(r);
};