Renders `template` with given `locals` and calls `cb` with the
resulting HTML string.

@param template
@param locals
@param cb
194921
function renderTemplate(template, locals, cb) {
    var res;

    try {
      var localTemplateOptions = self.getLocalTemplateOptions(locals);
      var localsClone = _.extend({}, locals);
      self.updateLocalTemplateOptions(localsClone, undefined);
      res = template(localsClone, _.merge({}, self._options.templateOptions, localTemplateOptions));
    } catch (err) {
      if (err.message) {
        err.message = '[' + template.__filename + '] ' + err.message;
      } else if (typeof err === 'string') {
        return cb('[' + template.__filename + '] ' + err, null);
      }
      return cb(err, null);
    }
    cb(null, res);
  }
745940
def render(self, **kwargs):
        """"""
        return self._template.render(this=self, kwargs=kwargs)
1258549
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;
  }
810997
def render(self, template, fail='## :todo: add {template}'):
        
        try:
            return self._templates[template].render(scaffold=self)
        except KeyError:
            return fail.format(template=template)
20310
public function renderWithLayout($template, array $localVariables = array())
    {
        $this->addData(array(
            'localVariables' => $localVariables,
            'view'           => $template,
        ));

        return $this->render($this->getLayout(), $localVariables);
    }
136419
function sendMail (template, locals, options, callback) {
  var self = this
  this.render(template, locals, function (err, html, text) {
    if (err) { return callback(err) }

    self.transport.sendMail({
      from: options.from || defaultFrom,
      to: options.to,
      subject: options.subject,
      html: html,
      text: text
    }, callback)
  })
}
523635
def render(template, dest, **kwargs):
    '''
    '''

    template = environment.get_template(template)
    text = template.render(**kwargs)

    f = open(dest, 'wb')
    f.write(text.encode('utf-8'))
    f.close()
1195083
public void onCacheMiss(String template, int locality) {
        final String methodName = "onCacheMiss()";

        CacheStatsModule csm = null;
        if ((csm = getCSM(template)) == null) {
            return;
        }
        if (tc.isDebugEnabled())
            Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " template=" + template + " locality=" + locality + " enable=" + csm._enable
                    + " " + this);
        if (csm._enable && csm._missCount != null)
            csm._missCount.increment();
        return;
    }
564986
def render(self, template, context_stack, delimiters=None):
        
        parsed_template = parse(template, delimiters)

        return parsed_template.render(self, context_stack)
1357840
function compileFile(locals, cb) {
    getSourceTemplate(function(err, source, template) {
      if (err) return cb(err);

      // Try to get the layout
      parseLayout(source, filename, function(err, layoutTemplates) {
        if (err) return cb(err);

        function renderIt(layoutTemplates) {
          if (self._options.beautify) {
            return render(template, locals, layoutTemplates, function(err, html) {
              if (err) return cb(err);
              loadBeautify();
              return cb(null, self.beautify(html, self.beautifyrc));
            });
          }
          return render(template, locals, layoutTemplates, cb);
        }

        // Determine which layout to use

        if (typeof options.layout !== 'undefined' && !options.layout) {
          // If options.layout is falsy, behave as if no layout should be used - suppress defaults
          renderIt(null);
        } else if (layoutTemplates) {
          // 1. Layout specified in template
          renderIt(layoutTemplates);
        } else if (typeof options.layout !== 'undefined' && options.layout) {
          // 2. Layout specified by options from render
          var layoutFile = self.layoutPath(filename, options.layout);
          self.cacheLayout(layoutFile, options.cache, function(err, layoutTemplates) {
            if (err) return cb(err);
            renderIt(layoutTemplates);
          });
        } else if (self.defaultLayoutTemplates) {
          // 3. Default layout specified when middleware was configured.
          renderIt(self.defaultLayoutTemplates);
        } else {
          // render without a template
          renderIt(null);
        }
      });
    });
  }
1098060
def render_local_template(service_name, environment, repo_root, template_file):
    
    cmd = 'cd {} && ef-cf {} {} --devel --verbose'.format(repo_root, template_file, environment)
    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = p.communicate()

    if p.returncode != 0:
        stderr = indentify('\n{}'.format(stderr))
        stdout = indentify('\n{}'.format(stdout))
        raise Exception('Service: `{}`, Env: `{}`, Msg: `{}{}`'
                        .format(service_name, environment, stderr, stdout))

    logger.debug('Rendered template for `%s` in `%s`', template_file, environment)

    r = re.match(r".*(^{.*^})$", stdout, re.MULTILINE | re.DOTALL)
    return jsonify(json.loads(r.group(1)))
1280105
def render(template, **kwargs):
    
    import jinja2
    import os.path as path

    searchpath = path.join(path.dirname(__file__), 
        "templates") 
    loader = jinja2.FileSystemLoader(searchpath=searchpath)
    env = jinja2.Environment(loader=loader)
    temp = env.get_template(template)

    return temp.render(**kwargs)
289546
function render(template, data, block) {
  data = Benchpress.addGlobals(data || {});

  return Promise.try(() => {
    Benchpress.cache[template] = Benchpress.cache[template] || load(template);
    return Benchpress.cache[template];
  }).then((templateFunction) => {
    if (block) {
      templateFunction = templateFunction.blocks && templateFunction.blocks[block];
    }
    if (!templateFunction) {
      return '';
    }

    return runtime(Benchpress.helpers, data, templateFunction);
  });
}
87332
public Renderable<?> render(Template template, Map<String, Object> parameters) {
        return template.render(this, parameters);
    }
909017
function(template, options) {
    options = options || {};
    options.pretty = true;
    var fn = jade.compile(template, options);
    return fn(options.locals);
  }
1290235
function render_template(type, object) {
  try {
    return new EJS({text: __templates[type]}).render(object);
  } catch (e) {
    //console.error(e);
    return "";
  }
}
480916
def render(template, *arguments)
      #
      # find the right renderer we need
      #
      block, handler = find_template(template)

      raise TemplateNotFound if block.nil?

      ctx = handler.new(self)
      ctx.params = @params
      ctx.request = @request

      ctx.instance_exec(*arguments, &block)
    end