diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-05-08 22:33:41 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-05-08 22:33:41 +0200 |
commit | 3d0054dd643a813aa10ace89920a5c910048a232 (patch) | |
tree | 2ff648fe5cc1e03f017cc423606e0cfeba27aaad | |
parent | 13bc89ff4490abb9ea6ea6bd98bf86a9ad08325b (diff) | |
download | gitbook-3d0054dd643a813aa10ace89920a5c910048a232.zip gitbook-3d0054dd643a813aa10ace89920a5c910048a232.tar.gz gitbook-3d0054dd643a813aa10ace89920a5c910048a232.tar.bz2 |
Fix #1286: by default blocks should not be parsable
-rw-r--r-- | lib/models/templateBlock.js | 11 | ||||
-rw-r--r-- | lib/templating/postRender.js | 2 |
2 files changed, 3 insertions, 10 deletions
diff --git a/lib/models/templateBlock.js b/lib/models/templateBlock.js index 200e048..2f7e19a 100644 --- a/lib/models/templateBlock.js +++ b/lib/models/templateBlock.js @@ -23,18 +23,12 @@ var TemplateBlock = Immutable.Record({ // List of shortcuts to replace with this block shortcuts: Immutable.Map(), - - parse: true }, 'TemplateBlock'); TemplateBlock.prototype.getName = function() { return this.get('name'); }; -TemplateBlock.prototype.getParse = function() { - return this.get('parse'); -}; - TemplateBlock.prototype.getEndTag = function() { return this.get('end') || ('end' + this.getName()); }; @@ -241,9 +235,8 @@ TemplateBlock.prototype.normalizeBlockResult = function(result) { @return {String} */ TemplateBlock.prototype.blockResultToHtml = function(result, blocksOutput) { - var parse = this.getParse(); var indexedKey; - var toIndex = (!parse) || (result.post !== undefined); + var toIndex = (!result.parse) || (result.post !== undefined); if (toIndex) { indexedKey = genKey(); @@ -251,7 +244,7 @@ TemplateBlock.prototype.blockResultToHtml = function(result, blocksOutput) { } // Parsable block, just return it - if (parse) { + if (result.parse) { return result.body; } diff --git a/lib/templating/postRender.js b/lib/templating/postRender.js index 2662814..ec67696 100644 --- a/lib/templating/postRender.js +++ b/lib/templating/postRender.js @@ -36,7 +36,7 @@ function postRender(engine, output) { var content = output.getContent(); var blocks = output.getBlocks(); - var result = replaceBlocks(content); + var result = replaceBlocks(content, blocks); return Promise.forEach(blocks, function(block) { var post = block.get('post'); |