Render the template_file, passing the functions and grains into the
    Mako rendering system.

    :rtype: string
551067
def render(template_file, saltenv='base', sls='', context=None, tmplpath=None, **kws):
    '''
    
    '''
    tmp_data = salt.utils.templates.MAKO(template_file, to_str=True,
                    salt=__salt__,
                    grains=__grains__,
                    opts=__opts__,
                    pillar=__pillar__,
                    saltenv=saltenv,
                    sls=sls,
                    context=context,
                    tmplpath=tmplpath,
                    **kws)
    if not tmp_data.get('result', False):
        raise SaltRenderError(tmp_data.get('data',
            'Unknown render error in mako renderer'))
    return six.moves.StringIO(tmp_data['data'])
1281625
def render_publ_template(template, **kwargs):
    
    text = render_template(
        template.filename,
        template=template,
        image=image_function(
            template=template,
            category=kwargs.get('category'),
            entry=kwargs.get('entry')),
        **kwargs
    )

    return text, caching.get_etag(text)
1018132
def render(self, context):
        
        try:
            args, ctx = self.get_resolved_arguments(context)
            target = args[0]
            if not target:
                return ''
            ctx['content'] = target
        except VariableDoesNotExist:
            return ''

        emitter = context.get('emitter')
        t_name = emitter.get_template_path(target)
        t = get_template(t_name)
        context.dicts.append(ctx)
        response = t.nodelist.render(context)
        context.pop()
        return response
584944
function renderTemplate(template, context) {
			try {
				var func = _.template(template.template);
				return func(context);
			}
			catch (e) {
				grunt.fail.fatal('Error while rendering template ' + template.filename + ': ' + e.message);
			}
		}
622177
def _render(template, callable_, args, data, as_unicode=False):
    """"""

    if as_unicode:
        buf = util.FastEncodingBuffer(as_unicode=True)
    elif template.bytestring_passthrough:
        buf = compat.StringIO()
    else:
        buf = util.FastEncodingBuffer(
                        as_unicode=as_unicode,
                        encoding=template.output_encoding,
                        errors=template.encoding_errors)
    context = Context(buf, **data)
    context._outputting_as_unicode = as_unicode
    context._set_with_template(template)

    _render_context(template, callable_, context, *args,
                            **_kwargs_for_callable(callable_, data))
    return context._pop_buffer().getvalue()
1073903
def render(template, saltenv='base', sls='', tmplpath=None, **kws):
    '''
    
    '''
    template = tmplpath
    if not os.path.isfile(template):
        raise SaltRenderError('Template {0} is not a file!'.format(template))

    tmp_data = salt.utils.templates.py(
            template,
            True,
            __salt__=__salt__,
            salt=__salt__,
            __grains__=__grains__,
            grains=__grains__,
            __opts__=__opts__,
            opts=__opts__,
            __pillar__=__pillar__,
            pillar=__pillar__,
            __env__=saltenv,
            saltenv=saltenv,
            __sls__=sls,
            sls=sls,
            **kws)
    if not tmp_data.get('result', False):
        raise SaltRenderError(tmp_data.get('data',
            'Unknown render error in py renderer'))

    return tmp_data['data']
190184
def write(self, file):
        
        render(
            self.template,
            file,
            benchmarks=self.benchmarks,
            hostname=socket.gethostname(),
        )
1333465
def render_path(self, template_path, *context, **kwargs):
        
        loader = self._make_loader()
        template = loader.read(template_path)

        return self._render_string(template, *context, **kwargs)
698592
def _render_template(options)
        if options.delete(:stream)
          Rack::Chunked::Body.new view_renderer.render_body(view_context, options)
        else
          super
        end
      end
206023
def render_mako_template(self, template_path, context=None):
        
        context = context or {}
        template_str = self.load_unicode(template_path)
        lookup = MakoTemplateLookup(directories=[pkg_resources.resource_filename(self.module_name, '')])
        template = MakoTemplate(template_str, lookup=lookup)
        return template.render(**context)
