diff options
Diffstat (limited to 'lib/models/templateBlock.js')
-rw-r--r-- | lib/models/templateBlock.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/models/templateBlock.js b/lib/models/templateBlock.js index cce636e..4094b89 100644 --- a/lib/models/templateBlock.js +++ b/lib/models/templateBlock.js @@ -9,12 +9,24 @@ var NODE_ENDARGS = '%%endargs%%'; var blockBodies = {}; var TemplateBlock = Immutable.Record({ + // Name of block, also the start tag name: String(), + + // End tag, default to "end<name>" end: String(), + + // Function to process the block content process: Function(), + + // List of String, for inner block tags blocks: Immutable.List(), + + // List of shortcuts to replace with this block shortcuts: Immutable.List(), + + // Function to execute in post processing post: null, + parse: true }, 'TemplateBlock'); @@ -208,6 +220,7 @@ TemplateBlock.prototype.handleBlockResult = function(result) { if (is.string(result)) { result = { body: result }; } + result.name = this.getName(); return result; }; @@ -251,6 +264,16 @@ TemplateBlock.indexBlockResult = function(blk) { }; /** + Get a block results indexed for a specific key + + @param {String} key + @return {Object|undefined} +*/ +TemplateBlock.getBlockResultByKey = function(key) { + return blockBodies[key]; +}; + +/** Create a template block from a function or an object @param {String} blockName |