Create a shadow-root in this host and stamp `template` as it's
content.

An element may override this method for custom behavior.

@method shadowFromTemplate
11613
function(template) {
      if (template) {
        // make a shadow root
        var root = this.createShadowRoot();
        // stamp template
        // which includes parsing and applying MDV bindings before being
        // inserted (to avoid {{}} in attribute values)
        // e.g. to prevent <img src="images/{{icon}}"> from generating a 404.
        var dom = this.instanceTemplate(template);
        // append to shadow dom
        root.appendChild(dom);
        // perform post-construction initialization tasks on shadow root
        this.shadowRootReady(root, template);
        // return the created shadow root
        return root;
      }
    }
74276
function() {

		var result = null,
			index = this._active_argument_index;

		if (index != -1) {

			if (!this._content[index]) {

				this._content[index] = (index == 0)
					? new Lava.system.Template(this._config.template || [], this._widget, this, {if_index: index})
					: new Lava.system.Template(this._config.elseif_templates[index - 1] || [], this._widget, this, {if_index: index});

			}

			result = this._content[index];

		} else if ('else_template' in this._config) {

			if (this._else_content == null) {

				this._else_content = new Lava.system.Template(this._config.else_template || [], this._widget, this);

			}

			result = this._else_content;

		}

		return result;

	}
214519
function (header, content, footer) {
        Backbone.View.apply(this, []);
        this.header  = header;
        this.footer  = footer;
        this.content = content;
        this.needRedraw = true;
        this.needSetup  = true;

        // setup relations between header, footer and content.
        this.subviews = [];
        if (header) {
            // link header to its root view, content and footer.
            header.content = content;
            header.footer  = footer;
            header.root    = this;
            this.subviews.push(header);
        }
        if (footer) {
            // link footer to its root view, content and header.
            footer.content = content;
            footer.header  = header;
            footer.root    = this;
            this.subviews.push(footer);
        }
        if (content) {
            // link content view to its root view, header and footer.
            content.header  = header;
            content.footer  = footer;
            content.root    = this;
            this.subviews.push(content);
        }
    }
1234197
function setElementTemplate($html, $element = null)
    {
        if (is_null($element)) {
            $this->_elementTemplate = $html;
        } else {
            $this->_templates[$element] = $html;
        }
    }
749890
public function initiate($template = null, $data = null, $templateRootFolder = ERDIKO_APP)
    {
        $template = ($template === null) ? $this->getDefaultTemplate() : $template;
        $this->setTemplate($template);
        $this->setData($data);
        $this->setTemplateRootFolder($templateRootFolder);
    }
322416
function buildMasterTemplate(opts, callback) {
  var viewOpt = {
    user: opts.user,
    logRoot: opts.logRoot
  };

  renderTemplate(templateFilePath('master.conf', opts.templateOpt), viewOpt, function(err, renderedOutput) {
    if (err) {
      return callback(err.message);
    } else {
      return fs.writeFile(opts.writePath, renderedOutput, function(err) {
	if (err) {
	  return callback(err.message);
	} else {
	  return callback(null);
	}
      });
    }
  });
}
388991
def _get_template(self, root=None, **metadata_defaults):
        

        if root is None:
            if self._data_map is None:
                self._init_data_map()

            root = self._xml_root = self._data_map['_root']

        template_tree = self._xml_tree = create_element_tree(root)

        for prop, val in iteritems(metadata_defaults):
            path = self._data_map.get(prop)
            if path and val:
                setattr(self, prop, val)
                update_property(template_tree, None, path, prop, val)

        return template_tree
611837
function(template) {
            var self = this;
            this.template = template || this.template;
            Resources.load(this.options.loader, this.template).then(function(content) {
                self.setContent(content);
                self.trigger("loaded");
            }, function() {
                self.setContent(null);
                self.trigger("error");
            });
            return this;
        }
1321194
function View_preloadTemplates(dir) {
            var list, name;
            if (this.isDir(dir)) {
                list = this.readDir(dir);
                while (true) {
                    name = list.shift();
                    if (!name) {
                        break;
                    }
                    this.preloadTemplates(di.normalizePath(dir + '/' + name));
                }

            } else if (this.isFile(dir) && this.suffix.test(dir)) {
                process.nextTick(function compileTemplateAsync() {
                    this.setPreloaded(dir, this.swig.compileFile(dir));
                }.bind(this));
            }
        }
417217
function() {

    var template = require('./templates/user-avatar.html');
    var avatarTarget = $(template.render({
      image: getConfig().ui.avatar
    }));

    rootTarget.addClass('has-avatar');
    rootTarget.append(avatarTarget);

  }