12216
def render_string(self, template_name: str, **kwargs: Any) -> bytes:
        
        # If no template_path is specified, use the path of the calling file
        template_path = self.get_template_path()
        if not template_path:
            frame = sys._getframe(0)
            web_file = frame.f_code.co_filename
            while frame.f_code.co_filename == web_file:
                frame = frame.f_back
            assert frame.f_code.co_filename is not None
            template_path = os.path.dirname(frame.f_code.co_filename)
        with RequestHandler._template_loader_lock:
            if template_path not in RequestHandler._template_loaders:
                loader = self.create_template_loader(template_path)
                RequestHandler._template_loaders[template_path] = loader
            else:
                loader = RequestHandler._template_loaders[template_path]
        t = loader.load(template_name)
        namespace = self.get_template_namespace()
        namespace.update(kwargs)
        return t.generate(**namespace)
748966
def render(self, hosts, vars={}):
        
        if self.tpl_file.endswith(".tpl"):
            return self._render_mako(hosts, vars)
        elif self.tpl_file.endswith(".py"):
            return self._render_py(hosts, vars)
        else:
            raise ValueError("Don't know how to handle '{0}'".format(self.tpl_file))
993776
function render(filename, options, callback) {
  var isAsync = callback && typeof callback === 'function';

  if (!isAsync) {
    return renderSync(filename, options)
  }

  getTemplate(filename, options, function(err, template) {
    if (err) {
      return callback(err);
    }

    template.render({ model: options, }, callback);
  });
}
400483
def render_workflow_html_template(filename, subtemplate, filelists, **kwargs):
    

    dirnam = os.path.dirname(filename)
    makedir(dirnam)

    try:
        filenames = [f.name for filelist in filelists for f in filelist if f is not None]
    except TypeError:
        filenames = []

    # render subtemplate
    subtemplate_dir = pycbc.results.__path__[0] + '/templates/wells'
    env = Environment(loader=FileSystemLoader(subtemplate_dir))
    env.globals.update(get_embedded_config=get_embedded_config)
    env.globals.update(path_exists=os.path.exists)
    env.globals.update(len=len)
    subtemplate = env.get_template(subtemplate)
    context = {'filelists' : filelists,
               'dir' : dirnam}
    context.update(kwargs)
    output = subtemplate.render(context)

    # save as html page
    kwds = {'render-function' : 'render_tmplt',
            'filenames' : ','.join(filenames)}
    save_html_with_metadata(str(output), filename, None, kwds)
503255
def render_string(template_string, context, format = default_format)
      render_file(proc_template(template_string), context, format)
    end
443686
def render(self):
        
        with codecs.open(self.template_file, encoding=self.encoding) as template_src:
            template = jinja2.Template(template_src.read())
        slides = self.fetch_contents(self.source)
        context = self.get_template_vars(slides)

        html = template.render(context)

        if self.embed:
            images = re.findall(r'url\(["\']?(.*?\.(?:jpe?g|gif|png|svg)[\'"]?)\)',
                html, re.DOTALL | re.UNICODE)

            for img_url in images:
                img_url = img_url.replace('"', '').replace("'", '')
                if self.theme_dir:
                    source = os.path.join(self.theme_dir, 'css')
                else:
                    source = os.path.join(THEMES_DIR, self.theme, 'css')

                encoded_url = utils.encode_image_from_url(img_url, source)
                if encoded_url:
                    html = html.replace(img_url, encoded_url, 1)
                    self.log("Embedded theme image %s from theme directory %s" % (img_url, source))
                else:
                    # Missing file in theme directory. Try user_css folders
                    found = False
                    for css_entry in context['user_css']:
                        directory = os.path.dirname(css_entry['path_url'])
                        if not directory:
                            directory = "."

                        encoded_url = utils.encode_image_from_url(img_url, directory)

                        if encoded_url:
                            found = True
                            html = html.replace(img_url, encoded_url, 1)
                            self.log("Embedded theme image %s from directory %s" % (img_url, directory))

                    if not found:
                        # Missing image file, etc...
                        self.log(u"Failed to embed theme image %s" % img_url)

        return html
1246094
def _render(self, data, formula_def):
        '''
        
        '''
        # FORMULA can contain a renderer option
        renderer = formula_def.get('renderer', self.opts.get('renderer', 'jinja|yaml'))
        rend = salt.loader.render(self.opts, {})
        blacklist = self.opts.get('renderer_blacklist')
        whitelist = self.opts.get('renderer_whitelist')
        template_vars = formula_def.copy()
        template_vars['opts'] = self.opts.copy()
        return compile_template(
            ':string:',
            rend,
            renderer,
            blacklist,
            whitelist,
            input_data=data,
            **template_vars
        )