Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

vash

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vash - npm Package Compare versions

Comparing version 0.5.3-1272 to 0.5.3-1292

LICENSE

10

build/vash-runtime-all.js
/**
* Vash - JavaScript Template Parser, v0.5.3-1272
* Vash - JavaScript Template Parser, v0.5.3-1292
*

@@ -213,3 +213,4 @@ * https://github.com/kirbysayshi/vash

if( typeof window === 'undefined' ){
var fs = require('fs')
var fs = require('fs')
,path = require('path')
}

@@ -249,3 +250,2 @@

// this is pretty hacky, probably won't work in browser
if( !browser && options.settings && options.settings.views && options.settings['view engine'] ){

@@ -256,3 +256,5 @@ filepath = filepath.indexOf(options.settings.views) > -1

+ '/' + filepath
+ '.' + options.settings['view engine'];
+ ( path.extname(filepath)
? ''
: '.' + options.settings['view engine'] );
}

@@ -259,0 +261,0 @@

4

build/vash-runtime-all.min.js
/**
* Vash - JavaScript Template Parser, v0.5.3-1272
* Vash - JavaScript Template Parser, v0.5.3-1292
*

@@ -10,2 +10,2 @@ * https://github.com/kirbysayshi/vash

(function(){vash=typeof vash=="undefined"?typeof window!="undefined"?window.vash=window.vash||{}:typeof module!="undefined"&&module.exports?exports={}:{}:vash;var a=vash.helpers=vash.helpers||{};vash.helpers.config={};var b=/[&<>"'`]/g,c=function(a){return d[a]},d={"&":"&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 d=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(b,c);return{toHtmlString:d,toString:d}}return a},a.buffer=function(){var a=a;return{mark:function(){return a.__vo.length},empty:function(){return a.__vo.splice(0,a.__vo.length)},fromMark:function(b){return a.__vo.splice(b,a.__vo.length)},push:function(b){b instanceof Array?a.__vo.push.apply(a.__vo,b):arguments.length>1?a.__vo.push.apply(a.__vo,Array.prototype.slice.call(arguments)):a.__vo.push(b)}}}(),a.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+" | "+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}})(),function(){var a=vash.helpers;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");var b=vash.helpers;b.config.browser=!1,b.tplcache={},b.blocks={},b.appends=[],b.prepends=[],vash.loadFile=function(c,d,e){d=vQuery.extend({},vash.config,d||{});var f=b.config.browser,g;!f&&d.settings&&d.settings.views&&d.settings["view engine"]&&(c=c.indexOf(d.settings.views)>-1?c:d.settings.views+"/"+c+"."+d.settings["view engine"]),g=d.cache||f?b.tplcache[c]||(b.tplcache[c]=vash.compile(a.readFileSync(c,"utf8"))):vash.compile(a.readFileSync(c,"utf8")),e&&e(null,g)},vash.renderFile=function(a,b,c){vash.loadFile(a,b,function(a,d){c(a,d(b))})},b.extends=function(a,b){var c=this,d=this.model;vash.loadFile(a,this.model,function(a,d){b(c.model),d(c.model)}),this.model=d},b.include=function(a,b){var c=this,d=this.model;vash.loadFile(a,this.model,function(a,d){d(b||c.model)}),this.model=d},b.block=function(a,b){var c,d,e=this;b||(this.hasPrepends(a)&&(this.prepends[a].forEach(function(a){a(e.model)}),this.prepends[a].length=0),this.hasBlock(a)&&(this.blocks[a](this.model),delete this.blocks[a]),this.hasAppends(a)&&(this.appends[a].forEach(function(a){a(e.model)}),this.appends[a].length=0)),b&&(this.blocks[a]=b)},b.append=function(a,b){this.appends[a]||(this.appends[a]=[]),this.appends[a].push(b)},b.prepend=function(a,b){this.prepends[a]||(this.prepends[a]=[]),this.prepends[a].push(b)},b.hasBlock=function(a){return typeof this.blocks[a]!="undefined"},b.hasPrepends=function(a){return this.prepends[a]&&this.prepends[a].length>0},b.hasAppends=function(a){return this.appends[a]&&this.appends[a].length>0}}()
(function(){vash=typeof vash=="undefined"?typeof window!="undefined"?window.vash=window.vash||{}:typeof module!="undefined"&&module.exports?exports={}:{}:vash;var a=vash.helpers=vash.helpers||{};vash.helpers.config={};var b=/[&<>"'`]/g,c=function(a){return d[a]},d={"&":"&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 d=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(b,c);return{toHtmlString:d,toString:d}}return a},a.buffer=function(){var a=a;return{mark:function(){return a.__vo.length},empty:function(){return a.__vo.splice(0,a.__vo.length)},fromMark:function(b){return a.__vo.splice(b,a.__vo.length)},push:function(b){b instanceof Array?a.__vo.push.apply(a.__vo,b):arguments.length>1?a.__vo.push.apply(a.__vo,Array.prototype.slice.call(arguments)):a.__vo.push(b)}}}(),a.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+" | "+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}})(),function(){var a=vash.helpers;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"),b=require("path");var c=vash.helpers;c.config.browser=!1,c.tplcache={},c.blocks={},c.appends=[],c.prepends=[],vash.loadFile=function(d,e,f){e=vQuery.extend({},vash.config,e||{});var g=c.config.browser,h;!g&&e.settings&&e.settings.views&&e.settings["view engine"]&&(d=d.indexOf(e.settings.views)>-1?d:e.settings.views+"/"+d+(b.extname(d)?"":"."+e.settings["view engine"])),h=e.cache||g?c.tplcache[d]||(c.tplcache[d]=vash.compile(a.readFileSync(d,"utf8"))):vash.compile(a.readFileSync(d,"utf8")),f&&f(null,h)},vash.renderFile=function(a,b,c){vash.loadFile(a,b,function(a,d){c(a,d(b))})},c.extends=function(a,b){var c=this,d=this.model;vash.loadFile(a,this.model,function(a,d){b(c.model),d(c.model)}),this.model=d},c.include=function(a,b){var c=this,d=this.model;vash.loadFile(a,this.model,function(a,d){d(b||c.model)}),this.model=d},c.block=function(a,b){var c,d,e=this;b||(this.hasPrepends(a)&&(this.prepends[a].forEach(function(a){a(e.model)}),this.prepends[a].length=0),this.hasBlock(a)&&(this.blocks[a](this.model),delete this.blocks[a]),this.hasAppends(a)&&(this.appends[a].forEach(function(a){a(e.model)}),this.appends[a].length=0)),b&&(this.blocks[a]=b)},c.append=function(a,b){this.appends[a]||(this.appends[a]=[]),this.appends[a].push(b)},c.prepend=function(a,b){this.prepends[a]||(this.prepends[a]=[]),this.prepends[a].push(b)},c.hasBlock=function(a){return typeof this.blocks[a]!="undefined"},c.hasPrepends=function(a){return this.prepends[a]&&this.prepends[a].length>0},c.hasAppends=function(a){return this.appends[a]&&this.appends[a].length>0}}()
/**
* Vash - JavaScript Template Parser, v0.5.3-1272
* Vash - JavaScript Template Parser, v0.5.3-1292
*

@@ -4,0 +4,0 @@ * https://github.com/kirbysayshi/vash

/**
* Vash - JavaScript Template Parser, v0.5.3-1272
* Vash - JavaScript Template Parser, v0.5.3-1292
*

@@ -4,0 +4,0 @@ * https://github.com/kirbysayshi/vash

/**
* Vash - JavaScript Template Parser, v0.5.3-1272
* Vash - JavaScript Template Parser, v0.5.3-1292
*

@@ -29,3 +29,3 @@ * https://github.com/kirbysayshi/vash

exports["version"] = "0.5.3-1272";
exports["version"] = "0.5.3-1292";
exports["config"] = {

@@ -250,3 +250,4 @@ "useWith": false

if( typeof window === 'undefined' ){
var fs = require('fs')
var fs = require('fs')
,path = require('path')
}

@@ -286,3 +287,2 @@

// this is pretty hacky, probably won't work in browser
if( !browser && options.settings && options.settings.views && options.settings['view engine'] ){

@@ -293,3 +293,5 @@ filepath = filepath.indexOf(options.settings.views) > -1

+ '/' + filepath
+ '.' + options.settings['view engine'];
+ ( path.extname(filepath)
? ''
: '.' + options.settings['view engine'] );
}

@@ -296,0 +298,0 @@

/**
* Vash - JavaScript Template Parser, v0.5.3-1272
* Vash - JavaScript Template Parser, v0.5.3-1292
*

@@ -10,2 +10,2 @@ * https://github.com/kirbysayshi/vash

(function(a){typeof define=="function"&&define.amd?define(a):typeof module=="object"&&module.exports?module.exports=a:window.vash=a})(function(a){function Q(a,b){this.ast=a,this.originalMarkup=b||""}function L(a,b){this.options=b||{},this.tokens=a,this.ast=K(M),this.prevTokens=[]}function J(a){this.input=this.originalInput=a.replace(/\r\n|\r/g,"\n"),this.lineno=1,this.charno=0}var b=a;a.version="0.5.3-1272",a.config={useWith:!1,modelName:"model",helpersName:"html",htmlEscape:!0,debug:!0,debugParser:!1,debugCompiler:!1,favorText:!1,saveTextTag:!1,saveAT:!1},function(){b=typeof b=="undefined"?typeof window!="undefined"?window.vash=window.vash||{}:typeof module!="undefined"&&module.exports?a={}:{}:b;var c=b.helpers=b.helpers||{};b.helpers.config={};var d=/[&<>"'`]/g,e=function(a){return f[a]},f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};c.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},c.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},c.buffer=function(){var a=a;return{mark:function(){return a.__vo.length},empty:function(){return a.__vo.splice(0,a.__vo.length)},fromMark:function(b){return a.__vo.splice(b,a.__vo.length)},push:function(b){b instanceof Array?a.__vo.push.apply(a.__vo,b):arguments.length>1?a.__vo.push.apply(a.__vo,Array.prototype.slice.call(arguments)):a.__vo.push(b)}}}(),c.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+" | "+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}}(),function(){var a=b.helpers;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");var c=b.helpers;c.config.browser=!1,c.tplcache={},c.blocks={},c.appends=[],c.prepends=[],b.loadFile=function(d,e,f){e=K.extend({},b.config,e||{});var g=c.config.browser,h;!g&&e.settings&&e.settings.views&&e.settings["view engine"]&&(d=d.indexOf(e.settings.views)>-1?d:e.settings.views+"/"+d+"."+e.settings["view engine"]),h=e.cache||g?c.tplcache[d]||(c.tplcache[d]=b.compile(a.readFileSync(d,"utf8"))):b.compile(a.readFileSync(d,"utf8")),f&&f(null,h)},b.renderFile=function(a,c,d){b.loadFile(a,c,function(a,b){d(a,b(c))})},c.extends=function(a,c){var d=this,e=this.model;b.loadFile(a,this.model,function(a,b){c(d.model),b(d.model)}),this.model=e},c.include=function(a,c){var d=this,e=this.model;b.loadFile(a,this.model,function(a,b){b(c||d.model)}),this.model=e},c.block=function(a,b){var c,d,e=this;b||(this.hasPrepends(a)&&(this.prepends[a].forEach(function(a){a(e.model)}),this.prepends[a].length=0),this.hasBlock(a)&&(this.blocks[a](this.model),delete this.blocks[a]),this.hasAppends(a)&&(this.appends[a].forEach(function(a){a(e.model)}),this.appends[a].length=0)),b&&(this.blocks[a]=b)},c.append=function(a,b){this.appends[a]||(this.appends[a]=[]),this.appends[a].push(b)},c.prepend=function(a,b){this.prepends[a]||(this.prepends[a]=[]),this.prepends[a].push(b)},c.hasBlock=function(a){return typeof this.blocks[a]!="undefined"},c.hasPrepends=function(a){return this.prepends[a]&&this.prepends[a].length>0},c.hasAppends=function(a){return this.appends[a]&&this.appends[a].length>0}}(),a.__express=a.renderFile;var c="AT",d="ASSIGN_OPERATOR",e="AT_COLON",f="AT_STAR_CLOSE",g="AT_STAR_OPEN",h="BACKSLASH",i="BRACE_CLOSE",j="BRACE_OPEN",k="CONTENT",l="DOUBLE_QUOTE",m="EMAIL",n="FAT_ARROW",o="FUNCTION",p="HARD_PAREN_CLOSE",q="HARD_PAREN_OPEN",r="HTML_TAG_CLOSE",s="HTML_TAG_OPEN",t="HTML_TAG_SELFCLOSE",u="IDENTIFIER",v="KEYWORD",w="LOGICAL",x="NEWLINE",y="NUMERIC_CONTENT",z="OPERATOR",A="PAREN_CLOSE",B="PAREN_OPEN",C="PERIOD",D="SINGLE_QUOTE",E="TEXT_TAG_CLOSE",F="TEXT_TAG_OPEN",G="WHITESPACE",H={};H[g]=f,H[j]=i,H[l]=l,H[q]=p,H[B]=A,H[D]=D,H[e]=x;var I=[m,/^([a-zA-Z0-9._%\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4})\b/,g,/^(@\*)/,f,/^(\*@)/,e,/^@\:/,c,/^(@)/,n,/^(\(.*?\)?\s*?=>)/,B,/^(\()/,A,/^(\))/,q,/^(\[)/,p,/^(\])/,j,/^(\{)/,i,/^(\})/,F,/^(<text>)/,E,/^(<\/text>)/,t,/^(<[^@>]+?\/>)/,s,function(){return this.spewIf(this.scan(/^(<[^\/ >]+?[^>]*?>)/,s),"@")},r,/^(<\/[^>@\b]+?>)/,C,/^(\.)/,x,function(){var a=this.scan(/^(\n)/,x);a&&(this.lineno++,this.charno=0);return a},G,/^(\s)/,o,/^(function)(?![\d\w])/,v,/^(case|catch|do|else|finally|for|function|goto|if|instanceof|return|switch|try|typeof|var|while|with)(?![\d\w])/,u,/^([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)/,z,/^(===|!==|==|!==|>>>|<<|>>|>=|<=|>|<|\+|-|\/|\*|\^|%|\:|\?)/,d,/^(\|=|\^=|&=|>>>=|>>=|<<=|-=|\+=|%=|\/=|\*=|=)/,w,/^(&&|\|\||&|\||\^)/,h,/^(\\)/,l,/^(\")/,D,/^(\')/,y,/^([0-9]+)/,k,/^([^\s})@.]+?)/];J.prototype={scan:function(a,b){var c,d;if(c=a.exec(this.input)){this.input=this.input.substr(c[0].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;a&&(c=a.val.split(b),c.length>1&&(a.val=c.shift(),d=b+c.join(b),this.input=d+this.input,this.charno-=d.length));return a},advance:function(){var a,b,c,d;for(a=0;a<I.length;a+=2){c=I[a+1],c.displayName=I[a],typeof c=="function"&&(d=c.call(this)),typeof c.exec=="function"&&(d=this.scan(c,I[a]));if(d)return d}}};var K=function(a){return new K.fn.init(a)};K.prototype.init=function(a){typeof a=="string"&&(this.mode=a),this.maxCheck()},K.fn=K.prototype.init.prototype=K.prototype,K.fn.vquery="yep",K.fn.constructor=K,K.fn.length=0,K.fn.parent=null,K.fn.mode=null,K.fn.tagName=null,K.fn.beget=function(a,b){var c=K(a);c.parent=this,this.push(c),b&&(c.tagName=b),this.maxCheck();return c},K.fn.closest=function(a,b){var c=this;while(c)if(c.tagName!==b&&c.parent)c=c.parent;else break;return c},K.fn.pushFlatten=function(a){var b=a,c,d;while(b.length===1&&b[0].vquery)b=b[0];if(b.mode!==M)this.push(b);else for(c=0;c<b.length;c++)this.push(b[c]);this.maxCheck();return this},K.fn.push=function(a){K.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},K.fn.root=function(){var a=this;while(a&&a.parent&&(a=a.parent));return a},K.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===K.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")},K.fn.maxCheck=function(a){if(this.length>=K.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}},K.maxSize=1e3,K.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},[])},K.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},K(M))},K.isArray=function(a){return Object.prototype.toString.call(a)=="[object Array]"},K.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},K.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")K.fn[c]||function(a){K.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)}},K.takeMethodsFromArray();var M="PROGRAM",N="MARKUP",O="BLOCK",P="EXPRESSION";L.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,a.val);if(this.ast.mode===M||this.ast.mode===null)this.ast=this.ast.beget(this.options.initialMode||N),this.options.initialMode===P&&(this.ast=this.ast.beget(P));if(this.ast.mode===N){this.handleMKP(a);continue}if(this.ast.mode===O){this.handleBLK(a);continue}if(this.ast.mode===P){this.handleEXP(a);continue}}this.ast=this.ast.root(),this.options.debugParser&&!this.options.initialMode&&(console.log(this.ast),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,d){var e,f,g,h=K.extend({},this.options);h.initialMode=b,e=this.advanceUntilMatched(a,a.type,H[a.type],null,c),e.pop(),f=e.shift(),d||this.ast.push(a),g=new L(e,h),g.parse(),d&&(g.ast[0].unshift(a),g.ast[0].push(f)),this.ast.pushFlatten(g.ast),d||this.ast.push(f)},handleMKP:function(a){var b=this.tokens[this.tokens.length-1],d=this.tokens[this.tokens.length-2],e=null,h;switch(a.type){case g:this.advanceUntilMatched(a,g,f,c,c);break;case c:if(b)switch(b.type){case B:case u:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(P),this.options.saveAT&&this.ast.push(a);break;case v:case o:case j:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(O),this.options.saveAT&&this.ast.push(a);break;default:this.options.saveAT&&this.ast.push(a),this.ast.push(this.tokens.pop())}break;case F:case s:e=a.val.match(/^<([^\/ >]+)/i),e===null&&b&&b.type===c&&d&&(e=d.val.match(/(.*)/)),this.ast.tagName?this.ast=this.ast.beget(N,e[1]):this.ast.tagName=e[1],(s===a.type||this.options.saveTextTag)&&this.ast.push(a);break;case E:case r:e=a.val.match(/^<\/([^>]+)/i),e===null&&b&&b.type===c&&d&&(e=d.val.match(/(.*)/)),h=this.ast.closest(N,e[1]),h!==null&&h.tagName===e[1]&&(this.ast=h),(r===a.type||this.options.saveTextTag)&&this.ast.push(a),this.ast.parent&&this.ast.parent.mode===O&&b&&(b.type===G||b.type===x)&&(this.ast=this.ast.parent);break;case t:this.ast.push(a),this.ast.parent&&this.ast.parent.mode===O&&b&&(b.type===G||b.type===x)&&(this.ast=this.ast.parent);break;default:this.ast.push(a)}},handleBLK:function(a){var b=this.tokens[this.tokens.length-1],d,h,i,k,l,m,n;switch(a.type){case c:b.type!==c&&(this.tokens.push(a),this.ast=this.ast.beget(N));break;case g:this.advanceUntilMatched(a,g,f,c,c);break;case e:this.subParse(a,N,!0);break;case F:case E:case t:case s:case r:this.ast=this.ast.beget(N),this.tokens.push(a);break;case j:case B:d=this.options.favorText&&a.type===j?N:O,this.subParse(a,d),k=this.advanceUntilNot(G),b=this.tokens[this.tokens.length-1],b&&b.type!==v&&b.type!==o&&b.type!==j&&a.type!==B?(this.tokens.push.apply(this.tokens,k.reverse()),this.ast=this.ast.parent):this.ast.push(k);break;case G:this.ast.push(a),this.advanceUntilNot(G);break;default:this.ast.push(a)}},handleEXP:function(a){var b=null,e,f,g,i,k,m,r;switch(a.type){case v:case o:this.ast=this.ast.beget(O),this.tokens.push(a);break;case G:case w:case d:case z:case y:this.ast.parent&&this.ast.parent.mode===P?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;case u:this.ast.push(a);break;case D:case l:this.ast.parent&&this.ast.parent.mode===P?(k=this.advanceUntilMatched(a,a.type,H[a.type],h,h),this.ast.pushFlatten(k.reverse())):(this.ast=this.ast.parent,this.tokens.push(a));break;case q:case B:m=this.prevTokens[this.prevTokens.length-1],b=this.tokens[this.tokens.length-1];if(a.type===q&&b.type===p){this.tokens.push(a),this.ast=this.ast.parent;break}this.subParse(a,P),b=this.tokens[this.tokens.length-1];if(m&&m.type===c||b&&b.type===u)this.ast=this.ast.parent;break;case j:this.tokens.push(a),this.ast=this.ast.beget(O);break;case n:this.tokens.push(a),this.ast=this.ast.beget(O);break;case C:b=this.tokens[this.tokens.length-1],!b||b.type!==u&&b.type!==v&&b.type!==o&&b.type!==C?(this.ast=this.ast.parent,this.tokens.push(a)):this.ast.push(a);break;default:this.ast.parent&&this.ast.parent.mode!==P?(this.ast=this.ast.parent,this.tokens.push(a)):this.ast.push(a)}}};var R=Q.prototype;R.assemble=function(a,c){function r(a){return a.vquery&&a.mode===P?a.filter(r).length>0:a.vquery&&a.mode!==P?!0:!1}function q(a){var b,c=a.slice(0),d,e,f;a.mode===P&&a.parent&&a.parent.mode!==P&&(d=a.filter(r).length);for(e=0;e<c.length;e++)f=c[e],f.vquery?q(f):a.mode===N?n(f,a,e):a.mode===O?o(f,a,e):a.mode===P&&p(f,a,e,d>0?!1:!0)}function p(b,c,e,f){var g="",h="",i=c.parent&&c.parent.mode!==P;a.htmlEscape!==!1&&(i&&e===0&&f&&(g+=a.helpersName+".escape("),i&&e===c.length-1&&f&&(h+=").toHtmlString()")),i&&e===0&&(m(b),g="__vo.push("+g),i&&e===c.length-1&&(h+="); \n"),d.push(g+b.val+h),i&&e===c.length-1&&m(b)}function o(a,b,c){d.push(a.val)}function n(a,b,c){m(a),d.push("MKP('"+a.val.replace(f,"\\$1").replace(h,"\\n")+"')MKP")}function m(b){a.debug&&d.push(a.helpersName+".__vl = __vl = "+b.line+", ",a.helpersName+".__vc = __vc = "+b.chr+"; \n")}a=a||{},c=c||{};var d=[],e=[],f=/(["'])/gi,g=/\\+(["'])/gi,h=/[\n\r]/gi,i,j,k,l=[];d.push(a.helpersName+" = "+a.helpersName+" || vash.helpers; \n"),d.push(a.helpersName+".__vo = "+a.helpersName+".__vo || []; \n"),d.push("var __vo = "+a.helpersName+".__vo; \n"),d.push(a.helpersName+".model = "+a.modelName+"; \n"),a.debug&&d.push("var __vl = "+a.helpersName+".__vl = 0,","__vc = "+a.helpersName+".__vc = 0; \n"),q(this.ast),a.useWith===!0&&(d.unshift("with("+a.modelName+" || {}){ \n"),d.push("}")),a.debug&&(d.unshift("try { \n"),d.push("} catch(e){ ",a.helpersName+".reportError","(e, __vl, __vc, ",'"'+this.originalMarkup.replace(h,"!LB!").replace(f,"\\$1").replace(g,"\\$1")+'"',") } \n")),d.push("delete "+a.helpersName+".__vo; \n"),a.debug&&(d.push("delete "+a.helpersName+".__vl \n"),d.push("delete "+a.helpersName+".__vc \n")),d.push("return __vo.join(''); \n"),i=d.join(""),i=i.split("')MKPMKP('").join("").split("MKP(").join("__vo.push(").split(")MKP").join("); \n"),a.debugCompiler&&console.log(i);try{j=new Function(a.modelName,a.helpersName,i)}catch(s){b.helpers.reportError(s,0,0,i,/\n/)}k=function(a){return j(a,c)},k.toString=function(){return j.toString()};return k},a.VLexer=J,a.VParser=L,a.VCompiler=Q,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=K.extend({},a.config,c||{}),d=new J(b);while(e=d.advance())f.push(e);f.reverse(),g=new L(f,c),g.parse(),h=new Q(g.ast,b),i=h.assemble(c,a.helpers),i.displayName="render";return i};return a}({}))
(function(a){typeof define=="function"&&define.amd?define(a):typeof module=="object"&&module.exports?module.exports=a:window.vash=a})(function(a){function Q(a,b){this.ast=a,this.originalMarkup=b||""}function L(a,b){this.options=b||{},this.tokens=a,this.ast=K(M),this.prevTokens=[]}function J(a){this.input=this.originalInput=a.replace(/\r\n|\r/g,"\n"),this.lineno=1,this.charno=0}var b=a;a.version="0.5.3-1292",a.config={useWith:!1,modelName:"model",helpersName:"html",htmlEscape:!0,debug:!0,debugParser:!1,debugCompiler:!1,favorText:!1,saveTextTag:!1,saveAT:!1},function(){b=typeof b=="undefined"?typeof window!="undefined"?window.vash=window.vash||{}:typeof module!="undefined"&&module.exports?a={}:{}:b;var c=b.helpers=b.helpers||{};b.helpers.config={};var d=/[&<>"'`]/g,e=function(a){return f[a]},f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};c.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},c.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},c.buffer=function(){var a=a;return{mark:function(){return a.__vo.length},empty:function(){return a.__vo.splice(0,a.__vo.length)},fromMark:function(b){return a.__vo.splice(b,a.__vo.length)},push:function(b){b instanceof Array?a.__vo.push.apply(a.__vo,b):arguments.length>1?a.__vo.push.apply(a.__vo,Array.prototype.slice.call(arguments)):a.__vo.push(b)}}}(),c.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+" | "+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}}(),function(){var a=b.helpers;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,d.tplcache={},d.blocks={},d.appends=[],d.prepends=[],b.loadFile=function(e,f,g){f=K.extend({},b.config,f||{});var h=d.config.browser,i;!h&&f.settings&&f.settings.views&&f.settings["view engine"]&&(e=e.indexOf(f.settings.views)>-1?e:f.settings.views+"/"+e+(c.extname(e)?"":"."+f.settings["view engine"])),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)},b.renderFile=function(a,c,d){b.loadFile(a,c,function(a,b){d(a,b(c))})},d.extends=function(a,c){var d=this,e=this.model;b.loadFile(a,this.model,function(a,b){c(d.model),b(d.model)}),this.model=e},d.include=function(a,c){var d=this,e=this.model;b.loadFile(a,this.model,function(a,b){b(c||d.model)}),this.model=e},d.block=function(a,b){var c,d,e=this;b||(this.hasPrepends(a)&&(this.prepends[a].forEach(function(a){a(e.model)}),this.prepends[a].length=0),this.hasBlock(a)&&(this.blocks[a](this.model),delete this.blocks[a]),this.hasAppends(a)&&(this.appends[a].forEach(function(a){a(e.model)}),this.appends[a].length=0)),b&&(this.blocks[a]=b)},d.append=function(a,b){this.appends[a]||(this.appends[a]=[]),this.appends[a].push(b)},d.prepend=function(a,b){this.prepends[a]||(this.prepends[a]=[]),this.prepends[a].push(b)},d.hasBlock=function(a){return typeof this.blocks[a]!="undefined"},d.hasPrepends=function(a){return this.prepends[a]&&this.prepends[a].length>0},d.hasAppends=function(a){return this.appends[a]&&this.appends[a].length>0}}(),a.__express=a.renderFile;var c="AT",d="ASSIGN_OPERATOR",e="AT_COLON",f="AT_STAR_CLOSE",g="AT_STAR_OPEN",h="BACKSLASH",i="BRACE_CLOSE",j="BRACE_OPEN",k="CONTENT",l="DOUBLE_QUOTE",m="EMAIL",n="FAT_ARROW",o="FUNCTION",p="HARD_PAREN_CLOSE",q="HARD_PAREN_OPEN",r="HTML_TAG_CLOSE",s="HTML_TAG_OPEN",t="HTML_TAG_SELFCLOSE",u="IDENTIFIER",v="KEYWORD",w="LOGICAL",x="NEWLINE",y="NUMERIC_CONTENT",z="OPERATOR",A="PAREN_CLOSE",B="PAREN_OPEN",C="PERIOD",D="SINGLE_QUOTE",E="TEXT_TAG_CLOSE",F="TEXT_TAG_OPEN",G="WHITESPACE",H={};H[g]=f,H[j]=i,H[l]=l,H[q]=p,H[B]=A,H[D]=D,H[e]=x;var I=[m,/^([a-zA-Z0-9._%\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4})\b/,g,/^(@\*)/,f,/^(\*@)/,e,/^@\:/,c,/^(@)/,n,/^(\(.*?\)?\s*?=>)/,B,/^(\()/,A,/^(\))/,q,/^(\[)/,p,/^(\])/,j,/^(\{)/,i,/^(\})/,F,/^(<text>)/,E,/^(<\/text>)/,t,/^(<[^@>]+?\/>)/,s,function(){return this.spewIf(this.scan(/^(<[^\/ >]+?[^>]*?>)/,s),"@")},r,/^(<\/[^>@\b]+?>)/,C,/^(\.)/,x,function(){var a=this.scan(/^(\n)/,x);a&&(this.lineno++,this.charno=0);return a},G,/^(\s)/,o,/^(function)(?![\d\w])/,v,/^(case|catch|do|else|finally|for|function|goto|if|instanceof|return|switch|try|typeof|var|while|with)(?![\d\w])/,u,/^([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)/,z,/^(===|!==|==|!==|>>>|<<|>>|>=|<=|>|<|\+|-|\/|\*|\^|%|\:|\?)/,d,/^(\|=|\^=|&=|>>>=|>>=|<<=|-=|\+=|%=|\/=|\*=|=)/,w,/^(&&|\|\||&|\||\^)/,h,/^(\\)/,l,/^(\")/,D,/^(\')/,y,/^([0-9]+)/,k,/^([^\s})@.]+?)/];J.prototype={scan:function(a,b){var c,d;if(c=a.exec(this.input)){this.input=this.input.substr(c[0].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;a&&(c=a.val.split(b),c.length>1&&(a.val=c.shift(),d=b+c.join(b),this.input=d+this.input,this.charno-=d.length));return a},advance:function(){var a,b,c,d;for(a=0;a<I.length;a+=2){c=I[a+1],c.displayName=I[a],typeof c=="function"&&(d=c.call(this)),typeof c.exec=="function"&&(d=this.scan(c,I[a]));if(d)return d}}};var K=function(a){return new K.fn.init(a)};K.prototype.init=function(a){typeof a=="string"&&(this.mode=a),this.maxCheck()},K.fn=K.prototype.init.prototype=K.prototype,K.fn.vquery="yep",K.fn.constructor=K,K.fn.length=0,K.fn.parent=null,K.fn.mode=null,K.fn.tagName=null,K.fn.beget=function(a,b){var c=K(a);c.parent=this,this.push(c),b&&(c.tagName=b),this.maxCheck();return c},K.fn.closest=function(a,b){var c=this;while(c)if(c.tagName!==b&&c.parent)c=c.parent;else break;return c},K.fn.pushFlatten=function(a){var b=a,c,d;while(b.length===1&&b[0].vquery)b=b[0];if(b.mode!==M)this.push(b);else for(c=0;c<b.length;c++)this.push(b[c]);this.maxCheck();return this},K.fn.push=function(a){K.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},K.fn.root=function(){var a=this;while(a&&a.parent&&(a=a.parent));return a},K.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===K.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")},K.fn.maxCheck=function(a){if(this.length>=K.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}},K.maxSize=1e3,K.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},[])},K.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},K(M))},K.isArray=function(a){return Object.prototype.toString.call(a)=="[object Array]"},K.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},K.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")K.fn[c]||function(a){K.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)}},K.takeMethodsFromArray();var M="PROGRAM",N="MARKUP",O="BLOCK",P="EXPRESSION";L.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,a.val);if(this.ast.mode===M||this.ast.mode===null)this.ast=this.ast.beget(this.options.initialMode||N),this.options.initialMode===P&&(this.ast=this.ast.beget(P));if(this.ast.mode===N){this.handleMKP(a);continue}if(this.ast.mode===O){this.handleBLK(a);continue}if(this.ast.mode===P){this.handleEXP(a);continue}}this.ast=this.ast.root(),this.options.debugParser&&!this.options.initialMode&&(console.log(this.ast),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,d){var e,f,g,h=K.extend({},this.options);h.initialMode=b,e=this.advanceUntilMatched(a,a.type,H[a.type],null,c),e.pop(),f=e.shift(),d||this.ast.push(a),g=new L(e,h),g.parse(),d&&(g.ast[0].unshift(a),g.ast[0].push(f)),this.ast.pushFlatten(g.ast),d||this.ast.push(f)},handleMKP:function(a){var b=this.tokens[this.tokens.length-1],d=this.tokens[this.tokens.length-2],e=null,h;switch(a.type){case g:this.advanceUntilMatched(a,g,f,c,c);break;case c:if(b)switch(b.type){case B:case u:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(P),this.options.saveAT&&this.ast.push(a);break;case v:case o:case j:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(O),this.options.saveAT&&this.ast.push(a);break;default:this.options.saveAT&&this.ast.push(a),this.ast.push(this.tokens.pop())}break;case F:case s:e=a.val.match(/^<([^\/ >]+)/i),e===null&&b&&b.type===c&&d&&(e=d.val.match(/(.*)/)),this.ast.tagName?this.ast=this.ast.beget(N,e[1]):this.ast.tagName=e[1],(s===a.type||this.options.saveTextTag)&&this.ast.push(a);break;case E:case r:e=a.val.match(/^<\/([^>]+)/i),e===null&&b&&b.type===c&&d&&(e=d.val.match(/(.*)/)),h=this.ast.closest(N,e[1]),h!==null&&h.tagName===e[1]&&(this.ast=h),(r===a.type||this.options.saveTextTag)&&this.ast.push(a),this.ast.parent&&this.ast.parent.mode===O&&b&&(b.type===G||b.type===x)&&(this.ast=this.ast.parent);break;case t:this.ast.push(a),this.ast.parent&&this.ast.parent.mode===O&&b&&(b.type===G||b.type===x)&&(this.ast=this.ast.parent);break;default:this.ast.push(a)}},handleBLK:function(a){var b=this.tokens[this.tokens.length-1],d,h,i,k,l,m,n;switch(a.type){case c:b.type!==c&&(this.tokens.push(a),this.ast=this.ast.beget(N));break;case g:this.advanceUntilMatched(a,g,f,c,c);break;case e:this.subParse(a,N,!0);break;case F:case E:case t:case s:case r:this.ast=this.ast.beget(N),this.tokens.push(a);break;case j:case B:d=this.options.favorText&&a.type===j?N:O,this.subParse(a,d),k=this.advanceUntilNot(G),b=this.tokens[this.tokens.length-1],b&&b.type!==v&&b.type!==o&&b.type!==j&&a.type!==B?(this.tokens.push.apply(this.tokens,k.reverse()),this.ast=this.ast.parent):this.ast.push(k);break;case G:this.ast.push(a),this.advanceUntilNot(G);break;default:this.ast.push(a)}},handleEXP:function(a){var b=null,e,f,g,i,k,m,r;switch(a.type){case v:case o:this.ast=this.ast.beget(O),this.tokens.push(a);break;case G:case w:case d:case z:case y:this.ast.parent&&this.ast.parent.mode===P?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;case u:this.ast.push(a);break;case D:case l:this.ast.parent&&this.ast.parent.mode===P?(k=this.advanceUntilMatched(a,a.type,H[a.type],h,h),this.ast.pushFlatten(k.reverse())):(this.ast=this.ast.parent,this.tokens.push(a));break;case q:case B:m=this.prevTokens[this.prevTokens.length-1],b=this.tokens[this.tokens.length-1];if(a.type===q&&b.type===p){this.tokens.push(a),this.ast=this.ast.parent;break}this.subParse(a,P),b=this.tokens[this.tokens.length-1];if(m&&m.type===c||b&&b.type===u)this.ast=this.ast.parent;break;case j:this.tokens.push(a),this.ast=this.ast.beget(O);break;case n:this.tokens.push(a),this.ast=this.ast.beget(O);break;case C:b=this.tokens[this.tokens.length-1],!b||b.type!==u&&b.type!==v&&b.type!==o&&b.type!==C?(this.ast=this.ast.parent,this.tokens.push(a)):this.ast.push(a);break;default:this.ast.parent&&this.ast.parent.mode!==P?(this.ast=this.ast.parent,this.tokens.push(a)):this.ast.push(a)}}};var R=Q.prototype;R.assemble=function(a,c){function r(a){return a.vquery&&a.mode===P?a.filter(r).length>0:a.vquery&&a.mode!==P?!0:!1}function q(a){var b,c=a.slice(0),d,e,f;a.mode===P&&a.parent&&a.parent.mode!==P&&(d=a.filter(r).length);for(e=0;e<c.length;e++)f=c[e],f.vquery?q(f):a.mode===N?n(f,a,e):a.mode===O?o(f,a,e):a.mode===P&&p(f,a,e,d>0?!1:!0)}function p(b,c,e,f){var g="",h="",i=c.parent&&c.parent.mode!==P;a.htmlEscape!==!1&&(i&&e===0&&f&&(g+=a.helpersName+".escape("),i&&e===c.length-1&&f&&(h+=").toHtmlString()")),i&&e===0&&(m(b),g="__vo.push("+g),i&&e===c.length-1&&(h+="); \n"),d.push(g+b.val+h),i&&e===c.length-1&&m(b)}function o(a,b,c){d.push(a.val)}function n(a,b,c){m(a),d.push("MKP('"+a.val.replace(f,"\\$1").replace(h,"\\n")+"')MKP")}function m(b){a.debug&&d.push(a.helpersName+".__vl = __vl = "+b.line+", ",a.helpersName+".__vc = __vc = "+b.chr+"; \n")}a=a||{},c=c||{};var d=[],e=[],f=/(["'])/gi,g=/\\+(["'])/gi,h=/[\n\r]/gi,i,j,k,l=[];d.push(a.helpersName+" = "+a.helpersName+" || vash.helpers; \n"),d.push(a.helpersName+".__vo = "+a.helpersName+".__vo || []; \n"),d.push("var __vo = "+a.helpersName+".__vo; \n"),d.push(a.helpersName+".model = "+a.modelName+"; \n"),a.debug&&d.push("var __vl = "+a.helpersName+".__vl = 0,","__vc = "+a.helpersName+".__vc = 0; \n"),q(this.ast),a.useWith===!0&&(d.unshift("with("+a.modelName+" || {}){ \n"),d.push("}")),a.debug&&(d.unshift("try { \n"),d.push("} catch(e){ ",a.helpersName+".reportError","(e, __vl, __vc, ",'"'+this.originalMarkup.replace(h,"!LB!").replace(f,"\\$1").replace(g,"\\$1")+'"',") } \n")),d.push("delete "+a.helpersName+".__vo; \n"),a.debug&&(d.push("delete "+a.helpersName+".__vl \n"),d.push("delete "+a.helpersName+".__vc \n")),d.push("return __vo.join(''); \n"),i=d.join(""),i=i.split("')MKPMKP('").join("").split("MKP(").join("__vo.push(").split(")MKP").join("); \n"),a.debugCompiler&&console.log(i);try{j=new Function(a.modelName,a.helpersName,i)}catch(s){b.helpers.reportError(s,0,0,i,/\n/)}k=function(a){return j(a,c)},k.toString=function(){return j.toString()};return k},a.VLexer=J,a.VParser=L,a.VCompiler=Q,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=K.extend({},a.config,c||{}),d=new J(b);while(e=d.advance())f.push(e);f.reverse(),g=new L(f,c),g.parse(),h=new Q(g.ast,b),i=h.assemble(c,a.helpers),i.displayName="render";return i};return a}({}))
{
"name": "vash",
"description": "Razor syntax template parser/generator, for JS",
"version": "0.5.3-1272",
"version": "0.5.3-1292",
"author": "Andrew Petersen <senofpeter@gmail.com>",

@@ -6,0 +6,0 @@ "bin": {

@@ -10,3 +10,2 @@ var

app.engine('vash', vash.__express);

@@ -18,2 +17,5 @@ app.use(app.router);

app.set('view engine', 'vash')
// allow for .html extension for templates as well as vash
app.engine('html', vash.__express);
})

@@ -20,0 +22,0 @@

var vows = require('vows')
,assert = require('assert')
,vash = process.argv[2]
? require('../build/vash.' + process.argv[2] )
: require('../build/vash');
//,vash = process.argv[2]
// ? require(__dirname + '/../build/vash.' + process.argv[2] )
// : require(__dirname + '/../build/vash');
//vash = require(__dirname + '/../build/vash')
exports.run = function(vash){
vash.config.useWith = true;

@@ -22,3 +26,3 @@ vash.config.debug = true;

vows.describe('vash templating library').addBatch({
return vows.describe('vash templating library').addBatch({
'a plain text template': {

@@ -108,3 +112,3 @@ topic: function(){

}
,'..': {
,'.. (double dot notation)': {
topic: function(){

@@ -1333,2 +1337,12 @@ return "@( false || 1..toString() )";

,'with explicit expression inside markup block': {
topic: function(){
return '@if(true){ <b>@(model.text)</b> }'
}
,'requires @': function(topic){
var tpl = vash.compile(topic, { favorText: true })
assert.equal( tpl({ text: 'yes' }), ' <b>yes</b> ' );
}
}
,'with text': {

@@ -1367,2 +1381,4 @@ topic: function(){

//}
}).export(module);
});
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc