allows a template to be included where the data supplied to the template is specified at the point of template invocation (rather than just inheriting the current data context)
777927
function register(handlebars) {
  handlebars.registerHelper('dynamic-include', function(templateName, context) {
    var templateFile = '_includes/' + templateName + '.hbs';
    var templateMatter = matter.read(templateFile);
    var compiledTemplate = handlebars.compile(templateMatter.content);
    var data = extend({}, context.data.root);
    Object.keys(context.hash)
            .forEach(function(key) {
              if (context.data.root[context.hash[key]]) {
                data[key] = context.data.root[context.hash[key]];
              }
            });
    return compiledTemplate(data);
  });
}
518120
function templateSourceUpdate(){
    if (this.destroyBuilder)
      buildTemplate.call(this);

    var cursor = this;
    while (cursor = cursor.attaches_)
      cursor.handler.call(cursor.context);
  }
123035
private synchronized void ensureTemplatesResolved() throws SpecNotFoundException, TemplateException{
    if (this.resolved) {
      return;
    }
    Map<URI, JobTemplate> loadedTemplates = Maps.newHashMap();
    loadedTemplates.put(getUri(), this);
    resolveTemplates(loadedTemplates);
  }
684006
def template(tpl, template_adapter=SimpleTemplate, **kwargs):
    '''
    
    '''
    if tpl not in TEMPLATES or DEBUG:
        settings = kwargs.get('template_settings',{})
        lookup = kwargs.get('template_lookup', TEMPLATE_PATH)
        if isinstance(tpl, template_adapter):
            TEMPLATES[tpl] = tpl
            if settings: TEMPLATES[tpl].prepare(settings)
        elif "\n" in tpl or "{" in tpl or "%" in tpl or '$' in tpl:
            TEMPLATES[tpl] = template_adapter(source=tpl, lookup=lookup, settings=settings)
        else:
            TEMPLATES[tpl] = template_adapter(name=tpl, lookup=lookup, settings=settings)
    if not TEMPLATES[tpl]:
        abort(500, 'Template (%s) not found' % tpl)
    kwargs['abort'] = abort
    kwargs['request'] = request
    kwargs['response'] = response
    return TEMPLATES[tpl].render(**kwargs)
582261
def _dumpdata_template(self, stringbuffer, index, name, opts):
        
        context = self._get_dump_item_context(index, name, opts)

        stringbuffer.write(self.dumper_item_template.format(**context))

        return stringbuffer
860965
public void initDocument()
    throws TemplateInitException
    {
        /*
         *  send an empty InternalContextAdapter down into the AST to initialize it
         */

        InternalContextAdapterImpl ica = new InternalContextAdapterImpl(  new VelocityContext() );

        try
        {
            /*
             *  put the current template name on the stack
             */

            ica.pushCurrentTemplateName( name );
            ica.setCurrentResource( this );

            /*
             *  init the AST
             */

            ((SimpleNode)data).init( ica, rsvc);

            String property = scopeName+'.'+RuntimeConstants.PROVIDE_SCOPE_CONTROL;
            provideScope = rsvc.getBoolean(property, provideScope);
        }
        finally
        {
            /*
             *  in case something blows up...
             *  pull it off for completeness
             */

            ica.popCurrentTemplateName();
            ica.setCurrentResource( null );
        }

    }
158718
public void addIncludeTemplateClass(TemplateClass tc) {
        includedTemplateClasses.add(tc);
        includeTagTypes.putAll(tc.includeTagTypes);
    }
400136
function compile (template, data) {
    for (var name in data) {
      template = template.replace('{{' + name + '}}', data[name])
    }
    return template
  }
1182271
private void initTemplates() throws Exception {
        if (templates != null && templates.length > 0) {
            for (String template : templates) {
                Assert.hasText(template, "Can not read template in ["
                        + template
                        + "]. Check that templates is not empty.");
                createTemplate(client.getLowLevelClient(), classpathRoot, template, forceTemplate);
            }
        }
    }
290170
def dynamic_template_data(self, value):
        
        if not isinstance(value, DynamicTemplateData):
            value = DynamicTemplateData(value)
        try:
            personalization = self._personalizations[value.personalization]
            has_internal_personalization = True
        except IndexError:
            personalization = Personalization()
            has_internal_personalization = False
        personalization.dynamic_template_data = value.dynamic_template_data

        if not has_internal_personalization:
            self.add_personalization(
                personalization, index=value.personalization)
