code: function renderTemplate(fragment, templateName) {
      if (templateName === 'none') return fragment._txt;
      var t = generator.template$[templateName];
      if (!t) {
        log('Unknown template %s for %s, using default.', templateName, fragment._href);
        t = generator.template$.default;
      }
  
      var out;
      try { out = t(fragment); }
      catch(err) {
        var msg = u.format('Error rendering %s\n\ntemplate: %s\n',
                           fragment._href, templateName, err.stack || err);
        log(msg);
        out = opts.production ? '' : '<pre>' + esc(msg) + '</pre>';
      }
  
      return out;
    }
docs: template renderer handles missing template and template runtime errors