lib/index.js
function resolveTemplate (tfiles, tfile, resolved, temp = '') {
    
    // If parent layout was called by a page directly (vs. through a child layout)
    // inject already resolved content with child `temp`
    if (resolved[tfile]) {
      return injectContent(resolved[tfile], temp);
    }
    
    // Process layout as prescribed
    else if (tfiles[tfile]) {
      
      // Lookup layout in tfiles tree
      let tdata = tfiles[tfile];
      
      // Combine parent-child on `temp` via `injectContent`
      temp = injectContent(tdata.contents.toString(), temp);
      
      // If this layout has a parent `layout` in front-matter, "lather, rinse, repeat"
      return tdata.layout ? resolveTemplate(tfiles, tdata.layout, resolved, temp) : temp;
    }
    else {
      return temp;
    }
  }
function resolveTemplate (tfiles, tfile, resolved, temp = '') {
    
    // If parent layout was called by a page directly (vs. through a child layout)
    // inject already resolved content with child `temp`
    if (resolved[tfile]) {
      return injectContent(resolved[tfile], temp);
    }
    
    // Process layout as prescribed
    else if (tfiles[tfile]) {
      
      // Lookup layout in tfiles tree
      let tdata = tfiles[tfile];
      
      // Combine parent-child on `temp` via `injectContent`
      temp = injectContent(tdata.contents.toString(), temp);
      
      // If this layout has a parent `layout` in front-matter, "lather, rinse, repeat"
      return tdata.layout ? resolveTemplate(tfiles, tdata.layout, resolved, temp) : temp;
    }
    else {
      return temp;
    }
  }
function resolveTemplate ( tfiles , tfile , resolved , temp = '' ) { // If parent layout was called by a page directly (vs. through a child layout) // inject already resolved content with child `temp` if ( resolved [ tfile ] ) { return injectContent ( resolved [ tfile ] , temp ) ; } // Process layout as prescribed else if ( tfiles [ tfile ] ) { // Lookup layout in tfiles tree let tdata = tfiles [ tfile ] ; // Combine parent-child on `temp` via `injectContent` temp = injectContent ( tdata . contents . toString ( ) , temp ) ; // If this layout has a parent `layout` in front-matter, "lather, rinse, repeat" return tdata . layout ? resolveTemplate ( tfiles , tdata . layout , resolved , temp ) : temp ; } else { return temp ; } }
Recursively look up specified `layout` in front-matter and combine
contents with previous results on `temp` via `injectContent` method

@param {Object} tfiles
@param {String} tfile
@param {Object} resolved
@param {String} temp
@return {String}
Recursively look up specified layout in front - matter and combine contents with previous results on temp via injectContent method