diff --git a/mustache.min.js b/mustache.min.js index 9e77fcc..b711f6e 100644 --- a/mustache.min.js +++ b/mustache.min.js @@ -1 +1 @@ -var Mustache=function(a){function c(){}function e(a){if(!d){var b=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];d=new RegExp("(\\"+b.join("|\\")+")","g")}return a.replace(d,"\\$1")}function f(a){return a.match(/\r?\n/)}function g(a){return a&&typeof a=="function"}function h(a){return a&&typeof a=="object"}function i(a){return Object.prototype.toString.call(a)==="[object Array]"}function k(b,d){var e,g,h;for(e=b.tokens.length;b.cursor]?\\s*[^!{=]\\S*?\\s*"+i+")","("+h+"{\\s*\\S*?\\s*}"+i+")","("+h+"=\\S*?\\s*\\S*?="+i+")"];g=new RegExp(j.join("|"))}var k=[],m={metrics:{partial:null,line:1,character:1},template:a||"",partials:c||{},openTag:d,closeTag:f,parser:w,pragmas:{},code:k,send_code_func:function(a){k.push(a)}};return o(m),m.tokens=b.call(m.template,g),m.cursor=0,m}function o(b){function c(a,b){return b.indexOf("{{"+a)!==-1}if(!c("%",b.template))return b.template;b.template=b.template.replace(/{{%([\w-]+)(\s*)(.*?(?=}}))}}/g,function(c,d,e,f){var h=a,i,k,l,m;if(f.length>0){i=f.split(","),h={};for(l=0,m=i.length;l1){d=p(b,c[0]);if(d!==a)return d}return a}function r(b,c){var d=b.split("."),e=1,f=d.length,g=q(d[0],c);while(g&&e/g,">")}var f,g,h;d==="{"?f=g=h=!0:d==="&"&&(f=g=!0);var i=y(b,c,g,h),j=(b.pragmas["IMPLICIT-ITERATOR"]||{iterator:"."}).iterator;b.send_code_func(function(b,c){return function(d,f){var g;b===j?(g={},g[j]=d[d.length-1],g=p(b,g)):g=r(b,d),g!==a&&(c||(g=e(""+g)),f(""+g))}}(i,f))}function u(a,b){var d=y(a,b,!0),e,f;if(!a.partials[d])throw new j('Unknown partial "'+d+'".',a.metrics);if(!g(a.partials[d])){e=a.partials[d],a.partials[d]=c;var h=m(e,a.partials);h.metrics.partial=d,f=k(h),a.partials[d]=function(a,b){var c=q(d,a);c&&a.push(c),f(a,b),c&&a.pop()}}a.send_code_func(function(b,c){a.partials[d](b,c)})}function v(a){var b=a.section,c=b.template_buffer.join(""),d,e=m(c,a.partials,a.openTag,a.closeTag);e.metrics=b.metrics,e.pragmas=a.pragmas,d=k(e),b.inverted?a.send_code_func(function(a,b){return function(c,d){var e=r(b,c);(!e||i(e)&&e.length===0)&&a(c,d)}}(d,b.variable)):a.send_code_func(function(a,b,c,d){return function(e,f){var j=r(b,e);if(i(j))for(var l=0,n=j.length;l0){var d=a.section.child_sections[a.section.child_sections.length-1];if(d===c)a.section.child_sections.pop(),a.section.template_buffer.push(b);else throw new j('Unexpected section end tag "'+c+'", expected "'+d+'".',a.metrics)}else if(a.section.variable===c)v(a),delete a.section,a.parser=w;else throw new j('Unexpected section end tag "'+c+'", expected "'+a.section.variable+'".',a.metrics)}var b=function(){function c(c){var d=this,e=a;if(Object.prototype.toString.call(c)!=="[object RegExp]")return String.prototype.split.call(d,c,e);var f=[],g=0,h=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.sticky?"y":""),c=RegExp(c.source,h+"g"),i,j,k,l;d+="",b||(i=RegExp("^"+c.source+"$(?!\\s)",h));if(e===a||+e<0)e=Infinity;else{e=Math.floor(+e);if(!e)return[]}while(j=c.exec(d)){k=j.index+j[0].length;if(k>g){f.push(d.slice(g,j.index)),!b&&j.length>1&&j[0].replace(i,function(){for(var b=1;b1&&j.index=e)break}c.lastIndex===j.index&&c.lastIndex++}return g===d.length?(l||!c.test(""))&&f.push(""):f.push(d.slice(g)),f.length>e?f.slice(0,e):f}var b=/()??/.exec("")[1]===a;return"lol".split(/(o)/).length!==3?c:String.prototype.split}(),d,j=function(a,b){var c="";this.prototype=Error.prototype,this.name="MustacheError",b&&(c="("+b.line+","+b.character+"): ",b.partial&&(c="["+b.partial+"]"+c)),this.message=c+a,b&&(this.line=b.line,this.character=b.character,this.partial=b.partial)},l=/(\r?\n)|({{![\s\S]*?!}})|({{[#\^\/&>]?\s*[^!{=]\S*?\s*}})|({{{\s*\S*?\s*}}})|({{=\S*?\s*\S*?=}})/,n={"IMPLICIT-ITERATOR":function(b,c){b.pragmas["IMPLICIT-ITERATOR"]={iterator:(c||{iterator:a}).iterator||"."}}},w={"!":c,"#":A,"^":A,"/":function(a,b){throw new j('Unbalanced End Section tag "'+b+'".',a.metrics)},"&":t,"{":t,">":u,"=":z,def:t,text:s},x={"!":c,"#":A,"^":A,"/":C,"&":B,"{":B,">":B,"=":z,def:B,text:B};return{name:"mustache.js",version:"0.5.1-vcs",to_html:function(a,b,c,d){var e=Mustache.compile(a,c),f=e(b,d);if(!d)return f},compile:function(a,b){var c={};if(b)for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);var e=k(m(a,c));return function(a,b){var c=[],d=b||function(a){c.push(a)};e([a||{}],d);if(!b)return c.join("")}},Error:j}}() \ No newline at end of file +var Mustache=function(a){function c(){}function e(a){if(!d){var b=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];d=new RegExp("(\\"+b.join("|\\")+")","g")}return a.replace(d,"\\$1")}function f(a){return a.match(/\r?\n/)}function g(a){return a&&typeof a=="function"}function h(a){return a&&typeof a=="object"}function i(a){return Object.prototype.toString.call(a)==="[object Array]"}function k(b,d){var e,g,h;for(e=b.tokens.length;b.cursor]?\\s*[^!{=]\\S*?\\s*"+i+")","("+h+"{\\s*\\S*?\\s*}"+i+")","("+h+"=\\S*?\\s*\\S*?="+i+")"];g=new RegExp(j.join("|"))}var k=[],m={metrics:{partial:null,line:1,character:1},template:a||"",partials:c||{},openTag:d,closeTag:f,parser:w,pragmas:{},code:k,send_code_func:function(a){k.push(a)}};return o(m),m.tokens=b.call(m.template,g),m.cursor=0,m}function o(b){function c(a,b){return b.indexOf("{{"+a)!==-1}if(!c("%",b.template))return b.template;b.template=b.template.replace(/{{%([\w-]+)(\s*)(.*?(?=}}))}}/g,function(c,d,e,f){var h=a,i,k,l,m;if(f.length>0){i=f.split(","),h={};for(l=0,m=i.length;l1){d=p(b,c[0]);if(d!==a)return d}return a}function r(b,c){var d=b.split("."),e=1,f=d.length,g=q(d[0],c);while(g&&e/g,">")}var f,g,h;d==="{"?f=g=h=!0:d==="&"&&(f=g=!0);var i=y(b,c,g,h),j=(b.pragmas["IMPLICIT-ITERATOR"]||{iterator:"."}).iterator;b.send_code_func(function(b,c){return function(d,f){var g;b===j?(g={},g[j]=d[d.length-1],g=p(b,g)):g=r(b,d),g!==a&&(c||(g=e(""+g)),f(""+g))}}(i,f))}function u(a,b){var d=y(a,b,!0),e,f;if(!a.partials[d])throw new j('Unknown partial "'+d+'".',a.metrics);if(!g(a.partials[d])){e=a.partials[d],a.partials[d]=c;var h=m(e,a.partials);h.metrics.partial=d,f=k(h),a.partials[d]=function(a,b){var c=q(d,a);c&&a.push(c),f(a,b),c&&a.pop()}}a.send_code_func(function(b,c){a.partials[d](b,c)})}function v(a){var b=a.section,c=b.template_buffer.join(""),d,e=m(c,a.partials,a.openTag,a.closeTag);e.metrics=b.metrics,e.pragmas=a.pragmas,d=k(e),b.inverted?a.send_code_func(function(a,b){return function(c,d){var e=r(b,c);(!e||i(e)&&e.length===0)&&a(c,d)}}(d,b.variable)):a.send_code_func(function(a,b,c,d){return function(e,f){var j=r(b,e);if(i(j))for(var l=0,n=j.length;l0){var d=a.section.child_sections[a.section.child_sections.length-1];if(d===c)a.section.child_sections.pop(),a.section.template_buffer.push(b);else throw new j('Unexpected section end tag "'+c+'", expected "'+d+'".',a.metrics)}else if(a.section.variable===c)v(a),delete a.section,a.parser=w;else throw new j('Unexpected section end tag "'+c+'", expected "'+a.section.variable+'".',a.metrics)}var b=function(){function c(c){var d=this,e=a;if(Object.prototype.toString.call(c)!=="[object RegExp]")return String.prototype.split.call(d,c,e);var f=[],g=0,h=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.sticky?"y":""),c=RegExp(c.source,h+"g"),i,j,k,l;d=d+"",b||(i=RegExp("^"+c.source+"$(?!\\s)",h));if(e===a||+e<0)e=Infinity;else{e=Math.floor(+e);if(!e)return[]}while(j=c.exec(d)){k=j.index+j[0].length;if(k>g){f.push(d.slice(g,j.index)),!b&&j.length>1&&j[0].replace(i,function(){for(var b=1;b1&&j.index=e)break}c.lastIndex===j.index&&c.lastIndex++}return g===d.length?(l||!c.test(""))&&f.push(""):f.push(d.slice(g)),f.length>e?f.slice(0,e):f}var b=/()??/.exec("")[1]===a;return"lol".split(/(o)/).length!==3?c:String.prototype.split}(),d,j=function(a,b){var c="";this.prototype=Error.prototype,this.name="MustacheError",b&&(c="("+b.line+","+b.character+"): ",b.partial&&(c="["+b.partial+"]"+c)),this.message=c+a,b&&(this.line=b.line,this.character=b.character,this.partial=b.partial)},l=/(\r?\n)|({{![\s\S]*?!}})|({{[#\^\/&>]?\s*[^!{=]\S*?\s*}})|({{{\s*\S*?\s*}}})|({{=\S*?\s*\S*?=}})/,n={"IMPLICIT-ITERATOR":function(b,c){b.pragmas["IMPLICIT-ITERATOR"]={iterator:(c||{iterator:a}).iterator||"."}}},w={"!":c,"#":A,"^":A,"/":function(a,b){throw new j('Unbalanced End Section tag "'+b+'".',a.metrics)},"&":t,"{":t,">":u,"=":z,def:t,text:s},x={"!":c,"#":A,"^":A,"/":C,"&":B,"{":B,">":B,"=":z,def:B,text:B};return{name:"mustache.js",version:"0.5.1-vcs",compile:function(a,b){var c={};if(b)for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);var e=k(m(a,c));return function(a,b){var c=[],d=b||function(a){c.push(a)};e([a||{}],d);if(!b)return c.join("")}},to_html:function(a,b,c,d){var e=Mustache.compile(a,c),f=e(b,d);if(!d)return f},format:function(a){var b=Mustache.compile(a),c=Array.prototype.slice.call(arguments),d={};c.shift();for(var e=0,f=c.length;e