Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

forgot to build after version bump

  • Loading branch information...
commit 160e4f823045ad92641ddf3a6d1c93a196b0d5cf 1 parent 1db1298
@kirbysayshi authored
View
2  build/vash-runtime-all.js
@@ -1,5 +1,5 @@
/**
- * Vash - JavaScript Template Parser, v0.6.1-2481
+ * Vash - JavaScript Template Parser, v0.6.2-2482
*
* https://github.com/kirbysayshi/vash
*
View
2  build/vash-runtime-all.min.js
@@ -1,5 +1,5 @@
/**
- * Vash - JavaScript Template Parser, v0.6.1-2481
+ * Vash - JavaScript Template Parser, v0.6.2-2482
*
* https://github.com/kirbysayshi/vash
*
View
2  build/vash-runtime.js
@@ -1,5 +1,5 @@
/**
- * Vash - JavaScript Template Parser, v0.6.1-2481
+ * Vash - JavaScript Template Parser, v0.6.2-2482
*
* https://github.com/kirbysayshi/vash
*
View
2  build/vash-runtime.min.js
@@ -1,5 +1,5 @@
/**
- * Vash - JavaScript Template Parser, v0.6.1-2481
+ * Vash - JavaScript Template Parser, v0.6.2-2482
*
* https://github.com/kirbysayshi/vash
*
View
4 build/vash.js
@@ -1,5 +1,5 @@
/**
- * Vash - JavaScript Template Parser, v0.6.1-2481
+ * Vash - JavaScript Template Parser, v0.6.2-2482
*
* https://github.com/kirbysayshi/vash
*
@@ -26,7 +26,7 @@
var vash = exports; // neccessary for nodejs references
- exports["version"] = "0.6.1-2481";
+ exports["version"] = "0.6.2-2482";
exports["config"] = {
"useWith": false
,"modelName": "model"
View
4 build/vash.min.js
@@ -1,5 +1,5 @@
/**
- * Vash - JavaScript Template Parser, v0.6.1-2481
+ * Vash - JavaScript Template Parser, v0.6.2-2482
*
* https://github.com/kirbysayshi/vash
*
@@ -7,4 +7,4 @@
* MIT License (LICENSE)
*/
-(function(a){typeof define=="function"&&define.amd?define(function(){return a}):typeof module=="object"&&module.exports?module.exports=a:window.vash=a})(function(a){function Z(a,b,c){this.ast=a,this.originalMarkup=b||"",this.options=c||{},this.reQuote=/(['"])/gi,this.reEscapedQuote=/\\+(["'])/gi,this.reLineBreak=/[\n\r]/gi,this.reHelpersName=/HELPERSNAME/g,this.reModelName=/MODELNAME/g,this.reOriginalMarkup=/ORIGINALMARKUP/g,this.buffer=[]}function U(a,b){this.options=b||{},this.tokens=a,this.ast=T(V),this.prevTokens=[]}function S(a){this.input=this.originalInput=a.replace(/\r\n|\r/g,"\n"),this.lineno=1,this.charno=0}var b=a;a.version="0.6.1-2481",a.config={useWith:!1,modelName:"model",helpersName:"html",htmlEscape:!0,debug:!0,debugParser:!1,debugCompiler:!1,simple:!1,favorText:!1,saveTextTag:!1,saveAT:!1},a.compile=function(b,c){if(b===""||typeof b!="string")throw new Error("Empty or non-string cannot be compiled");var d,e,f=[],g,h,i,j;c=T.extend({},a.config,c||{}),d=new S(b);while(e=d.advance())f.push(e);f.reverse(),g=new U(f,c),g.parse(),h=new Z(g.ast,b,c),i=h.generate();return i};var c=Array.prototype.slice,d=/vash\.helpers\.([^= ]+?)\s*=\s*function([^(]*?)\(([^)]*?)\)\s*{/,e=/\}$/,f=/^\/\/\s*@\s*batch\s*=\s*(.*?)$/,g=function(a,b,c,d){var e=b.split(/[\n\r]/g),f={},g=[],h="";e.forEach(function(b,e){var g=a.exec(b),i=g?c.apply(g,g):null;i&&(h=i,f[h]=[]),(!i||d)&&b&&f[h].push(b)}),Object.keys(f).forEach(function(a){f[a]=f[a].join("\n")});return f},h=function(a,c,e){var h=a==="helper"?d:f,j=g(h,c,function(a,b){return b.replace(/^\s+|\s+$/,"")},a==="helper"?!0:!1);j&&(Object.keys(j).forEach(function(c){j[c]=a==="helper"?i(j[c],e):b.compile("@{"+j[c]+"}",e)}),j.toClientString=function(){return Object.keys(j).reduce(function(a,b){return b==="toClientString"?a:a+j[b].toClientString()+"\n"},"")});return j},i=function(a,c){c=c||{};var f=a.replace(/^[\s\n\r]+|[\s\n\r]+$/,"").match(d),g=f[3].split(",").map(function(a){return a.replace(" ","")}),h=f[1],i=a.replace(d,"").replace(e,"");i="@{"+i+"}",c.args=g,c.asHelper=h;return b.compile(i,c)};a.compileHelper=h.bind(null,"helper"),a.compileBatch=a.batch=h.bind(null,"batch"),function(){function j(a,b){typeof b=="function"&&(b={onRenderEnd:b}),a&&a.onRenderEnd&&(b=b||{},b.onRenderEnd||(b.onRenderEnd=a.onRenderEnd),delete a.onRenderEnd),b||(b={});return b}b=typeof b=="undefined"?{}:b,b.compile||(typeof define=="function"&&define.amd?define(function(){return b}):typeof module=="object"&&module.exports?module.exports=b:window.vash=b);var a=b.helpers,c=function(a){this.buffer=new g,this.model=a,this.options=null,this.vl=0,this.vc=0};b.helpers=a=c.prototype={constructor:c,config:{},tplcache:{}},a.toString=a.toHtmlString=function(){return this.buffer._vo.join("")};var d=/[&<>"'`]/g,e=function(a){return f[a]},f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};a.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},a.escape=function(a){var b=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(d,e);return{toHtmlString:b,toString:b}}return a};var g=function(){this._vo=[]};g.prototype.mark=function(a){var b=new h(this,a);b.markedIndex=this._vo.length,this._vo.push(b.uid);return b},g.prototype.fromMark=function(a){var b=a.findInBuffer();if(b>-1){a.destroy();return this._vo.splice(b,this._vo.length)}return[]},g.prototype.spliceMark=function(a,b,c){var d=a.findInBuffer();if(d>-1){a.destroy(),arguments[0]=d;return this._vo.splice.apply(this._vo,arguments)}return[]},g.prototype.empty=function(){return this._vo.splice(0,this._vo.length)},g.prototype.push=function(a){return this._vo.push(a)},g.prototype.pushConcat=function(a){a instanceof Array?this._vo.push.apply(this._vo,a):arguments.length>1?this._vo.push.apply(this._vo,Array.prototype.slice.call(arguments)):this._vo.push(a);return this.__vo},g.prototype.indexOf=function(a){for(var b=0;b<this._vo.length;b++)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},g.prototype.lastIndexOf=function(a){var b=this._vo.length;while(--b>=0)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},g.prototype.splice=function(){return this._vo.splice.apply(this._vo,arguments)},g.prototype.index=function(a){return this._vo[a]},g.prototype.flush=function(){return this.empty().join("")},g.prototype.toString=g.prototype.toHtmlString=function(){return this._vo.join("")};var h=b.Mark=function(a,b){this.uid="[VASHMARK-"+~~(Math.random()*1e7)+(b?":"+b:"")+"]",this.markedIndex=0,this.buffer=a,this.destroyed=!1},i=/\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g;h.uidLike=function(a){return(a||"").search(i)>-1},h.prototype.destroy=function(){var a=this.findInBuffer();a>-1&&(this.buffer.splice(a,1),this.markedIndex=-1),this.destroyed=!0},h.prototype.findInBuffer=function(){return this.destroyed?-1:this.markedIndex&&this.buffer.index(this.markedIndex)===this.uid?this.markedIndex:this.markedIndex=this.buffer.indexOf(this.uid)},a.constructor.reportError=function(a,b,c,d,e){e=e||"!LB!";var f=d.split(e),g=b===0&&c===0?f.length-1:3,h=Math.max(0,b-g),i=Math.min(f.length,b+g),j=f.slice(h,i).map(function(a,c,d){var e=c+h+1;return(e===b?" > ":" ")+(e<10?" ":"")+e+" | "+a}).join("\n");a.message="Problem while rendering template at line "+b+", character "+c+".\nOriginal message: "+a.message+"."+"\nContext: \n\n"+j+"\n\n";throw a},a.reportError=function(){this.constructor.reportError.apply(this,arguments)},b.link=function(d,e){var f,g;e.args||(e.args=[e.modelName,e.helpersName,"__vopts","vash"]);if(typeof d=="string"){f=d;try{g=e.args.slice(),g.push(d),d=Function.apply(null,g)}catch(h){a.reportError(h,0,0,f,/\n/)}}d.options={simple:e.simple,modelName:e.modelName,helpersName:e.helpersName};var i;e.asHelper?(d.options.args=e.args,d.options.asHelper=e.asHelper,i=function(){return d.apply(this,k.call(arguments))},a[e.asHelper]=i):i=function(a,f){if(e.simple){var g={buffer:[],escape:c.prototype.escape,raw:c.prototype.raw};return d(a,g,f,b)}f=j(a,f);return d(a,f&&f.context||new c(a),f,b)},i.toString=function(){return d.toString()},i._toString=function(){return Function.prototype.toString.call(i)},i.toClientString=function(){return"vash.link( "+d.toString()+", "+JSON.stringify(d.options)+" )"};return i};var k=Array.prototype.slice;b.lookup=function(a,c){var d=b.helpers.tplcache[a];if(!d)throw new Error("Could not find template: "+a);return c?d(c):d},b.install=function(a,c){var d=b.helpers.tplcache;if(typeof c=="string"){if(!b.compile)throw new Error("vash.install(path, [string]) is not available in the standalone runtime.");c=b.compile(c)}else if(typeof a=="object"){c=a,Object.keys(c).forEach(function(a){d[a]=c[a]});return d}return d[a]=c},b.uninstall=function(a){var c=b.helpers.tplcache,d=!1;if(typeof a=="string")return delete c[a];Object.keys(c).forEach(function(b){c[b]===a&&(d=delete c[b])});return d}}(),function(){var a=b.helpers;a.trim=function(a){return a.replace(/^\s*|\s*$/g,"")},a.config.highlighter=null,a.highlight=function(b,c){var d=this.buffer.mark();c();var e=this.buffer.fromMark(d);this.buffer.push("<pre><code>"),a.config.highlighter?this.buffer.push(a.config.highlighter(b,e.join("")).value):this.buffer.push(e),this.buffer.push("</code></pre>")}}(),function(){if(typeof window=="undefined")var a=require("fs"),c=require("path");var d=b.helpers;d.config.browser=!1,b.loadFile=function(e,f,g){f=T.extend({},b.config,f||{});var h=d.config.browser,i;!h&&f.settings&&f.settings.views&&(e=c.normalize(e),e.indexOf(c.normalize(f.settings.views))===-1&&(e=c.join(f.settings.views,e)),c.extname(e)||(e+="."+(f.settings["view engine"]||"vash")));try{i=f.cache||h?d.tplcache[e]||(d.tplcache[e]=b.compile(a.readFileSync(e,"utf8"))):b.compile(a.readFileSync(e,"utf8")),g&&g(null,i)}catch(j){g&&g(j,null)}},b.renderFile=function(a,c,d){b.loadFile(a,c,function(a,b){var e=c.onRenderEnd;d(a,b(c,function(a,b){b.finishLayout(),e&&e(a,b)}))})},d._ensureLayoutProps=function(){this.appends=this.appends||{},this.prepends=this.prepends||{},this.blocks=this.blocks||{},this.blockMarks=this.blockMarks||{}},d.finishLayout=function(){this._ensureLayoutProps();var a=this,b,c,d,e,f,g,h,i;for(b in this.blockMarks)c=this.blockMarks[b],e=this.prepends[b],d=this.blocks[b],f=this.appends[b],g=c.pop(),h=this.buffer.mark(),e&&e.forEach(function(b){a.buffer.pushConcat(b)}),block=d.pop(),block&&this.buffer.pushConcat(block),f&&f.forEach(function(b){a.buffer.pushConcat(b)}),i=this.buffer.fromMark(h),i.unshift(g,0),this.buffer.spliceMark.apply(this.buffer,i);for(b in this.blockMarks)this.blockMarks[b].forEach(function(a){a.destroy()});delete this.blockMarks,delete this.prepends,delete this.blocks,delete this.appends;return this.toString()},d.extend=function(a,c){var d=this,e=this.buffer,f=this.model,g;this._ensureLayoutProps(),b.loadFile(a,this.model,function(a,b){var e=d.buffer.mark();c(d.model);var f=d.buffer.fromMark(e);d.isExtending=!0,b(d.model,{context:d}),d.isExtending=!1}),this.model=f},d.include=function(a,c){var d=this,e=this.buffer,f=this.model;b.loadFile(a,this.model,function(a,b){b(c||d.model,{context:d})}),this.model=f},d.block=function(a,b){this._ensureLayoutProps();var c=this,d=this.blockMarks[a]||(this.blockMarks[a]=[]),e=this.blocks[a]||(this.blocks[a]=[]),f,g;b&&(f=this.buffer.mark(),b(this.model),g=this.buffer.fromMark(f),g.length&&!this.isExtending&&e.push(g),g.length&&this.isExtending&&e.unshift(g)),d.push(this.buffer.mark("block-"+a))},d._handlePrependAppend=function(a,b,c){this._ensureLayoutProps();var d=this.buffer.mark(),e,f=this[a],g=f[b]||(f[b]=[]);c(this.model),e=this.buffer.fromMark(d),g.push(e)},d.append=function(a,b){this._handlePrependAppend("appends",a,b)},d.prepend=function(a,b){this._handlePrependAppend("prepends",a,b)}}(),a.__express=a.renderFile;var j="AT",k="ASSIGN_OPERATOR",l="AT_COLON",m="AT_STAR_CLOSE",n="AT_STAR_OPEN",o="BACKSLASH",p="BRACE_CLOSE",q="BRACE_OPEN",r="CONTENT",s="DOUBLE_QUOTE",t="EMAIL",u="ESCAPED_QUOTE",v="FAT_ARROW",w="FUNCTION",x="HARD_PAREN_CLOSE",y="HARD_PAREN_OPEN",z="HTML_TAG_CLOSE",A="HTML_TAG_OPEN",B="HTML_TAG_VOID_OPEN",C="HTML_TAG_VOID_CLOSE",D="IDENTIFIER",E="KEYWORD",F="LOGICAL",G="NEWLINE",H="NUMERIC_CONTENT",I="OPERATOR",J="PAREN_CLOSE",K="PAREN_OPEN",L="PERIOD",M="SINGLE_QUOTE",N="TEXT_TAG_CLOSE",O="TEXT_TAG_OPEN",P="WHITESPACE",Q={};Q[n]=m,Q[q]=p,Q[s]=s,Q[y]=x,Q[K]=J,Q[M]=M,Q[l]=G;var R=[t,/^([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.(?:ca|co\.uk|com|edu|net|org))\b/,n,/^(@\*)/,m,/^(\*@)/,l,/^(@\:)/,j,/^(@)/,v,/^(\(.*?\)?\s*?=>)/,K,/^(\()/,J,/^(\))/,y,/^(\[)/,x,/^(\])/,q,/^(\{)/,p,/^(\})/,O,/^(<text>)/,N,/^(<\/text>)/,A,function(){var a=/^(<[^\/=+< >]+?[^>]*?>)/,b=/([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4})\b/,c=/^(<[a-zA-Z@]+[^>]*?\s*\/\s*>)/,d=this.scan(c,B)||this.scan(a,A);d&&(this.spewIf(d,b),this.spewIf(d,/(@)/),this.spewIf(d,/(\/\s*>)/));return d},z,/^(<\/[^>@\b]+?>)/,C,/^(\/\s*>)/,L,/^(\.)/,G,function(){var a=this.scan(/^(\n)/,G);a&&(this.lineno++,this.charno=0);return a},P,/^(\s)/,w,/^(function)(?![\d\w])/,E,/^(case|catch|do|else|finally|for|function|goto|if|instanceof|return|switch|try|typeof|var|while|with)(?![\d\w])/,D,/^([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)/,I,/^(===|!==|==|!==|>>>|<<|>>|>=|<=|>|<|\+|-|\/|\*|\^|%|\:|\?)/,k,/^(\|=|\^=|&=|>>>=|>>=|<<=|-=|\+=|%=|\/=|\*=|=)/,F,/^(&&|\|\||&|\||\^)/,u,/^(\\+['"])/,o,/^(\\)/,s,/^(\")/,M,/^(\')/,H,/^([0-9]+)/,r,/^([^\s})@.]+?)/];S.prototype={scan:function(a,b){var c,d;if(c=a.exec(this.input)){this.input=this.input.substr(c[1].length),d={type:b,line:this.lineno,chr:this.charno,val:c[1]||"",toString:function(){return"["+this.type+" ("+this.line+","+this.chr+"): "+this.val+"]"}},this.charno+=c[0].length;return d}},spewIf:function(a,b){var c,d,e;a&&(c=b.exec(a.val),c&&(d=a.val.indexOf(c[1]),e=a.val.substring(d),this.input=e+this.input,this.charno-=e.length,a.val=a.val.substring(0,d)));return a},advance:function(){var a,b,c,d;for(a=0;a<R.length;a+=2){c=R[a+1],c.displayName=R[a],typeof c=="function"&&(d=c.call(this)),typeof c.exec=="function"&&(d=this.scan(c,R[a]));if(d)return d}}};var T=function(a){return new T.fn.init(a)};T.prototype.init=function(a){typeof a=="string"&&(this.mode=a),this.maxCheck()},T.fn=T.prototype.init.prototype=T.prototype,T.fn.vquery="yep",T.fn.constructor=T,T.fn.length=0,T.fn.parent=null,T.fn.mode=null,T.fn.tagName=null,T.fn.tagVoid=null,T.fn.beget=function(a,b){var c=T(a);c.parent=this,this.push(c),b&&(c.tagName=b),this.maxCheck();return c},T.fn.closest=function(a,b){var c=this;while(c)if(c.tagName!==b&&c.parent)c=c.parent;else break;return c},T.fn.pushFlatten=function(a){var b=a,c,d;while(b.length===1&&b[0].vquery)b=b[0];if(b.mode!==V)this.push(b);else for(c=0;c<b.length;c++)this.push(b[c]);this.maxCheck();return this},T.fn.push=function(a){T.isArray(a)?(a.vquery&&a.forEach(function(a){a.parent=this},this),Array.prototype.push.apply(this,a)):(a.vquery&&(a.parent=this),Array.prototype.push.call(this,a)),this.maxCheck();return this.length},T.fn.root=function(){var a=this;while(a&&a.parent&&(a=a.parent));return a},T.fn.toTreeString=function(){function c(d){var e,f;a.push(Array(b).join(" |")+" +"+d.mode+" "+(d.tagName||"")),b+=1,e=d.slice();while(f=e.shift())f.vquery===T.fn.vquery?c(f):a.push(Array(b).join(" |")+" "+(f?f.toString().replace(/(\r|\n)/g,""):"[empty]"));b-=1,a.push(Array(b).join(" |")+" -"+d.mode+" "+(d.tagName||""))}var a=[],b=1;c(this);return a.join("\n")},T.fn.maxCheck=function(a){if(this.length>=T.maxSize){var b=new Error;b.message="Maximum number of elements exceeded.\nThis is typically caused by an unmatched character or tag. Parse tree follows:\n"+this.toTreeString(),b.name="vQueryDepthException";throw b}},T.maxSize=1e3,T.fn.flatten=function(){var a;return this.reduce(function b(c,d,e,f){if(d.vquery){c.push({type:"META",val:"START"+d.mode,tagName:d.tagName}),a=d.reduce(b,c),a.push({type:"META",val:"END"+d.mode,tagName:d.tagName});return a}d.mode=f.mode,c.push(d);return c},[])},T.reconstitute=function(a){return a.reduce(function b(a,b,c,d){b.type==="META"?a=a.parent:(b.mode!==a.mode&&(a=a.beget(b.mode,b.tagName)),a.push(b));return a},T(V))},T.isArray=function(a){return Object.prototype.toString.call(a)=="[object Array]"},T.extend=function(a){var b,c,d;for(c=1;c<arguments.length;c++){b=arguments[c];for(d in b)a[d]=b[d]}return a},T.takeMethodsFromArray=function(){var a=["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice","indexOf","lastIndexOf","filter","forEach","every","map","some","reduce","reduceRight"],b=[],c;for(var d=0;d<a.length;d++){c=a[d];if(typeof b[c]=="function")T.fn[c]||function(a){T.fn[a]=function(){return b[a].apply(this,Array.prototype.slice.call(arguments,0))}}(c);else throw new Error("Vash requires ES5 array iteration methods, missing: "+c)}},T.takeMethodsFromArray();var V="PROGRAM",W="MARKUP",X="BLOCK",Y="EXPRESSION";U.prototype={parse:function(){var a,b,c,d;while(this.prevTokens.push(a),a=this.tokens.pop()){this.options.debugParser&&console.log(this.ast&&this.ast.mode,a.type,a.toString(),a.val);if(this.ast.mode===V||this.ast.mode===null)this.ast=this.ast.beget(this.options.initialMode||W),this.options.initialMode===Y&&(this.ast=this.ast.beget(Y));if(this.ast.mode===W){this.handleMKP(a);continue}if(this.ast.mode===X){this.handleBLK(a);continue}if(this.ast.mode===Y){this.handleEXP(a);continue}}this.ast=this.ast.root(),this.options.debugParser&&!this.options.initialMode&&(console.log(this.ast.toString()),console.log(this.ast.toTreeString()));return this.ast},exceptionFactory:function(a,b,c){b=="UNMATCHED"&&(a.name="UnmatchedCharacterError",this.ast=this.ast.root(),c&&(a.message="Unmatched "+c.type+" at line "+c.line+", character "+c.chr+". Value: "+c.val+"\n "+this.ast.toTreeString(),a.lineNumber=c.line));return a},advanceUntilNot:function(a){var b,c,d=[];while(c=this.tokens[this.tokens.length-1])if(c.type===a)b=this.tokens.pop(),d.push(b);else break;return d},advanceUntilMatched:function(a,b,c,d,e){var f=a,g=null,h=0,i=0,j=[];while(f){f.type===b?g&&g.type!==d&&b!==c||!g?h++:b===c&&g.type!==d&&i++:f.type===c&&(i++,g&&g.type===e&&i--),j.push(f);if(h===i)break;g=f,f=this.tokens.pop();if(!f)throw this.exceptionFactory(new Error,"UNMATCHED",a)}return j.reverse()},subParse:function(a,b,c){var d,e,f,g=T.extend({},this.options);g.initialMode=b,d=this.advanceUntilMatched(a,a.type,Q[a.type],null,j),d.pop(),e=d.shift(),c||this.ast.push(a),f=new U(d,g),f.parse(),c&&(f.ast[0].unshift(a),f.ast[0].push(e)),this.ast.pushFlatten(f.ast),c||this.ast.push(e)},handleMKP:function(a){var b=this.tokens[this.tokens.length-1],c=this.tokens[this.tokens.length-2],d=null,e;switch(a.type){case n:this.advanceUntilMatched(a,n,m,j,j);break;case j:if(b){this.options.saveAT&&this.ast.push(a);switch(b.type){case K:case D:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(Y);break;case E:case w:case q:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(X);break;case j:case l:b.type="CONTENT",this.ast.push(this.tokens.pop());break;default:this.ast.push(this.tokens.pop())}}break;case O:case A:case B:d=a.val.match(/^<([^\/ >]+)/i),d===null&&b&&b.type===j&&c&&(d=c.val.match(/(.*)/)),this.ast.tagName?this.ast=this.ast.beget(W,d[1]):this.ast.tagName=d[1],a.type===B&&(this.ast.tagVoid=this.ast.tagName),(B===a.type||A===a.type||this.options.saveTextTag)&&this.ast.push(a);break;case N:case z:d=a.val.match(/^<\/([^>]+)/i),d===null&&b&&b.type===j&&c&&(d=c.val.match(/(.*)/)),e=this.ast.closest(W,d[1]),e!==null&&e.tagName===d[1]&&(this.ast=e),(z===a.type||this.options.saveTextTag)&&this.ast.push(a),this.ast.parent&&this.ast.parent.mode===X&&(this.ast=this.ast.parent);break;case C:this.ast.tagVoid?(this.ast.push(a),this.ast=this.ast.parent):this.tokens.push(a);break;case o:a.val+="\\",this.ast.push(a);break;default:this.ast.push(a)}},handleBLK:function(a){var b=this.tokens[this.tokens.length-1],c,d,e,f,g,h,i;switch(a.type){case j:b.type!==j&&(this.tokens.push(a),this.ast=this.ast.beget(W));break;case n:this.advanceUntilMatched(a,n,m,j,j);break;case l:this.subParse(a,W,!0);break;case O:case N:case B:case A:case z:this.ast=this.ast.beget(W),this.tokens.push(a);break;case q:case K:c=this.options.favorText&&a.type===q?W:X,this.subParse(a,c),f=this.advanceUntilNot(P),b=this.tokens[this.tokens.length-1],b&&b.type!==E&&b.type!==w&&b.type!==q&&a.type!==K?(this.tokens.push.apply(this.tokens,f.reverse()),this.ast=this.ast.parent):this.ast.push(f);break;default:this.ast.push(a)}},handleEXP:function(a){var b=null,c,d,e,f,g,h,i;switch(a.type){case E:case w:this.ast=this.ast.beget(X),this.tokens.push(a);break;case P:case F:case k:case I:case H:this.ast.parent&&this.ast.parent.mode===Y?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;case D:this.ast.push(a);break;case M:case s:this.ast.parent&&this.ast.parent.mode===Y?(g=this.advanceUntilMatched(a,a.type,Q[a.type],o,o),this.ast.pushFlatten(g.reverse())):(this.ast=this.ast.parent,this.tokens.push(a));break;case y:case K:h=this.prevTokens[this.prevTokens.length-1],b=this.tokens[this.tokens.length-1];if(a.type===y&&b.type===x){this.tokens.push(a),this.ast=this.ast.parent;break}this.subParse(a,Y),b=this.tokens[this.tokens.length-1];if(h&&h.type===j||b&&b.type===D)this.ast=this.ast.parent;break;case q:this.tokens.push(a),this.ast=this.ast.beget(X);break;case v:this.tokens.push(a),this.ast=this.ast.beget(X);break;case L:b=this.tokens[this.tokens.length-1],b&&(b.type===D||b.type===E||b.type===w||b.type===L||this.ast.parent&&this.ast.parent.mode===Y)?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;default:this.ast.parent&&this.ast.parent.mode!==Y?(this.ast=this.ast.parent,this.tokens.push(a)):this.ast.push(a)}}};var $=Z.prototype;$.insertDebugVars=function(a){this.options.debug&&this.buffer.push(this.options.helpersName+".vl = "+a.line+", ",this.options.helpersName+".vc = "+a.chr+"; \n")},$.visitMarkupTok=function(a,b,c){this.insertDebugVars(a),this.buffer.push("MKP("+a.val.replace(this.reEscapedQuote,"\\\\$1").replace(this.reQuote,"\\$1").replace(this.reLineBreak,"\\n")+")MKP")},$.visitBlockTok=function(a,b,c){this.buffer.push(a.val)},$.visitExpressionTok=function(a,b,c,d){var e="",f="",g=b.parent&&b.parent.mode!==Y;this.options.htmlEscape!==!1&&(g&&c===0&&d&&(e+=this.options.helpersName+".escape("),g&&c===b.length-1&&d&&(f+=").toHtmlString()")),g&&c===0&&(this.insertDebugVars(a),e="__vbuffer.push("+e),g&&c===b.length-1&&(f+="); \n"),this.buffer.push(e+a.val+f),g&&c===b.length-1&&this.insertDebugVars(a)},$.visitNode=function(a){var b,c=a.slice(0),d,e,f;a.mode===Y&&a.parent&&a.parent.mode!==Y&&(d=a.filter(Z.findNonExp).length);for(e=0;e<c.length;e++){f=c[e];if(f.type&&f.type===j||f.type===l)continue;f.vquery?this.visitNode(f):a.mode===W?this.visitMarkupTok(f,a,e):a.mode===X?this.visitBlockTok(f,a,e):a.mode===Y&&this.visitExpressionTok(f,a,e,d>0?!1:!0)}},$.escapeForDebug=function(a){return a.replace(this.reLineBreak,"!LB!").replace(this.reQuote,"\\$1").replace(this.reEscapedQuote,"\\$1")},$.replaceDevTokens=function(a){return a.replace(this.reHelpersName,this.options.helpersName).replace(this.reModelName,this.options.modelName)},$.addHead=function(a){var b=this.options,c=""+(b.debug?"try { \n":"")+"var __vbuffer = HELPERSNAME.buffer; \n"+"HELPERSNAME.options = __vopts; \n"+"MODELNAME = MODELNAME || {}; \n"+(b.useWith?"with( MODELNAME ){ \n":"");c=this.replaceDevTokens(c);return c+a},$.addHelperHead=function(a){var b=this.options,c=""+(b.debug?"try { \n":"")+"var __vbuffer = this.buffer; \n"+"var MODELNAME = this.model; \n"+"var HELPERSNAME = this; \n";c=this.replaceDevTokens(c);return c+a},$.addFoot=function(a){var b=this.options,c=""+(b.simple?'return HELPERSNAME.buffer.join(""); \n':"(__vopts && __vopts.onRenderEnd && __vopts.onRenderEnd(null, HELPERSNAME)); \nreturn (__vopts && __vopts.asContext) \n ? HELPERSNAME \n : HELPERSNAME.toString(); \n")+(b.useWith?"} \n":"")+(b.debug?'} catch( e ){ \n HELPERSNAME.reportError( e, HELPERSNAME.vl, HELPERSNAME.vc, "ORIGINALMARKUP" ); \n} \n':"");c=this.replaceDevTokens(c).replace(this.reOriginalMarkup,this.escapeForDebug(this.originalMarkup));return a+c},$.addHelperFoot=function(a){var b=this.options,c=""+(b.debug?'} catch( e ){ \n HELPERSNAME.reportError( e, HELPERSNAME.vl, HELPERSNAME.vc, "ORIGINALMARKUP" ); \n} \n':"");c=this.replaceDevTokens(c).replace(this.reOriginalMarkup,this.escapeForDebug(this.originalMarkup));return a+c},$.generate=function(){var a=this.options;this.buffer.length=0,this.visitNode(this.ast);var c=this.buffer.join("").split(")MKPMKP(").join("").split("MKP(").join("__vbuffer.push('").split(")MKP").join("'); \n");a.asHelper?(c=this.addHelperHead(c),c=this.addHelperFoot(c)):(c=this.addHead(c),c=this.addFoot(c)),a.debugCompiler&&(console.log(c),console.log(a)),this.cmpFunc=b.link(c,a);return this.cmpFunc},Z.noop=function(){},Z.findNonExp=function(a){return a.vquery&&a.mode===Y?a.filter(Z.findNonExp).length>0:a.vquery&&a.mode!==Y?!0:!1},a.VLexer=S,a.VParser=U,a.VCompiler=Z,a.vQuery=T;return a}({}))
+(function(a){typeof define=="function"&&define.amd?define(function(){return a}):typeof module=="object"&&module.exports?module.exports=a:window.vash=a})(function(a){function Z(a,b,c){this.ast=a,this.originalMarkup=b||"",this.options=c||{},this.reQuote=/(['"])/gi,this.reEscapedQuote=/\\+(["'])/gi,this.reLineBreak=/[\n\r]/gi,this.reHelpersName=/HELPERSNAME/g,this.reModelName=/MODELNAME/g,this.reOriginalMarkup=/ORIGINALMARKUP/g,this.buffer=[]}function U(a,b){this.options=b||{},this.tokens=a,this.ast=T(V),this.prevTokens=[]}function S(a){this.input=this.originalInput=a.replace(/\r\n|\r/g,"\n"),this.lineno=1,this.charno=0}var b=a;a.version="0.6.2-2482",a.config={useWith:!1,modelName:"model",helpersName:"html",htmlEscape:!0,debug:!0,debugParser:!1,debugCompiler:!1,simple:!1,favorText:!1,saveTextTag:!1,saveAT:!1},a.compile=function(b,c){if(b===""||typeof b!="string")throw new Error("Empty or non-string cannot be compiled");var d,e,f=[],g,h,i,j;c=T.extend({},a.config,c||{}),d=new S(b);while(e=d.advance())f.push(e);f.reverse(),g=new U(f,c),g.parse(),h=new Z(g.ast,b,c),i=h.generate();return i};var c=Array.prototype.slice,d=/vash\.helpers\.([^= ]+?)\s*=\s*function([^(]*?)\(([^)]*?)\)\s*{/,e=/\}$/,f=/^\/\/\s*@\s*batch\s*=\s*(.*?)$/,g=function(a,b,c,d){var e=b.split(/[\n\r]/g),f={},g=[],h="";e.forEach(function(b,e){var g=a.exec(b),i=g?c.apply(g,g):null;i&&(h=i,f[h]=[]),(!i||d)&&b&&f[h].push(b)}),Object.keys(f).forEach(function(a){f[a]=f[a].join("\n")});return f},h=function(a,c,e){var h=a==="helper"?d:f,j=g(h,c,function(a,b){return b.replace(/^\s+|\s+$/,"")},a==="helper"?!0:!1);j&&(Object.keys(j).forEach(function(c){j[c]=a==="helper"?i(j[c],e):b.compile("@{"+j[c]+"}",e)}),j.toClientString=function(){return Object.keys(j).reduce(function(a,b){return b==="toClientString"?a:a+j[b].toClientString()+"\n"},"")});return j},i=function(a,c){c=c||{};var f=a.replace(/^[\s\n\r]+|[\s\n\r]+$/,"").match(d),g=f[3].split(",").map(function(a){return a.replace(" ","")}),h=f[1],i=a.replace(d,"").replace(e,"");i="@{"+i+"}",c.args=g,c.asHelper=h;return b.compile(i,c)};a.compileHelper=h.bind(null,"helper"),a.compileBatch=a.batch=h.bind(null,"batch"),function(){function j(a,b){typeof b=="function"&&(b={onRenderEnd:b}),a&&a.onRenderEnd&&(b=b||{},b.onRenderEnd||(b.onRenderEnd=a.onRenderEnd),delete a.onRenderEnd),b||(b={});return b}b=typeof b=="undefined"?{}:b,b.compile||(typeof define=="function"&&define.amd?define(function(){return b}):typeof module=="object"&&module.exports?module.exports=b:window.vash=b);var a=b.helpers,c=function(a){this.buffer=new g,this.model=a,this.options=null,this.vl=0,this.vc=0};b.helpers=a=c.prototype={constructor:c,config:{},tplcache:{}},a.toString=a.toHtmlString=function(){return this.buffer._vo.join("")};var d=/[&<>"'`]/g,e=function(a){return f[a]},f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};a.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},a.escape=function(a){var b=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(d,e);return{toHtmlString:b,toString:b}}return a};var g=function(){this._vo=[]};g.prototype.mark=function(a){var b=new h(this,a);b.markedIndex=this._vo.length,this._vo.push(b.uid);return b},g.prototype.fromMark=function(a){var b=a.findInBuffer();if(b>-1){a.destroy();return this._vo.splice(b,this._vo.length)}return[]},g.prototype.spliceMark=function(a,b,c){var d=a.findInBuffer();if(d>-1){a.destroy(),arguments[0]=d;return this._vo.splice.apply(this._vo,arguments)}return[]},g.prototype.empty=function(){return this._vo.splice(0,this._vo.length)},g.prototype.push=function(a){return this._vo.push(a)},g.prototype.pushConcat=function(a){a instanceof Array?this._vo.push.apply(this._vo,a):arguments.length>1?this._vo.push.apply(this._vo,Array.prototype.slice.call(arguments)):this._vo.push(a);return this.__vo},g.prototype.indexOf=function(a){for(var b=0;b<this._vo.length;b++)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},g.prototype.lastIndexOf=function(a){var b=this._vo.length;while(--b>=0)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},g.prototype.splice=function(){return this._vo.splice.apply(this._vo,arguments)},g.prototype.index=function(a){return this._vo[a]},g.prototype.flush=function(){return this.empty().join("")},g.prototype.toString=g.prototype.toHtmlString=function(){return this._vo.join("")};var h=b.Mark=function(a,b){this.uid="[VASHMARK-"+~~(Math.random()*1e7)+(b?":"+b:"")+"]",this.markedIndex=0,this.buffer=a,this.destroyed=!1},i=/\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g;h.uidLike=function(a){return(a||"").search(i)>-1},h.prototype.destroy=function(){var a=this.findInBuffer();a>-1&&(this.buffer.splice(a,1),this.markedIndex=-1),this.destroyed=!0},h.prototype.findInBuffer=function(){return this.destroyed?-1:this.markedIndex&&this.buffer.index(this.markedIndex)===this.uid?this.markedIndex:this.markedIndex=this.buffer.indexOf(this.uid)},a.constructor.reportError=function(a,b,c,d,e){e=e||"!LB!";var f=d.split(e),g=b===0&&c===0?f.length-1:3,h=Math.max(0,b-g),i=Math.min(f.length,b+g),j=f.slice(h,i).map(function(a,c,d){var e=c+h+1;return(e===b?" > ":" ")+(e<10?" ":"")+e+" | "+a}).join("\n");a.message="Problem while rendering template at line "+b+", character "+c+".\nOriginal message: "+a.message+"."+"\nContext: \n\n"+j+"\n\n";throw a},a.reportError=function(){this.constructor.reportError.apply(this,arguments)},b.link=function(d,e){var f,g;e.args||(e.args=[e.modelName,e.helpersName,"__vopts","vash"]);if(typeof d=="string"){f=d;try{g=e.args.slice(),g.push(d),d=Function.apply(null,g)}catch(h){a.reportError(h,0,0,f,/\n/)}}d.options={simple:e.simple,modelName:e.modelName,helpersName:e.helpersName};var i;e.asHelper?(d.options.args=e.args,d.options.asHelper=e.asHelper,i=function(){return d.apply(this,k.call(arguments))},a[e.asHelper]=i):i=function(a,f){if(e.simple){var g={buffer:[],escape:c.prototype.escape,raw:c.prototype.raw};return d(a,g,f,b)}f=j(a,f);return d(a,f&&f.context||new c(a),f,b)},i.toString=function(){return d.toString()},i._toString=function(){return Function.prototype.toString.call(i)},i.toClientString=function(){return"vash.link( "+d.toString()+", "+JSON.stringify(d.options)+" )"};return i};var k=Array.prototype.slice;b.lookup=function(a,c){var d=b.helpers.tplcache[a];if(!d)throw new Error("Could not find template: "+a);return c?d(c):d},b.install=function(a,c){var d=b.helpers.tplcache;if(typeof c=="string"){if(!b.compile)throw new Error("vash.install(path, [string]) is not available in the standalone runtime.");c=b.compile(c)}else if(typeof a=="object"){c=a,Object.keys(c).forEach(function(a){d[a]=c[a]});return d}return d[a]=c},b.uninstall=function(a){var c=b.helpers.tplcache,d=!1;if(typeof a=="string")return delete c[a];Object.keys(c).forEach(function(b){c[b]===a&&(d=delete c[b])});return d}}(),function(){var a=b.helpers;a.trim=function(a){return a.replace(/^\s*|\s*$/g,"")},a.config.highlighter=null,a.highlight=function(b,c){var d=this.buffer.mark();c();var e=this.buffer.fromMark(d);this.buffer.push("<pre><code>"),a.config.highlighter?this.buffer.push(a.config.highlighter(b,e.join("")).value):this.buffer.push(e),this.buffer.push("</code></pre>")}}(),function(){if(typeof window=="undefined")var a=require("fs"),c=require("path");var d=b.helpers;d.config.browser=!1,b.loadFile=function(e,f,g){f=T.extend({},b.config,f||{});var h=d.config.browser,i;!h&&f.settings&&f.settings.views&&(e=c.normalize(e),e.indexOf(c.normalize(f.settings.views))===-1&&(e=c.join(f.settings.views,e)),c.extname(e)||(e+="."+(f.settings["view engine"]||"vash")));try{i=f.cache||h?d.tplcache[e]||(d.tplcache[e]=b.compile(a.readFileSync(e,"utf8"))):b.compile(a.readFileSync(e,"utf8")),g&&g(null,i)}catch(j){g&&g(j,null)}},b.renderFile=function(a,c,d){b.loadFile(a,c,function(a,b){var e=c.onRenderEnd;d(a,b(c,function(a,b){b.finishLayout(),e&&e(a,b)}))})},d._ensureLayoutProps=function(){this.appends=this.appends||{},this.prepends=this.prepends||{},this.blocks=this.blocks||{},this.blockMarks=this.blockMarks||{}},d.finishLayout=function(){this._ensureLayoutProps();var a=this,b,c,d,e,f,g,h,i;for(b in this.blockMarks)c=this.blockMarks[b],e=this.prepends[b],d=this.blocks[b],f=this.appends[b],g=c.pop(),h=this.buffer.mark(),e&&e.forEach(function(b){a.buffer.pushConcat(b)}),block=d.pop(),block&&this.buffer.pushConcat(block),f&&f.forEach(function(b){a.buffer.pushConcat(b)}),i=this.buffer.fromMark(h),i.unshift(g,0),this.buffer.spliceMark.apply(this.buffer,i);for(b in this.blockMarks)this.blockMarks[b].forEach(function(a){a.destroy()});delete this.blockMarks,delete this.prepends,delete this.blocks,delete this.appends;return this.toString()},d.extend=function(a,c){var d=this,e=this.buffer,f=this.model,g;this._ensureLayoutProps(),b.loadFile(a,this.model,function(a,b){var e=d.buffer.mark();c(d.model);var f=d.buffer.fromMark(e);d.isExtending=!0,b(d.model,{context:d}),d.isExtending=!1}),this.model=f},d.include=function(a,c){var d=this,e=this.buffer,f=this.model;b.loadFile(a,this.model,function(a,b){b(c||d.model,{context:d})}),this.model=f},d.block=function(a,b){this._ensureLayoutProps();var c=this,d=this.blockMarks[a]||(this.blockMarks[a]=[]),e=this.blocks[a]||(this.blocks[a]=[]),f,g;b&&(f=this.buffer.mark(),b(this.model),g=this.buffer.fromMark(f),g.length&&!this.isExtending&&e.push(g),g.length&&this.isExtending&&e.unshift(g)),d.push(this.buffer.mark("block-"+a))},d._handlePrependAppend=function(a,b,c){this._ensureLayoutProps();var d=this.buffer.mark(),e,f=this[a],g=f[b]||(f[b]=[]);c(this.model),e=this.buffer.fromMark(d),g.push(e)},d.append=function(a,b){this._handlePrependAppend("appends",a,b)},d.prepend=function(a,b){this._handlePrependAppend("prepends",a,b)}}(),a.__express=a.renderFile;var j="AT",k="ASSIGN_OPERATOR",l="AT_COLON",m="AT_STAR_CLOSE",n="AT_STAR_OPEN",o="BACKSLASH",p="BRACE_CLOSE",q="BRACE_OPEN",r="CONTENT",s="DOUBLE_QUOTE",t="EMAIL",u="ESCAPED_QUOTE",v="FAT_ARROW",w="FUNCTION",x="HARD_PAREN_CLOSE",y="HARD_PAREN_OPEN",z="HTML_TAG_CLOSE",A="HTML_TAG_OPEN",B="HTML_TAG_VOID_OPEN",C="HTML_TAG_VOID_CLOSE",D="IDENTIFIER",E="KEYWORD",F="LOGICAL",G="NEWLINE",H="NUMERIC_CONTENT",I="OPERATOR",J="PAREN_CLOSE",K="PAREN_OPEN",L="PERIOD",M="SINGLE_QUOTE",N="TEXT_TAG_CLOSE",O="TEXT_TAG_OPEN",P="WHITESPACE",Q={};Q[n]=m,Q[q]=p,Q[s]=s,Q[y]=x,Q[K]=J,Q[M]=M,Q[l]=G;var R=[t,/^([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.(?:ca|co\.uk|com|edu|net|org))\b/,n,/^(@\*)/,m,/^(\*@)/,l,/^(@\:)/,j,/^(@)/,v,/^(\(.*?\)?\s*?=>)/,K,/^(\()/,J,/^(\))/,y,/^(\[)/,x,/^(\])/,q,/^(\{)/,p,/^(\})/,O,/^(<text>)/,N,/^(<\/text>)/,A,function(){var a=/^(<[^\/=+< >]+?[^>]*?>)/,b=/([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4})\b/,c=/^(<[a-zA-Z@]+[^>]*?\s*\/\s*>)/,d=this.scan(c,B)||this.scan(a,A);d&&(this.spewIf(d,b),this.spewIf(d,/(@)/),this.spewIf(d,/(\/\s*>)/));return d},z,/^(<\/[^>@\b]+?>)/,C,/^(\/\s*>)/,L,/^(\.)/,G,function(){var a=this.scan(/^(\n)/,G);a&&(this.lineno++,this.charno=0);return a},P,/^(\s)/,w,/^(function)(?![\d\w])/,E,/^(case|catch|do|else|finally|for|function|goto|if|instanceof|return|switch|try|typeof|var|while|with)(?![\d\w])/,D,/^([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)/,I,/^(===|!==|==|!==|>>>|<<|>>|>=|<=|>|<|\+|-|\/|\*|\^|%|\:|\?)/,k,/^(\|=|\^=|&=|>>>=|>>=|<<=|-=|\+=|%=|\/=|\*=|=)/,F,/^(&&|\|\||&|\||\^)/,u,/^(\\+['"])/,o,/^(\\)/,s,/^(\")/,M,/^(\')/,H,/^([0-9]+)/,r,/^([^\s})@.]+?)/];S.prototype={scan:function(a,b){var c,d;if(c=a.exec(this.input)){this.input=this.input.substr(c[1].length),d={type:b,line:this.lineno,chr:this.charno,val:c[1]||"",toString:function(){return"["+this.type+" ("+this.line+","+this.chr+"): "+this.val+"]"}},this.charno+=c[0].length;return d}},spewIf:function(a,b){var c,d,e;a&&(c=b.exec(a.val),c&&(d=a.val.indexOf(c[1]),e=a.val.substring(d),this.input=e+this.input,this.charno-=e.length,a.val=a.val.substring(0,d)));return a},advance:function(){var a,b,c,d;for(a=0;a<R.length;a+=2){c=R[a+1],c.displayName=R[a],typeof c=="function"&&(d=c.call(this)),typeof c.exec=="function"&&(d=this.scan(c,R[a]));if(d)return d}}};var T=function(a){return new T.fn.init(a)};T.prototype.init=function(a){typeof a=="string"&&(this.mode=a),this.maxCheck()},T.fn=T.prototype.init.prototype=T.prototype,T.fn.vquery="yep",T.fn.constructor=T,T.fn.length=0,T.fn.parent=null,T.fn.mode=null,T.fn.tagName=null,T.fn.tagVoid=null,T.fn.beget=function(a,b){var c=T(a);c.parent=this,this.push(c),b&&(c.tagName=b),this.maxCheck();return c},T.fn.closest=function(a,b){var c=this;while(c)if(c.tagName!==b&&c.parent)c=c.parent;else break;return c},T.fn.pushFlatten=function(a){var b=a,c,d;while(b.length===1&&b[0].vquery)b=b[0];if(b.mode!==V)this.push(b);else for(c=0;c<b.length;c++)this.push(b[c]);this.maxCheck();return this},T.fn.push=function(a){T.isArray(a)?(a.vquery&&a.forEach(function(a){a.parent=this},this),Array.prototype.push.apply(this,a)):(a.vquery&&(a.parent=this),Array.prototype.push.call(this,a)),this.maxCheck();return this.length},T.fn.root=function(){var a=this;while(a&&a.parent&&(a=a.parent));return a},T.fn.toTreeString=function(){function c(d){var e,f;a.push(Array(b).join(" |")+" +"+d.mode+" "+(d.tagName||"")),b+=1,e=d.slice();while(f=e.shift())f.vquery===T.fn.vquery?c(f):a.push(Array(b).join(" |")+" "+(f?f.toString().replace(/(\r|\n)/g,""):"[empty]"));b-=1,a.push(Array(b).join(" |")+" -"+d.mode+" "+(d.tagName||""))}var a=[],b=1;c(this);return a.join("\n")},T.fn.maxCheck=function(a){if(this.length>=T.maxSize){var b=new Error;b.message="Maximum number of elements exceeded.\nThis is typically caused by an unmatched character or tag. Parse tree follows:\n"+this.toTreeString(),b.name="vQueryDepthException";throw b}},T.maxSize=1e3,T.fn.flatten=function(){var a;return this.reduce(function b(c,d,e,f){if(d.vquery){c.push({type:"META",val:"START"+d.mode,tagName:d.tagName}),a=d.reduce(b,c),a.push({type:"META",val:"END"+d.mode,tagName:d.tagName});return a}d.mode=f.mode,c.push(d);return c},[])},T.reconstitute=function(a){return a.reduce(function b(a,b,c,d){b.type==="META"?a=a.parent:(b.mode!==a.mode&&(a=a.beget(b.mode,b.tagName)),a.push(b));return a},T(V))},T.isArray=function(a){return Object.prototype.toString.call(a)=="[object Array]"},T.extend=function(a){var b,c,d;for(c=1;c<arguments.length;c++){b=arguments[c];for(d in b)a[d]=b[d]}return a},T.takeMethodsFromArray=function(){var a=["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice","indexOf","lastIndexOf","filter","forEach","every","map","some","reduce","reduceRight"],b=[],c;for(var d=0;d<a.length;d++){c=a[d];if(typeof b[c]=="function")T.fn[c]||function(a){T.fn[a]=function(){return b[a].apply(this,Array.prototype.slice.call(arguments,0))}}(c);else throw new Error("Vash requires ES5 array iteration methods, missing: "+c)}},T.takeMethodsFromArray();var V="PROGRAM",W="MARKUP",X="BLOCK",Y="EXPRESSION";U.prototype={parse:function(){var a,b,c,d;while(this.prevTokens.push(a),a=this.tokens.pop()){this.options.debugParser&&console.log(this.ast&&this.ast.mode,a.type,a.toString(),a.val);if(this.ast.mode===V||this.ast.mode===null)this.ast=this.ast.beget(this.options.initialMode||W),this.options.initialMode===Y&&(this.ast=this.ast.beget(Y));if(this.ast.mode===W){this.handleMKP(a);continue}if(this.ast.mode===X){this.handleBLK(a);continue}if(this.ast.mode===Y){this.handleEXP(a);continue}}this.ast=this.ast.root(),this.options.debugParser&&!this.options.initialMode&&(console.log(this.ast.toString()),console.log(this.ast.toTreeString()));return this.ast},exceptionFactory:function(a,b,c){b=="UNMATCHED"&&(a.name="UnmatchedCharacterError",this.ast=this.ast.root(),c&&(a.message="Unmatched "+c.type+" at line "+c.line+", character "+c.chr+". Value: "+c.val+"\n "+this.ast.toTreeString(),a.lineNumber=c.line));return a},advanceUntilNot:function(a){var b,c,d=[];while(c=this.tokens[this.tokens.length-1])if(c.type===a)b=this.tokens.pop(),d.push(b);else break;return d},advanceUntilMatched:function(a,b,c,d,e){var f=a,g=null,h=0,i=0,j=[];while(f){f.type===b?g&&g.type!==d&&b!==c||!g?h++:b===c&&g.type!==d&&i++:f.type===c&&(i++,g&&g.type===e&&i--),j.push(f);if(h===i)break;g=f,f=this.tokens.pop();if(!f)throw this.exceptionFactory(new Error,"UNMATCHED",a)}return j.reverse()},subParse:function(a,b,c){var d,e,f,g=T.extend({},this.options);g.initialMode=b,d=this.advanceUntilMatched(a,a.type,Q[a.type],null,j),d.pop(),e=d.shift(),c||this.ast.push(a),f=new U(d,g),f.parse(),c&&(f.ast[0].unshift(a),f.ast[0].push(e)),this.ast.pushFlatten(f.ast),c||this.ast.push(e)},handleMKP:function(a){var b=this.tokens[this.tokens.length-1],c=this.tokens[this.tokens.length-2],d=null,e;switch(a.type){case n:this.advanceUntilMatched(a,n,m,j,j);break;case j:if(b){this.options.saveAT&&this.ast.push(a);switch(b.type){case K:case D:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(Y);break;case E:case w:case q:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(X);break;case j:case l:b.type="CONTENT",this.ast.push(this.tokens.pop());break;default:this.ast.push(this.tokens.pop())}}break;case O:case A:case B:d=a.val.match(/^<([^\/ >]+)/i),d===null&&b&&b.type===j&&c&&(d=c.val.match(/(.*)/)),this.ast.tagName?this.ast=this.ast.beget(W,d[1]):this.ast.tagName=d[1],a.type===B&&(this.ast.tagVoid=this.ast.tagName),(B===a.type||A===a.type||this.options.saveTextTag)&&this.ast.push(a);break;case N:case z:d=a.val.match(/^<\/([^>]+)/i),d===null&&b&&b.type===j&&c&&(d=c.val.match(/(.*)/)),e=this.ast.closest(W,d[1]),e!==null&&e.tagName===d[1]&&(this.ast=e),(z===a.type||this.options.saveTextTag)&&this.ast.push(a),this.ast.parent&&this.ast.parent.mode===X&&(this.ast=this.ast.parent);break;case C:this.ast.tagVoid?(this.ast.push(a),this.ast=this.ast.parent):this.tokens.push(a);break;case o:a.val+="\\",this.ast.push(a);break;default:this.ast.push(a)}},handleBLK:function(a){var b=this.tokens[this.tokens.length-1],c,d,e,f,g,h,i;switch(a.type){case j:b.type!==j&&(this.tokens.push(a),this.ast=this.ast.beget(W));break;case n:this.advanceUntilMatched(a,n,m,j,j);break;case l:this.subParse(a,W,!0);break;case O:case N:case B:case A:case z:this.ast=this.ast.beget(W),this.tokens.push(a);break;case q:case K:c=this.options.favorText&&a.type===q?W:X,this.subParse(a,c),f=this.advanceUntilNot(P),b=this.tokens[this.tokens.length-1],b&&b.type!==E&&b.type!==w&&b.type!==q&&a.type!==K?(this.tokens.push.apply(this.tokens,f.reverse()),this.ast=this.ast.parent):this.ast.push(f);break;default:this.ast.push(a)}},handleEXP:function(a){var b=null,c,d,e,f,g,h,i;switch(a.type){case E:case w:this.ast=this.ast.beget(X),this.tokens.push(a);break;case P:case F:case k:case I:case H:this.ast.parent&&this.ast.parent.mode===Y?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;case D:this.ast.push(a);break;case M:case s:this.ast.parent&&this.ast.parent.mode===Y?(g=this.advanceUntilMatched(a,a.type,Q[a.type],o,o),this.ast.pushFlatten(g.reverse())):(this.ast=this.ast.parent,this.tokens.push(a));break;case y:case K:h=this.prevTokens[this.prevTokens.length-1],b=this.tokens[this.tokens.length-1];if(a.type===y&&b.type===x){this.tokens.push(a),this.ast=this.ast.parent;break}this.subParse(a,Y),b=this.tokens[this.tokens.length-1];if(h&&h.type===j||b&&b.type===D)this.ast=this.ast.parent;break;case q:this.tokens.push(a),this.ast=this.ast.beget(X);break;case v:this.tokens.push(a),this.ast=this.ast.beget(X);break;case L:b=this.tokens[this.tokens.length-1],b&&(b.type===D||b.type===E||b.type===w||b.type===L||this.ast.parent&&this.ast.parent.mode===Y)?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;default:this.ast.parent&&this.ast.parent.mode!==Y?(this.ast=this.ast.parent,this.tokens.push(a)):this.ast.push(a)}}};var $=Z.prototype;$.insertDebugVars=function(a){this.options.debug&&this.buffer.push(this.options.helpersName+".vl = "+a.line+", ",this.options.helpersName+".vc = "+a.chr+"; \n")},$.visitMarkupTok=function(a,b,c){this.insertDebugVars(a),this.buffer.push("MKP("+a.val.replace(this.reEscapedQuote,"\\\\$1").replace(this.reQuote,"\\$1").replace(this.reLineBreak,"\\n")+")MKP")},$.visitBlockTok=function(a,b,c){this.buffer.push(a.val)},$.visitExpressionTok=function(a,b,c,d){var e="",f="",g=b.parent&&b.parent.mode!==Y;this.options.htmlEscape!==!1&&(g&&c===0&&d&&(e+=this.options.helpersName+".escape("),g&&c===b.length-1&&d&&(f+=").toHtmlString()")),g&&c===0&&(this.insertDebugVars(a),e="__vbuffer.push("+e),g&&c===b.length-1&&(f+="); \n"),this.buffer.push(e+a.val+f),g&&c===b.length-1&&this.insertDebugVars(a)},$.visitNode=function(a){var b,c=a.slice(0),d,e,f;a.mode===Y&&a.parent&&a.parent.mode!==Y&&(d=a.filter(Z.findNonExp).length);for(e=0;e<c.length;e++){f=c[e];if(f.type&&f.type===j||f.type===l)continue;f.vquery?this.visitNode(f):a.mode===W?this.visitMarkupTok(f,a,e):a.mode===X?this.visitBlockTok(f,a,e):a.mode===Y&&this.visitExpressionTok(f,a,e,d>0?!1:!0)}},$.escapeForDebug=function(a){return a.replace(this.reLineBreak,"!LB!").replace(this.reQuote,"\\$1").replace(this.reEscapedQuote,"\\$1")},$.replaceDevTokens=function(a){return a.replace(this.reHelpersName,this.options.helpersName).replace(this.reModelName,this.options.modelName)},$.addHead=function(a){var b=this.options,c=""+(b.debug?"try { \n":"")+"var __vbuffer = HELPERSNAME.buffer; \n"+"HELPERSNAME.options = __vopts; \n"+"MODELNAME = MODELNAME || {}; \n"+(b.useWith?"with( MODELNAME ){ \n":"");c=this.replaceDevTokens(c);return c+a},$.addHelperHead=function(a){var b=this.options,c=""+(b.debug?"try { \n":"")+"var __vbuffer = this.buffer; \n"+"var MODELNAME = this.model; \n"+"var HELPERSNAME = this; \n";c=this.replaceDevTokens(c);return c+a},$.addFoot=function(a){var b=this.options,c=""+(b.simple?'return HELPERSNAME.buffer.join(""); \n':"(__vopts && __vopts.onRenderEnd && __vopts.onRenderEnd(null, HELPERSNAME)); \nreturn (__vopts && __vopts.asContext) \n ? HELPERSNAME \n : HELPERSNAME.toString(); \n")+(b.useWith?"} \n":"")+(b.debug?'} catch( e ){ \n HELPERSNAME.reportError( e, HELPERSNAME.vl, HELPERSNAME.vc, "ORIGINALMARKUP" ); \n} \n':"");c=this.replaceDevTokens(c).replace(this.reOriginalMarkup,this.escapeForDebug(this.originalMarkup));return a+c},$.addHelperFoot=function(a){var b=this.options,c=""+(b.debug?'} catch( e ){ \n HELPERSNAME.reportError( e, HELPERSNAME.vl, HELPERSNAME.vc, "ORIGINALMARKUP" ); \n} \n':"");c=this.replaceDevTokens(c).replace(this.reOriginalMarkup,this.escapeForDebug(this.originalMarkup));return a+c},$.generate=function(){var a=this.options;this.buffer.length=0,this.visitNode(this.ast);var c=this.buffer.join("").split(")MKPMKP(").join("").split("MKP(").join("__vbuffer.push('").split(")MKP").join("'); \n");a.asHelper?(c=this.addHelperHead(c),c=this.addHelperFoot(c)):(c=this.addHead(c),c=this.addFoot(c)),a.debugCompiler&&(console.log(c),console.log(a)),this.cmpFunc=b.link(c,a);return this.cmpFunc},Z.noop=function(){},Z.findNonExp=function(a){return a.vquery&&a.mode===Y?a.filter(Z.findNonExp).length>0:a.vquery&&a.mode!==Y?!0:!1},a.VLexer=S,a.VParser=U,a.VCompiler=Z,a.vQuery=T;return a}({}))
View
4 package.json
@@ -1,7 +1,7 @@
{
"name": "vash",
"description": "Razor syntax for JS templating",
- "version": "0.6.2-2481",
+ "version": "0.6.2-2482",
"author": "Andrew Petersen <senofpeter@gmail.com>",
"homepage": "https://github.com/kirbysayshi/vash",
"bin": {
@@ -32,4 +32,4 @@
"request": "2.9",
"jshint": "0.8.0"
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.