diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-04-25 13:52:56 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-04-25 13:52:56 +0200 |
commit | 4aed2cf65240abb26384d7d86ccb27b171e6bb9a (patch) | |
tree | 949ede45c93c37215c44bd1b190248d7669501b0 /lib/models/templateEngine.js | |
parent | 244fb0ca28f29ac429f58e0e885d21cc6c40beba (diff) | |
download | gitbook-4aed2cf65240abb26384d7d86ccb27b171e6bb9a.zip gitbook-4aed2cf65240abb26384d7d86ccb27b171e6bb9a.tar.gz gitbook-4aed2cf65240abb26384d7d86ccb27b171e6bb9a.tar.bz2 |
Add post processing for templates
Diffstat (limited to 'lib/models/templateEngine.js')
-rw-r--r-- | lib/models/templateEngine.js | 13 |
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} |