get ast of template
@param {String} [name] xtemplate name
@param {String} tplContent
@return {Object}
492686
function (tplContent, name) {
    if (tplContent) {
      var ret;
      try {
        ret = parser.parse(tplContent, name);
      } catch (err) {
        var e;
        if (err instanceof Error) {
          e = err;
        } else {
          e = new Error(err);
        }
        var errorStr = 'XTemplate error ';
        e.stack = errorStr + e.stack;
        e.message = errorStr + e.message;
        throw e;
      }
      return ret;
    } else {
      return {
        statements: []
      };
    }
  }
1188190
function genTemplateData() {
			var templateData = {
				data : {
					process : process,
					commit : commit,
					env : commitTask.commitOpts,
					options : options
				}
			};
			var rtn = {};
			var arr = Array.prototype.slice.call(arguments, 0);
			arr.forEach(function genIntMsgs(s) {
				rtn[s] = options[s] ? rbot.processTemplate(options[s], templateData) : '';
				if (rtn[s]) {
					rbot.log.verbose(s + ' = ' + rtn[s]);
				}
			});
			return rtn;
		}
63931
function compileTemplate(name) {
        // Directive compile function
        return function (tElement, tAttrs, transclude) {
            var rootElement = document.createElement("div");
            Object.keys(tAttrs).forEach(function (key) {
                if (key[0] !== '$') {
                    rootElement.setAttribute(key, tAttrs[key]);
                }
            });
            var immediateToken;
            // Directive link function
            return function ($scope, elements, attrs, parents) {
                var parent = parents.reduce(function (found, item) { return found || item; });
                parent[name] = function (itemPromise) {
                    // Actual item renderer
                    return WinJS.Promise.as(itemPromise).then(function (item) {
                        var itemScope = $scope.$new();
                        itemScope.item = item;
                        var result = rootElement.cloneNode(false);
                        transclude(itemScope, function (clonedElement) {
                            for (var i = 0, len = clonedElement.length; i < len; i++) {
                                result.appendChild(clonedElement[i]);
                            }
                        });
                        WinJS.Utilities.markDisposable(result, function () {
                            itemScope.$destroy();
                        });
                        immediateToken = immediateToken || setImmediate(function () {
                            immediateToken = null;
                            itemScope.$apply();
                        });
                        return result;
                    })
                };
            };
        };
    }
1087898
function applyTemplateContent(inst, node, nodeInfo) {
  if (nodeInfo.templateInfo) {
    node._templateInfo = nodeInfo.templateInfo;
  }
}
1340512
async function getTemplate(templatesList, templateName = null) {
  if (!templateName) {
    const templatesArray = Object.entries(templatesList).map(([name, value]) => ({ name, value }))
    const { template } = await inquirer.prompt(templateQuestions.template(templatesArray))
    return template
  }
  if (templateName in templatesList) {
    return templatesList[templateName]
  }
  throw Error(`The template '${templateName}' does't exists`)
}
446795
function (templateCtxt) {
            var moduleCtrl = templateCtxt.moduleCtrlPrivate;
            // find associated module
            var modules = this._data.modules, i, l;
            for (i = 0, l = modules.length; i < l; i++) {
                if (modules[i].moduleCtrl == moduleCtrl) {
                    this._data.selectedModule = modules[i];
                    break;
                } else {
                    this._data.selectedModule = null;
                }
            }
            // find associated template description
            this._data.selectedTemplate = this._findTemplateDes(this._data.templates, templateCtxt);

        }
201765
def template(self, name):
        
        self.plain, self.html = self._find_tpls(name)
        if not self.plain:
            self.plain = self._find_tpl(name)
        try:
            self.send = self._sendtpl
            yield
        finally:
            self.plain, self.html = None, None
            self.send = self._send
1286373
function templateVisitAll(visitor, asts, context) {
    if (context === void 0) { context = null; }
    var /** @type {?} */ result = [];
    var /** @type {?} */ visit = visitor.visit ?
        function (ast) { return visitor.visit(ast, context) || ast.visit(visitor, context); } :
        function (ast) { return ast.visit(visitor, context); };
    asts.forEach(function (ast) {
        var /** @type {?} */ astResult = visit(ast);
        if (astResult) {
            result.push(astResult);
        }
    });
    return result;
}
528698
async function getTemplateFile(templateDir, stackName) {
  const f = await Promise.any(
    _.map(['.yml', '.yaml', '.json', ''], async(ext) =>
      await utils.fileExists(`${path.join(templateDir, stackName)}${ext}`)));
  if (f) {
    return f;
  }
  throw new Error(`Stack template "${stackName}" not found!`);
}
1218088
function (tpl, option) {
            var code = compiler.compile(tpl);
            option = option || {};
            // eval is not ok for eval("(function(){})") ie
            return (Function.apply(null, []
                .concat(code.params)
                .concat(code.source.join('\n') + '//@ sourceURL=' +
                    (option.name ? option.name : ('xtemplate' + (xtemplateId++))) + '.js')));
        }
