code: function (index, blocks, out) {
          var node = new Node("template");
          var block = blocks[index];
  
          var validationResults = this._processTemplateStart(block.attributes, block.closingBrace);
          if (validationResults.errors.length > 0) {
              this._logError("Invalid template declaration", {
                  line: block.line,
                  column : block.column,
                  code: validationResults.code,
                  suberrors: validationResults.errors
              });
          }
          node.name = block.name;
  
          if (block.controller) {
              node.controller = block.controller;
              node.controller.ref = block.controllerRef;
          } else if (block.args) {
              node.args = block.args;
              // check args
              for (var i=0; i < node.args.length; i++) {
                  if (reservedKeywords[node.args[i]]) {
                      this._logError("Reserved keywords cannot be used as template argument: "+node.args[i], block);
                  }
              }
          }
          node.isExport = (block.modifier !== null && block.modifier.type === "export");
          node.isExportModule = (block.modifier !== null && block.modifier.type === "export-module");
          node.startLine = block.line;
          node.endLine = block.endLine;
          node.content = [];
          out.push(node);
  
          if (!block.closed) {
              this._logError("Missing end template statement", block);
          }
  
          // parse sub-list of blocks
          this._advance(block.content, 0, node.content);
          return index;
      }
docs: Manages a template block.
  @param {Array} blocks the full list of blocks.
  @param {Integer} index the index of the block to manage.
  @param {Array} out the output as an array of Node.
  @return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.