1003408
public function initializeTemplate($template_spot = null, $template_branch = null)
    {
        if ($template_spot === null) {
            $template_spot = $this->defaultSpot();
        }
        $this->spot = $template_spot;
        if (@$this->owner->template
            && !$this->owner->template->is_set($this->spot)
        ) {
            throw $this->owner->template->exception(
                'Spot is not found in owner\'s template'
            )->addMoreInfo('spot', $this->spot);
        }
        if (!isset($template_branch)) {
            $template_branch = $this->defaultTemplate();
        }
        if (isset($template_branch)) {
            // template branch would tell us what kind of template we have to
            // use. Let's look at several cases:

            if (is_object($template_branch)) {
                // it might be already template instance (object)
                $this->template = $template_branch;
            } elseif (is_array($template_branch)) {
                // it might be array with [0]=template, [1]=tag
                if (is_object($template_branch[0])) {
                    // if [0] is object, we'll use that
                    $this->template = $template_branch[0];
                } else {
                    $this->template = $this->app->add('Template');
                    /** @type Template $this->template */
                    $this->template->loadTemplate($template_branch[0]);
                }
                // Now that we loaded it, let's see which tag we need to cut out
                $this->template = $this->template->cloneRegion(
                    isset($template_branch[1]) ? $template_branch[1] : '_top'
                );
            } else {
                // brach could be just a string - a region to clone off parent
                if (isset($this->owner->template)) {
                    $this->template
                        = $this->owner->template->cloneRegion($template_branch);
                } else {
                    $this->template = $this->add('Template');
                }
            }

            /** @type Template $this->template */
            $this->template->owner = $this;
        }

        // Now that the template is loaded, let's take care of parent's template
        if ($this->owner
            && (isset($this->owner->template))
            && (!empty($this->owner->template))
        ) {
            $this->owner->template->del($this->spot);
        }

        // Cool, now let's set _name of this template
        if ($this->template) {
            $this->template->trySet('_name', $this->getJSID());
        }
    }
1098557
function prepareTemplate(element) {

  let template = element[symbols.template];

  if (!template) {
    /* eslint-disable no-console */
    console.warn(`ShadowTemplateMixin expects ${element.constructor.name} to define a property called [symbols.template].\nSee https://elix.org/documentation/ShadowTemplateMixin.`);
    return;
  }

  if (!(template instanceof HTMLTemplateElement)) {
    throw `Warning: the [symbols.template] property for ${element.constructor.name} must return an HTMLTemplateElement.`;
  }

  // @ts-ignore
  if (window.ShadyCSS && !window.ShadyCSS.nativeShadow) {
    // Let the CSS polyfill do its own initialization.
    const tag = element.localName;
    // @ts-ignore
    window.ShadyCSS.prepareTemplate(template, tag);
  }

  return template;
}
76449
function applyTemplate(el, tpl) {
        var lightFrag = void 0,
            handleContentNode = hasContent(tpl);

        if (handleContentNode) {
            var newCebContentId = 'ceb-content-' + counter++;
            lightFrag = cleanOldContentNode(el);

            tpl = replaceContent(tpl, newCebContentId);

            el.setAttribute(OLD_CONTENT_ID_ATTR_NAME, newCebContentId);
        }

        el.innerHTML = tpl;

        if (handleContentNode && lightFrag) {
            el.lightDOM.appendChild(lightFrag);
        }
    }
384729
function customShadowRoot(selector, starting) {
    var selectors = selector.split('::sr');
    if (selectors.length === 0) {
        return [];
    }

    var shadowDomInUse = (document.head.createShadowRoot || document.head.attachShadow);
    var getShadowRoot = function (el) {
        return ((el && shadowDomInUse) ? el.shadowRoot : el);
    };
    var findAllMatches = function (selector /*string*/, targets /*array*/, firstTry /*boolean*/) {
        var scope, i, matches = [];
        for (i = 0; i < targets.length; ++i) {
            scope = (firstTry) ? targets[i] : getShadowRoot(targets[i]);
            if (scope) {
                if (selector === '') {
                    matches.push(scope);
                } else {
                    Array.prototype.push.apply(matches, scope.querySelectorAll(selector));
                }
            }
        }
        return matches;
    };

    var matches = findAllMatches(selectors.shift().trim(), [starting || document], true);
    while (selectors.length > 0 && matches.length > 0) {
        matches = findAllMatches(selectors.shift().trim(), matches, false);
    }
    return matches;
}
36307
function getTemplate(template) {
  var ret;

  store.roots.some(function(r) {
    var filepath = path.join(r, template);
    if (file.exists(filepath)) {
      ret = filepath;
      return true;
    }
  });

  return ret;
}
901050
public static String template(final String template, final Object root)
	{
		StrSubstitutor substitutor = new StrSubstitutor(newOgnlLookup(root));

		return substitutor.replace(template);
	}
875515
private ProcTemplate createTemplate(Template template) {
        if (!template.isEmpty()) {
            return new ProcTemplate(templateElementFactory.createTemplateList(template.getElements()));
        } else {
            return ProcTemplate.EMPTY;
        }
    }