diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-04-27 16:22:17 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-04-27 16:22:17 +0200 |
commit | e50422bce588ec5a0b5581bf3963b0995138de4c (patch) | |
tree | 5128b5759c2bed3d9cac21fa8de5ccc1b3ead7bb /lib/models/templateBlock.js | |
parent | 999882e72327e06dd2fd346ca13eccb1c7e8781f (diff) | |
download | gitbook-e50422bce588ec5a0b5581bf3963b0995138de4c.zip gitbook-e50422bce588ec5a0b5581bf3963b0995138de4c.tar.gz gitbook-e50422bce588ec5a0b5581bf3963b0995138de4c.tar.bz2 |
Use code TemplateBlock to highlight code
Diffstat (limited to 'lib/models/templateBlock.js')
-rw-r--r-- | lib/models/templateBlock.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/models/templateBlock.js b/lib/models/templateBlock.js index 4094b89..92a0bf3 100644 --- a/lib/models/templateBlock.js +++ b/lib/models/templateBlock.js @@ -1,4 +1,5 @@ var is = require('is'); +var extend = require('extend'); var Immutable = require('immutable'); var Promise = require('../utils/promise'); @@ -72,7 +73,7 @@ TemplateBlock.prototype.getExtensionName = function() { @return {Nunjucks.Extension} */ -TemplateBlock.prototype.toNunjucksExt = function() { +TemplateBlock.prototype.toNunjucksExt = function(mainContext) { var that = this; var name = this.getName(); var endTag = this.getEndTag(); @@ -175,7 +176,11 @@ TemplateBlock.prototype.toNunjucksExt = function() { Promise() .then(function() { - return that.applyBlock(mainBlock, context); + var ctx = extend({ + ctx: context + }, mainContext || {}); + + return that.applyBlock(mainBlock, ctx); }) .then(function(result) { return that.blockResultToHtml(result); |