Permits setting of the template in the plugin instance configuration
177035
def render(self, context, instance, placeholder):
        '''  '''
        if instance and instance.template:
            self.render_template = instance.template
        return super(PluginTemplateMixin,self).render(context,instance,placeholder)
788395
def template(client, force):
    """"""
    import pkg_resources

    # create the templated files
    for tpl_file in CI_TEMPLATES:
        tpl_path = client.path / tpl_file
        with pkg_resources.resource_stream(__name__, tpl_file) as tpl:
            content = tpl.read()

            if not force and tpl_path.exists():
                click.confirm(
                    'Do you want to override "{tpl_file}"'.format(
                        tpl_file=tpl_file
                    ),
                    abort=True,
                )

            with tpl_path.open('wb') as dest:
                dest.write(content)
791098
protected void setTemplateRequestAttributes(CmsTemplateLoaderFacade loaderFacade, HttpServletRequest req) {

        CmsTemplateContext context = loaderFacade.getTemplateContext();
        req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_CONTEXT, context);
        TemplateBean templateBean = new TemplateBean(
            context != null ? context.getKey() : loaderFacade.getTemplateName(),
            loaderFacade.getTemplate());
        templateBean.setForced((context != null) && context.isForced());
        req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN, templateBean);
    }
1005507
function loadTemplate(templatePath, identifier) {
  return plugin.myrmex.fire('beforeTemplateLoad', templatePath, identifier)
  .spread((templatePath, name) => {
    const templateDoc = _.cloneDeep(require(path.join(templatePath)));

    // Lasy loading because the plugin has to be registered in a Myrmex instance before requiring the document
    const Template = require('./template');
    const template = new Template(templateDoc, identifier);

    // This event allows to inject code to alter the template configuration
    return plugin.myrmex.fire('afterTemplateLoad', template);
  })
  .spread(template => {
    return Promise.resolve(template);
  });
}
1238097
def configure(self, options, conf):
        
        Plugin.configure(self, options, conf)
        if options.filetype:
            self.filetypes += options.filetype
289625
def create_template_context(self, element, **kwargs):
        """"""
        context = dict(element=element, **kwargs)
        if self.global_context:
            context.update(**self.global_context)
        return context
952210
function () {
			this.writeDebug('_loadTemplates');
			var source;
			var _this = this;
			var templateError = '<div class="bh-sl-error">Error: Could not load plugin templates. Check the paths and ensure they have been uploaded. Paths will be wrong if you do not run this from a web server.</div>';
			// Get the KML templates
			if (this.settings.dataType === 'kml' && this.settings.listTemplateID === null && this.settings.infowindowTemplateID === null) {

				// Try loading the external template files
				$.when(
					// KML infowindows
					$.get(this.settings.KMLinfowindowTemplatePath, function (template) {
						source = template;
						infowindowTemplate = Handlebars.compile(source);
					}),

					// KML locations list
					$.get(this.settings.KMLlistTemplatePath, function (template) {
						source = template;
						listTemplate = Handlebars.compile(source);
					})
				).then(function () {
					// Continue to the main script if templates are loaded successfully
					_this.locator();

				}, function () {
					// KML templates not loaded
					$('.' + _this.settings.formContainer).append(templateError);
					throw new Error('Could not load storeLocator plugin templates');
				});
			}
			// Handle script tag template method
			else if (this.settings.listTemplateID !== null && this.settings.infowindowTemplateID !== null) {
				// Infowindows
				infowindowTemplate = Handlebars.compile($('#' + this.settings.infowindowTemplateID).html());

				// Locations list
				listTemplate = Handlebars.compile($('#' + this.settings.listTemplateID).html());

				// Continue to the main script
				_this.locator();
			}
			// Get the JSON/XML templates
			else {
				// Try loading the external template files
				$.when(
					// Infowindows
					$.get(this.settings.infowindowTemplatePath, function (template) {
						source = template;
						infowindowTemplate = Handlebars.compile(source);
					}),

					// Locations list
					$.get(this.settings.listTemplatePath, function (template) {
						source = template;
						listTemplate = Handlebars.compile(source);
					})
				).then(function () {
					// Continue to the main script if templates are loaded successfully
					_this.locator();

				}, function () {
					// JSON/XML templates not loaded
					$('.' + _this.settings.formContainer).append(templateError);
					throw new Error('Could not load storeLocator plugin templates');
				});
			}
		}
