summaryrefslogtreecommitdiffstats
path: root/lib/models/templateBlock.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/models/templateBlock.js')
-rw-r--r--lib/models/templateBlock.js9
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);