1052770
async function getTemplate({template, preset}) {
	if (typeof template === 'string') {
		return template;
	}

	if (typeof preset === 'string') {
		try {
			return (
				await read(
					resolve(
						__dirname,
						'templates',
						[preset.toLowerCase(), 'html'].join('.'),
					)
				)
			).toString();
		} catch (error) {
			throw new Error(`Preset ${preset} not found`);
		}
	}

	return DEFAULT_TEMPLATE;
}
1121125
function buildContentObjectName( $contentObjectName, $dataMap, $tmpTags = false )
    {
        preg_match_all( "|<[^>]+>|U",
                        $contentObjectName,
                        $tagMatchArray );

        foreach ( $tagMatchArray[0] as $tag )
        {
            $tagName = str_replace( "<", "", $tag );
            $tagName = str_replace( ">", "", $tagName );

            $tagParts = explode( '|', $tagName );

            $namePart = "";
            foreach ( $tagParts as $name )
            {
                // get the value of the attribute to use in name
                if ( isset( $dataMap[$name] ) )
                {
                    $namePart = $dataMap[$name]->title();
                    if ( $namePart != "" )
                        break;
                }
                elseif ( $tmpTags && isset( $tmpTags[$name] ) && $tmpTags[$name] != '' )
                {
                    $namePart = $tmpTags[$name];
                    break;
                }

            }

            // replace tag with object name part
            $contentObjectName = str_replace( $tag, $namePart, $contentObjectName );
        }
        return $contentObjectName;
    }
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;
    }
1031243
function getCtrlTemplateModel(uipart, options) {

    var remodelOnScopeChange = uipart.remodelOnScopeChange || (uipart.remodel && uipart.remodel.onScopeChange);
    var remodelOnEvent = uipart.remodelOnEvent || (uipart.remodel && uipart.remodel.onEvent);
    var rerenderOnScopeChange = uipart.rerenderOnScopeChange || (uipart.rerender && uipart.rerender.onScopeChange);
    var rerenderOnEvent = uipart.rerenderOnEvent || (uipart.rerender && uipart.rerender.onEvent);
    var remodelWatchers = remodelOnScopeChange ? JSON.stringify(remodelOnScopeChange) : 'null';
    var remodelEvents = remodelOnEvent ? JSON.stringify(remodelOnEvent) : 'null';
    var rerenderWatchers = rerenderOnScopeChange ? JSON.stringify(rerenderOnScopeChange) : 'null';
    var rerenderEvents = rerenderOnEvent ? JSON.stringify(rerenderOnEvent) : 'null';

    var defaults = uipart.defaults ? JSON.stringify(uipart.defaults) : 'null';
    var presets = uipart.presets ? JSON.stringify(uipart.presets) : null;
    var attachToScope = uipart.attachToScope ? JSON.stringify(uipart.attachToScope) : null;
    var paramInfo = this.getFilteredParamInfo(uipart.controller, options);
    var transOpts = _.extend({ raw: true, isClient: true }, options);
    var useRemodelOnWatch = uipart.model && remodelOnScopeChange && remodelOnScopeChange.length;
    var useRemodelOnEvent = uipart.model && remodelOnEvent && remodelOnEvent.length;
    var useRerenderOnWatch = uipart.model && rerenderOnScopeChange && rerenderOnScopeChange.length;
    var useRerenderOnEvent = uipart.model && rerenderOnEvent && rerenderOnEvent.length;
    var remodelFnExists = uipart.model && _.isFunction(uipart.model);
    var remodelObjExists = !remodelFnExists && uipart.model && _.isObject(uipart.model);
    var clientLoadExists = uipart.onClientLoad && _.isFunction(uipart.onClientLoad);

    // hack to get log working in uipart
    if (paramInfo.list && paramInfo.list.length) {
        paramInfo.list = paramInfo.list.filter(function (val) {
            return val !== 'log';
        });

        paramInfo.converted = paramInfo.converted.filter(function (val) {
            return val !== 'log';
        });
    }

    return {
        isPage:             options.isPage,
        params:             paramInfo.list,
        convertedParams:    paramInfo.converted,
        ngrefs:             paramInfo.ngrefs,
        defaults:           defaults,
        presets:            presets,
        attachToScope:      attachToScope,
        rerenderExists:     useRerenderOnEvent || useRerenderOnWatch,
        remodelFnExists:    remodelFnExists && (useRemodelOnEvent || useRemodelOnWatch || !options.isPage),
        remodelFn:          remodelFnExists && this.transformers.basic.transform(uipart.model, transOpts),
        remodelObjExists:   remodelObjExists,
        remodelObj:         remodelObjExists && this.renderObjFns(uipart.model, transOpts),
        clientLoadExists:   clientLoadExists,
        clientLoadFn:       clientLoadExists && this.transformers.basic.transform(uipart.onClientLoad, transOpts),
        remodelWatchers:    remodelWatchers,
        remodelEvents:      remodelEvents,
        rerenderWatchers:   rerenderWatchers,
        rerenderEvents:     rerenderEvents,
        useRemodelOnWatch:  useRemodelOnWatch,
        useRemodelOnEvent:  useRemodelOnEvent,
        useRerenderOnWatch: useRerenderOnWatch,
        useRerenderOnEvent: useRerenderOnEvent,
        validations:        this.renderObjFns(uipart.validations, transOpts),
        eventBusListeners:  this.renderObjFns(uipart.eventBusListeners, transOpts),
        uiEventHandlers:    this.renderObjFns(uipart.uiEventHandlers, transOpts),
        body:               this.getModuleBody(uipart.controller)
    };
}
213443
public Template getTemplate(String name) throws IOException, ParseException {
        return getTemplate(name, null, null, null);
    }
220883
function getTemplate (templates, fileName) {
  var extMatch = fileName.match(/\.([^\.]*)$/);
  if (extMatch && extMatch.length > 1)
    return templates[extMatch[1]];
  return null;
}
1094244
public static final ITemplate getTemplate(String tmpl, Object ... args) {
        return engine().getTemplate(tmpl, args);
    }