1028417
def template(*args, **kwargs):
    
    tpl = args[0] if args else None
    for dictarg in args[1:]:
        kwargs.update(dictarg)
    adapter = kwargs.pop('template_adapter', SimpleTemplate)
    lookup = kwargs.pop('template_lookup', TEMPLATE_PATH)
    tplid = (id(lookup), tpl)
    if tplid not in TEMPLATES or DEBUG:
        settings = kwargs.pop('template_settings', {})
        if isinstance(tpl, adapter):
            TEMPLATES[tplid] = tpl
            if settings: TEMPLATES[tplid].prepare(**settings)
        elif "\n" in tpl or "{" in tpl or "%" in tpl or '$' in tpl:
            TEMPLATES[tplid] = adapter(source=tpl, lookup=lookup, **settings)
        else:
            TEMPLATES[tplid] = adapter(name=tpl, lookup=lookup, **settings)
    if not TEMPLATES[tplid]:
        abort(500, 'Template (%s) not found' % tpl)
    return TEMPLATES[tplid].render(kwargs)
564303
public void configure() {
		ServletContext servletContext = ServletActionContext.getServletContext();

		ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(servletContext);
		templateResolver.setTemplateMode(templateMode);
		templateResolver.setCharacterEncoding(characterEncoding);
		templateResolver.setPrefix(prefix);
		templateResolver.setSuffix(suffix);
		templateResolver.setCacheable(cacheable);
		templateResolver.setCacheTTLMs(cacheTtlMillis);

		templateEngine.setTemplateResolver(templateResolver);
		StrutsMessageResolver messageResolver = new StrutsMessageResolver();
		templateEngine.setMessageResolver(new StrutsMessageResolver());
		if (templateEngine instanceof SpringTemplateEngine) {
			((SpringTemplateEngine) templateEngine).setMessageSource(messageResolver.getMessageSource());
		}

		// extension diarects.
		FieldDialect fieldDialect = new FieldDialect(TemplateMode.HTML ,"sth");
		templateEngine.addDialect(fieldDialect);
	}
1025818
def _copy_config_template(name, title, template, path, key, settings):
        
        puts("\nCopying configuration file")
        context = settings.config
        context.update({
            "default_context": {
                "name": name,
                "title": title,
            },
            "name": name,
            "title": title,
            "template_repo_url": template.get('url'),
            "key": key,
        })

        # @TODO refactor this a bit
        if not key:
            spreadsheet_path = os.path.join(path, '_blueprint/', '_spreadsheet.xlsx')
            try:
                with open(spreadsheet_path, "rb") as f:
                    puts("Copying _blueprint/_spreadsheet.xlsx to tarbell_config.py's DEFAULT_CONTEXT")
                    data = process_xlsx(f.read())
                    if 'values' in data:
                        data = copy_global_values(data)
                    context["default_context"].update(data)
            except IOError:
                pass

        s3_buckets = settings.config.get("s3_buckets")
        if s3_buckets:
            puts("")
            for bucket, bucket_conf in s3_buckets.items():
                puts("Configuring {0!s} bucket at {1!s}\n".format(
                    colored.green(bucket),
                    colored.yellow("{0}/{1}".format(bucket_conf['uri'], name))
                ))

        puts("\n- Creating {0!s} project configuration file".format(
            colored.cyan("tarbell_config.py")
        ))
        template_dir = os.path.dirname(pkg_resources.resource_filename("tarbell", "templates/tarbell_config.py.template"))
        loader = jinja2.FileSystemLoader(template_dir)
        env = jinja2.Environment(loader=loader)
        env.filters["pprint_lines"] = pprint_lines  # For dumping context
        content = env.get_template('tarbell_config.py.template').render(context)
        codecs.open(os.path.join(path, "tarbell_config.py"), "w", encoding="utf-8").write(content)
        puts("\n- Done copying configuration file")
