Render templates
491005
def run(self, files, stack):
        ""
        # make stack available to all templates
        self.env.globals['stack'] = stack

        for filename, post in files.items():
            # render content first
            post.content = self.env.from_string(post.content).render(post.metadata)

            # check for a template field
            if "template" in post.metadata:
                template = self.env.get_template(post['template'])

            # or use the default template
            elif hasattr(self, 'default_template'):
                template = self.default_template

            else: # no template, so bail
                continue

            # at this point, we have a template, so render
            post.content = template.render(post=post)
1290235
function render_template(type, object) {
  try {
    return new EJS({text: __templates[type]}).render(object);
  } catch (e) {
    //console.error(e);
    return "";
  }
}
17424
def render(self, name, context):
        """"""
        if Generator.strict:
            self.env.undefined = TestableUndefined
        else:
            self.env.undefined = Undefined
        template = self.get_template(name)
        return template.render(context)
30907
function render(form, template) {
  const compiledRowTemplate = handlebars.compile(
    '<tr class="form-element">' +
      '<td class="key">{{key}}</td>' +
      '<td class="value">{{value}}</td>' +
    '</tr>');
  const compiledTable = handlebars.compile(
    '<table><tbody>{{{rows}}}</tbody></table>');
  const compiledTemplate = handlebars.compile(template);

  const formElements = form.map(({key, value}) => {
    if (key !== 'File') {
      return compiledRowTemplate({key, value: unescape(value)});
    }

    return null;
  });

  const formData = compiledTable({rows: formElements.join(' ')});

  return compiledTemplate({formData});
}
283342
def render(self, template, filename, context={}, filters={}):
        
        filename = os.path.normpath(filename)
        path, file = os.path.split(filename)
        try:
            os.makedirs(path)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise

        path, file = os.path.split(template)
        loader = jinja2.FileSystemLoader(path)
        env = jinja2.Environment(loader=loader, trim_blocks=True, lstrip_blocks=True)
        env.filters.update(filters)
        template = env.get_template(file)
        text = template.render(context)
        with open(filename, 'wt') as f:
            f.write(text)
839942
def render(self, template_name, **kw):
        ''
        return self.env.get_template(template_name).render(**kw)
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);
  }
273619
function render_with_layout(template, locals, cb) {
    render_file(locals, function(err, str) {
      if (err) {
        return cb(err);
      }

      locals.body = str;

      var res = template(locals, handlebarsOpts);
      self.async.done(function(values) {
        Object.keys(values).forEach(function(id) {
          res = res.replace(id, values[id]);
        });

        cb(null, res);
      });
    });
  }
381631
def render(self, data, div_id="chart", head=""):
        """"""
        if not self.is_valid_name(div_id):
            raise ValueError(
                "Name {} is invalid. Only letters, numbers, '_', and '-' are permitted ".format(
                    div_id))

        return Template(head + self.template).render(
            div_id=div_id.replace(" ", "_"),
            data=json.dumps(
                data, indent=4).replace("'", "\\'").replace('"', "'"))
72936
function renderCustomTemplate() {

	var that = this,
	    child,
	    vars = {},
	    i;

	for (i = 0; i < this.children.length; i++) {
		child = this.children[i];

		if (!child.getAttribute) {
			continue;
		}

		if (child.getAttribute('slot')) {
			vars[child.getAttribute('slot')] = child;
		}
	}

	Hawkejs.removeChildren(this);

	return Fn.series(function renderTemplate(next) {

		var template = that.constructor.compiled_template || that.constructor.template_file;

		that.hawkejs_renderer.renderTemplate(template, {self: that}, String(c++)).done(next);
	}, function assembleBlock(next, template) {
		template.target_block.assemble().done(next);
	}, function assembledBlock(next, block) {

		var slots,
		    slot,
		    name,
		    i;

		for (i = 0; i < block.lines.length; i++) {
			that.append(block.lines[i]);
		}

		slots = Hawkejs.getElementsByAttribute(that, 'data-he-slot');

		for (i = 0; i < slots.length; i++) {
			slot = slots[i];
			name = slot.dataset.heSlot;

			if (vars[name]) {
				Hawkejs.replaceChildren(slot, vars[name].childNodes);
			}
		}

		next();
	}, null);
}
535819
def render_template(env, filename, values=None):
    
    if not values:
        values = {}
    tmpl = env.get_template(filename)
    return tmpl.render(values)
719231
def template_string(context, template):
    ''
    if not isinstance(context, Context):
        context = Context(context)
    return Template(template).render(context)
519669
function renderTemplate(template, css, data={}){
  
    // assign css
    data.inlinecss = css;

    // render template - use custom escape function to handle linebreaks!
    return _ejs.render(template, data, {
        escape: function(text){
            if (!text){
                return '';
            }

            // apply generic escape function
            text = _ejs.escapeXML(text);

            // linebreaks
            text = text.replace(/\n/g, '<br />');

            return text;
        }
    });
}
1123004
def render_template(template_file, template_vars):
    """"""
    # Load our Jinja templates
    template_dir = "{0}/templates".format(
        os.path.dirname(os.path.abspath(__file__))
    )
    jinja_env = jinja2.Environment(
        loader=jinja2.FileSystemLoader(template_dir),
        trim_blocks=True
    )
    rendered = jinja_env.get_template(template_file).render(template_vars)

    return rendered
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']
731090
function render(templateFile, replacements) {

  var template = fs.readFileSync(templateFile, "utf8");

  for(var name in replacements) {
    if(!replacements.hasOwnProperty(name)) continue;
    template = template.replace(new RegExp("%"+name+"%", "g"), replacements[name].toString())
  }

  return template;
}
87332
public Renderable<?> render(Template template, Map<String, Object> parameters) {
        return template.render(this, parameters);
    }