summaryrefslogtreecommitdiffstats
path: root/lib/models/templateEngine.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/models/templateEngine.js')
-rw-r--r--lib/models/templateEngine.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/models/templateEngine.js b/lib/models/templateEngine.js
index 9a18bd4..28322ea 100644
--- a/lib/models/templateEngine.js
+++ b/lib/models/templateEngine.js
@@ -43,6 +43,19 @@ TemplateEngine.prototype.getContext = function() {
};
/**
+ Return a block by its name (or undefined)
+
+ @param {String} name
+ @return {TemplateBlock}
+*/
+TemplateEngine.prototype.getBlock = function(name) {
+ var blocks = this.getBlocks();
+ return blocks.find(function(block) {
+ return block.getName() === name;
+ });
+};
+
+/**
Return a nunjucks environment from this configuration
@return {Nunjucks.Environment}