summaryrefslogtreecommitdiffstats
path: root/lib/template/index.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-24 17:02:34 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-24 17:02:34 +0100
commit1fa952b9301dd48bc3d065f2a6e6ea7db3d9dd11 (patch)
treecc47a8a4472accc20fad7ccfed7780d3d743370e /lib/template/index.js
parent78e11bc6be6d114c89e85ee5ba46448b7cdf7849 (diff)
downloadgitbook-1fa952b9301dd48bc3d065f2a6e6ea7db3d9dd11.zip
gitbook-1fa952b9301dd48bc3d065f2a6e6ea7db3d9dd11.tar.gz
gitbook-1fa952b9301dd48bc3d065f2a6e6ea7db3d9dd11.tar.bz2
Fix inclusion of block using a simple function
Diffstat (limited to 'lib/template/index.js')
-rw-r--r--lib/template/index.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/template/index.js b/lib/template/index.js
index 8a52392..fc7603d 100644
--- a/lib/template/index.js
+++ b/lib/template/index.js
@@ -146,12 +146,15 @@ TemplateEngine.prototype.addBlock = function(name, block) {
block = _.defaults(block || {}, {
shortcuts: [],
end: 'end'+name,
- process: _.identity,
blocks: []
});
extName = blockExtName(name);
+ if (!block.process) {
+ throw new Error('Invalid block "' + name + '", it should have a "process" method');
+ }
+
if (this.hasBlock(name) && !defaultBlocks[name]) {
this.log.warn.ln('conflict in blocks, "'+name+'" is already defined');
}