--- /dev/null
+<html>\r
+<head>\r
+ <title>The source code</title>\r
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body onload="prettyPrint();">\r
+ <pre class="prettyprint lang-js">/**\r
+ * @class Ext.Template\r
+ */\r
+Ext.apply(Ext.Template.prototype, {\r
+ <div id="method-Ext.Template-applyTemplate"></div>/**\r
+ * Returns an HTML fragment of this template with the specified values applied.\r
+ * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})\r
+ * @return {String} The HTML fragment\r
+ * @hide repeat doc\r
+ */\r
+ applyTemplate : function(values){\r
+ var me = this,\r
+ useF = me.disableFormats !== true,\r
+ fm = Ext.util.Format, \r
+ tpl = me; \r
+ \r
+ if(me.compiled){\r
+ return me.compiled(values);\r
+ }\r
+ function fn(m, name, format, args){\r
+ if (format && useF) {\r
+ if (format.substr(0, 5) == "this.") {\r
+ return tpl.call(format.substr(5), values[name], values);\r
+ } else {\r
+ if (args) {\r
+ // quoted values are required for strings in compiled templates,\r
+ // but for non compiled we need to strip them\r
+ // quoted reversed for jsmin\r
+ var re = /^\s*['"](.*)["']\s*$/;\r
+ args = args.split(',');\r
+ for(var i = 0, len = args.length; i < len; i++){\r
+ args[i] = args[i].replace(re, "$1");\r
+ }\r
+ args = [values[name]].concat(args);\r
+ } else {\r
+ args = [values[name]];\r
+ }\r
+ return fm[format].apply(fm, args);\r
+ }\r
+ } else {\r
+ return values[name] !== undefined ? values[name] : "";\r
+ }\r
+ }\r
+ return me.html.replace(me.re, fn);\r
+ },\r
+ \r
+ <div id="prop-Ext.Template-disableFormats"></div>/**\r
+ * <tt>true</tt> to disable format functions (defaults to <tt>false</tt>)\r
+ * @type Boolean\r
+ * @property\r
+ */\r
+ disableFormats : false, \r
+ \r
+ <div id="prop-Ext.Template-re"></div>/**\r
+ * The regular expression used to match template variables\r
+ * @type RegExp\r
+ * @property\r
+ * @hide repeat doc\r
+ */\r
+ re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,\r
+ \r
+ <div id="method-Ext.Template-compile"></div>/**\r
+ * Compiles the template into an internal function, eliminating the RegEx overhead.\r
+ * @return {Ext.Template} this\r
+ * @hide repeat doc\r
+ */\r
+ compile : function(){\r
+ var me = this,\r
+ fm = Ext.util.Format,\r
+ useF = me.disableFormats !== true,\r
+ sep = Ext.isGecko ? "+" : ",",\r
+ body;\r
+ \r
+ function fn(m, name, format, args){\r
+ if(format && useF){\r
+ args = args ? ',' + args : "";\r
+ if(format.substr(0, 5) != "this."){\r
+ format = "fm." + format + '(';\r
+ }else{\r
+ format = 'this.call("'+ format.substr(5) + '", ';\r
+ args = ", values";\r
+ }\r
+ }else{\r
+ args= ''; format = "(values['" + name + "'] == undefined ? '' : ";\r
+ }\r
+ return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";\r
+ }\r
+ \r
+ // branched to use + in gecko and [].join() in others\r
+ if(Ext.isGecko){\r
+ body = "this.compiled = function(values){ return '" +\r
+ me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +\r
+ "';};";\r
+ }else{\r
+ body = ["this.compiled = function(values){ return ['"];\r
+ body.push(me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));\r
+ body.push("'].join('');};");\r
+ body = body.join('');\r
+ }\r
+ eval(body);\r
+ return me;\r
+ },\r
+ \r
+ // private function used to call members\r
+ call : function(fnName, value, allValues){\r
+ return this[fnName](value, allValues);\r
+ }\r
+});\r
+Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; </pre> \r
+</body>\r
+</html>
\ No newline at end of file