1045572
function builtTemplateFromString(str, filename, options) {

  try {
    var config = {};

    // config at the beginning of the file
    str.replace(settings.config, function(m, conf) {
      config = yaml.safeLoad(conf);
    });

    // strip comments
    if (settings.stripComment) {
      str = str.replace(settings.comment, function(m, code, assign, value) {
        return '';
      });
    }

    // strip whitespace
    if (settings.stripWhitespace) {
      settings.dot.strip = settings.stripWhitespace;
    }

    // layout sections
    var sections = {};

    if (!config.layout) {
      sections.body = str;
    }
    else {
      str.replace(settings.dot.define, function(m, code, assign, value) {
        sections[code] = value;
      });
    }

    var templateSettings = _.pick(options, ['settings']);
    options.getTemplate && (templateSettings.getTemplate = options.getTemplate);
    return new Template({
      express: templateSettings,
      config: config,
      sections: sections,
      dirname: path.dirname(filename),
      filename: filename
    });
  }
  catch (err) {
    throw new Error(
      'Failed to build template' +
      ' (' + filename + ')' +
      ' - ' + err.toString()
    );
  }
}
685887
protected void configurePlugins(ProcessEngineConfigurationImpl configuration, ProcessEngineXml processEngineXml, ClassLoader classLoader) {

    for (ProcessEnginePluginXml pluginXml : processEngineXml.getPlugins()) {
      // create plugin instance
      Class<? extends ProcessEnginePlugin> pluginClass = loadClass(pluginXml.getPluginClass(), classLoader, ProcessEnginePlugin.class);
      ProcessEnginePlugin plugin = createInstance(pluginClass);

      // apply configured properties
      Map<String, String> properties = pluginXml.getProperties();
      PropertyHelper.applyProperties(plugin, properties);

      // add to configuration
      configuration.getProcessEnginePlugins().add(plugin);
    }

  }
861882
def render_template_file(template, context=None):
    
    assert isinstance(context, Mapping)
    template = get_template(template)
    return template.render(context)
99300
private function setupExtensionAdapter()
    {
        $extension = $this->createTemplatingExtensionAdapter();

        $extension->addHelperCollection('template', $this->getDefaultTemplateHelperCollection());
        $extension->addHelperCollection('view', $this->getDefaultViewHelperCollection());

        if (isset($this->options[self::OPTION_HELPERS])) {
            $viewHelperCollection = $this->createViewHelperCollection();
            $viewHelperCollection->addHelpers($this->options[self::OPTION_HELPERS]);

            $extension->addHelperCollection('component', $viewHelperCollection);
        }

        $this->templateEngine->setExtensionAdapter($extension);
    }
124496
function fixTemplateContext(template, fix) {
    var _template_r = template.r;
    template.r = function(contextStack) {
        var context = contextStack[contextStack.length-1];
        contextStack[contextStack.length-1] = fix(context);
        return _template_r.apply(this,arguments);
    };
}
171772
def _get_template_dirs(type="plugin"):
    
    template_dirs = [
        os.path.expanduser(os.path.join(USER_CONFIG_DIR, "templates", type)),
        os.path.join("rapport", "templates", type)  # Local dev tree
    ]
    return template_dirs
68924
def setMenuTemplate( self, template ):
        
        try:
            xtree = ElementTree.fromstring(nativestring(template))
        except ExpatError, e:
            logger.exception(e)
            return
        
        self.uiMenuTREE.setUpdatesEnabled(False)
        self.uiMenuTREE.blockSignals(True)
        
        self.uiMenuTREE.clear()
        for xaction in xtree:
            self.uiMenuTREE.addTopLevelItem(self.loadXml(xaction))
        
        self.uiMenuTREE.setUpdatesEnabled(True)
        self.uiMenuTREE.blockSignals(False)