562309
def _init_template(self, cls, base_init_template):
    ''''''

    # TODO: could disallow using a metaclass.. but this is good enough
    # .. if you disagree, feel free to fix it and issue a PR :)
    if self.__class__ is not cls:
        raise TypeError("Inheritance from classes with @GtkTemplate decorators "
                        "is not allowed at this time")

    connected_signals = set()
    self.__connected_template_signals__ = connected_signals

    base_init_template(self)

    for name in self.__gtemplate_widgets__:
        widget = self.get_template_child(cls, name)
        self.__dict__[name] = widget

        if widget is None:
            # Bug: if you bind a template child, and one of them was
            #      not present, then the whole template is broken (and
            #      it's not currently possible for us to know which
            #      one is broken either -- but the stderr should show
            #      something useful with a Gtk-CRITICAL message)
            raise AttributeError("A missing child widget was set using "
                                 "GtkTemplate.Child and the entire "
                                 "template is now broken (widgets: %s)" %
                                 ', '.join(self.__gtemplate_widgets__))

    for name in self.__gtemplate_methods__.difference(connected_signals):
        errmsg = ("Signal '%s' was declared with @GtkTemplate.Callback " +
                  "but was not present in template") % name
        warnings.warn(errmsg, GtkTemplateWarning)
952132
protected function _include($template, $data = NULL)
    {
        // Merge local data with global data
        $data = isset($data) ? array_merge($this->_data, $data) : $this->_data;
        // Compile and run template
        $compiled = $this->_compile($template);

        return $this->_run($compiled, $data);
    }
15534
def _TemplateExists(unused_value, context, args):
    """"""
    try:
        name = args[0]
    except IndexError:
        raise EvaluationError('The "template" predicate requires an argument.')
    return context.HasTemplate(name)
820492
def _build_block_context(template, context):
    """"""

    # Ensure there's a BlockContext before rendering. This allows blocks in
    # ExtendsNodes to be found by sub-templates (allowing {{ block.super }} and
    # overriding sub-blocks to work).
    if BLOCK_CONTEXT_KEY not in context.render_context:
        context.render_context[BLOCK_CONTEXT_KEY] = BlockContext()
    block_context = context.render_context[BLOCK_CONTEXT_KEY]

    for node in template.nodelist:
        if isinstance(node, ExtendsNode):
            compiled_parent = node.get_parent(context)

            # Add the parent node's blocks to the context. (This ends up being
            # similar logic to ExtendsNode.render(), where we're adding the
            # parent's blocks to the context so a child can find them.)
            block_context.add_blocks(
                {n.name: n for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)})

            _build_block_context(compiled_parent, context)
            return compiled_parent

        # The ExtendsNode has to be the first non-text node.
        if not isinstance(node, TextNode):
            break
377577
function (tplName, data, ignoreEvaluation) {
      var files, templateData, html = '';
      if (typeof data !== 'object') {
        ignoreEvaluation = data;
        data = {};
      }
      data = _.extend({}, options.data, data);
      if (_.has(templates, tplName)) {
        debug('  include ' + templates[tplName].filepath);
        files = _.clone(this.files);
        files.push(templates[tplName].filepath);
        templateData = {
          files: files
        };
        data.include = include.bind(templateData);
        try {
          if (ignoreEvaluation) {
            html = templates[tplName].content;
          } else {
            html = _.template(templates[tplName].content, options.templateSettings)(data);
          }
        } catch (error) {
          grunt.log.error(error.message);
          backtrace(files);
        }
      } else {
        grunt.log.writeln('Template "' + tplName + '" does not exists.');
        backtrace(this.files);
      }
      return html;
    }
1099921
function loadTemplateAndPartials(templateFile, partialsDirectory, partialsExtension, options, cache, callback) {
	handleFile(null, templateFile, options, cache, function(err, partialData) {
		if (err) {
			return callback(err);
		}

		return loadAllPartials(partialData.partials, partialsDirectory, partialsExtension, options, cache, null, function(err, partials) {
			if (err) {
				return callback(err);
			}

			return callback(null, partialData.data, partials);
		});
	});
}
289625
def create_template_context(self, element, **kwargs):
        """"""
        context = dict(element=element, **kwargs)
        if self.global_context:
            context.update(**self.global_context)
        return context