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.4-1385 to 0.5.4-1386

test/express.js

31

build/vash-runtime-all.js
/**
* Vash - JavaScript Template Parser, v0.5.3-1385
* Vash - JavaScript Template Parser, v0.5.4-1386
*

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

// html escaping, and others.
//
//
// Each helper should define it's configuration options just above its own

@@ -33,3 +33,3 @@ // definition, for ease of modularity and discoverability.

var helpers = (vash['helpers'] = vash['helpers'] || {});
vash.helpers.config = {};

@@ -60,5 +60,5 @@

var func = function() { return val; }
val = val != null ? val : "";
val = val != null ? val : "";
return {

@@ -69,3 +69,3 @@ toHtmlString: func

}
helpers.escape = function( val ) {

@@ -75,5 +75,5 @@ var func = function() { return val; }

val = val != null ? val : "";
if ( typeof val.toHtmlString !== "function" ) {
val = val.toString().replace( HTML_REGEX, HTML_REPLACER );

@@ -86,3 +86,3 @@

}
return val;

@@ -98,7 +98,6 @@ }

// These are to be used from within helpers, to allow for manipulation of
// output in a sane manner.
// output in a sane manner.
helpers.buffer = (function(){
var helpers = helpers;
helpers.buffer = (function(){
return {

@@ -128,3 +127,3 @@

}
}
}());

@@ -136,3 +135,3 @@

///////////////////////////////////////////////////////////////////////////
// ERROR REPORTING
// ERROR REPORTING

@@ -139,0 +138,0 @@ // Liberally modified from https://github.com/visionmedia/jade/blob/master/jade.js

/**
* Vash - JavaScript Template Parser, v0.5.3-1385
* Vash - JavaScript Template Parser, v0.5.4-1386
*

@@ -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<10?e+" ":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:b.join(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}}()
(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(){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<10?e+" ":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:b.join(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-1385
* Vash - JavaScript Template Parser, v0.5.4-1386
*

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

// html escaping, and others.
//
//
// Each helper should define it's configuration options just above its own

@@ -33,3 +33,3 @@ // definition, for ease of modularity and discoverability.

var helpers = (vash['helpers'] = vash['helpers'] || {});
vash.helpers.config = {};

@@ -60,5 +60,5 @@

var func = function() { return val; }
val = val != null ? val : "";
val = val != null ? val : "";
return {

@@ -69,3 +69,3 @@ toHtmlString: func

}
helpers.escape = function( val ) {

@@ -75,5 +75,5 @@ var func = function() { return val; }

val = val != null ? val : "";
if ( typeof val.toHtmlString !== "function" ) {
val = val.toString().replace( HTML_REGEX, HTML_REPLACER );

@@ -86,3 +86,3 @@

}
return val;

@@ -98,7 +98,6 @@ }

// These are to be used from within helpers, to allow for manipulation of
// output in a sane manner.
// output in a sane manner.
helpers.buffer = (function(){
var helpers = helpers;
helpers.buffer = (function(){
return {

@@ -128,3 +127,3 @@

}
}
}());

@@ -136,3 +135,3 @@

///////////////////////////////////////////////////////////////////////////
// ERROR REPORTING
// ERROR REPORTING

@@ -139,0 +138,0 @@ // Liberally modified from https://github.com/visionmedia/jade/blob/master/jade.js

/**
* Vash - JavaScript Template Parser, v0.5.3-1385
* Vash - JavaScript Template Parser, v0.5.4-1386
*

@@ -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<10?e+" ":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(){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(){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<10?e+" ":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}})()
/**
* Vash - JavaScript Template Parser, v0.5.3-1385
* Vash - JavaScript Template Parser, v0.5.4-1386
*

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

exports["version"] = "0.5.3-1385";
exports["version"] = "0.5.4-1386";
exports["config"] = {

@@ -55,3 +55,3 @@ "useWith": false

// html escaping, and others.
//
//
// Each helper should define it's configuration options just above its own

@@ -70,3 +70,3 @@ // definition, for ease of modularity and discoverability.

var helpers = (vash['helpers'] = vash['helpers'] || {});
vash.helpers.config = {};

@@ -97,5 +97,5 @@

var func = function() { return val; }
val = val != null ? val : "";
val = val != null ? val : "";
return {

@@ -106,3 +106,3 @@ toHtmlString: func

}
helpers.escape = function( val ) {

@@ -112,5 +112,5 @@ var func = function() { return val; }

val = val != null ? val : "";
if ( typeof val.toHtmlString !== "function" ) {
val = val.toString().replace( HTML_REGEX, HTML_REPLACER );

@@ -123,3 +123,3 @@

}
return val;

@@ -135,7 +135,6 @@ }

// These are to be used from within helpers, to allow for manipulation of
// output in a sane manner.
// output in a sane manner.
helpers.buffer = (function(){
var helpers = helpers;
helpers.buffer = (function(){
return {

@@ -165,3 +164,3 @@

}
}
}());

@@ -173,3 +172,3 @@

///////////////////////////////////////////////////////////////////////////
// ERROR REPORTING
// ERROR REPORTING

@@ -1587,2 +1586,3 @@ // Liberally modified from https://github.com/visionmedia/jade/blob/master/jade.js

exports["VCompiler"] = VCompiler;
exports["vQuery"] = vQuery;
exports["compile"] = function compile(markup, options){

@@ -1589,0 +1589,0 @@

/**
* Vash - JavaScript Template Parser, v0.5.3-1385
* Vash - JavaScript Template Parser, v0.5.4-1386
*

@@ -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-1385",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<10?e+" ":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:c.join(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(){var a=/^(<[^\/ >]+?[^>]*?>)/,b=/([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4})\b/,c=this.scan(a,s);c&&(this.spewIf(c,b),this.spewIf(c,/(@)/));return c},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[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<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.toString(),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.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,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){this.options.saveAT&&this.ast.push(a);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);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);break;case c:b.type="CONTENT",this.ast.push(this.tokens.pop());break;default: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,d){function t(a){return a.vquery&&a.mode===P?a.filter(t).length>0:a.vquery&&a.mode!==P?!0:!1}function s(a){var b,d=a.slice(0),f,g,h;a.mode===P&&a.parent&&a.parent.mode!==P&&(f=a.filter(t).length);for(g=0;g<d.length;g++){h=d[g];if(h.type&&h.type===c||h.type===e)continue;h.vquery?s(h):a.mode===N?p(h,a,g):a.mode===O?q(h,a,g):a.mode===P&&r(h,a,g,f>0?!1:!0)}}function r(b,c,d,e){var g="",h="",i=c.parent&&c.parent.mode!==P;a.htmlEscape!==!1&&(i&&d===0&&e&&(g+=a.helpersName+".escape("),i&&d===c.length-1&&e&&(h+=").toHtmlString()")),i&&d===0&&(o(b),g="__vo.push("+g),i&&d===c.length-1&&(h+="); \n"),f.push(g+b.val+h),i&&d===c.length-1&&o(b)}function q(a,b,c){f.push(a.val)}function p(a,b,c){o(a),f.push("MKP('"+a.val.replace(h,"\\$1").replace(j,"\\n")+"')MKP")}function o(b){a.debug&&f.push(a.helpersName+".__vl = __vl = "+b.line+", ",a.helpersName+".__vc = __vc = "+b.chr+"; \n")}a=a||{},d=d||{};var f=[],g=[],h=/(["'])/gi,i=/\\+(["'])/gi,j=/[\n\r]/gi,k,l,m,n=[];f.push(a.helpersName+" = "+a.helpersName+" || vash.helpers; \n"),f.push(a.helpersName+".__vo = "+a.helpersName+".__vo || []; \n"),f.push("var __vo = "+a.helpersName+".__vo; \n"),f.push(a.helpersName+".model = "+a.modelName+"; \n"),a.debug&&f.push("var __vl = "+a.helpersName+".__vl = 0,","__vc = "+a.helpersName+".__vc = 0; \n"),s(this.ast),a.useWith===!0&&(f.unshift("with("+a.modelName+" || {}){ \n"),f.push("}")),a.debug&&(f.unshift("try { \n"),f.push("} catch(e){ ",a.helpersName+".reportError","(e, __vl, __vc, ",'"'+this.originalMarkup.replace(j,"!LB!").replace(h,"\\$1").replace(i,"\\$1")+'"',") } \n")),f.push("delete "+a.helpersName+".__vo; \n"),a.debug&&(f.push("delete "+a.helpersName+".__vl \n"),f.push("delete "+a.helpersName+".__vc \n")),f.push("return __vo.join(''); \n"),k=f.join(""),k=k.split("')MKPMKP('").join("").split("MKP(").join("__vo.push(").split(")MKP").join("); \n"),a.debugCompiler&&console.log(k);try{l=new Function(a.modelName,a.helpersName,k)}catch(u){b.helpers.reportError(u,0,0,k,/\n/)}m=function(a){return l(a,d)},m.toString=function(){return l.toString()};return m},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.4-1386",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(){return{mark:function(){return c.__vo.length},empty:function(){return c.__vo.splice(0,c.__vo.length)},fromMark:function(a){return c.__vo.splice(a,c.__vo.length)},push:function(a){a instanceof Array?c.__vo.push.apply(c.__vo,a):arguments.length>1?c.__vo.push.apply(c.__vo,Array.prototype.slice.call(arguments)):c.__vo.push(a)}}}(),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<10?e+" ":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:c.join(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(){var a=/^(<[^\/ >]+?[^>]*?>)/,b=/([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4})\b/,c=this.scan(a,s);c&&(this.spewIf(c,b),this.spewIf(c,/(@)/));return c},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[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<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.toString(),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.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,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){this.options.saveAT&&this.ast.push(a);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);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);break;case c:b.type="CONTENT",this.ast.push(this.tokens.pop());break;default: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,d){function t(a){return a.vquery&&a.mode===P?a.filter(t).length>0:a.vquery&&a.mode!==P?!0:!1}function s(a){var b,d=a.slice(0),f,g,h;a.mode===P&&a.parent&&a.parent.mode!==P&&(f=a.filter(t).length);for(g=0;g<d.length;g++){h=d[g];if(h.type&&h.type===c||h.type===e)continue;h.vquery?s(h):a.mode===N?p(h,a,g):a.mode===O?q(h,a,g):a.mode===P&&r(h,a,g,f>0?!1:!0)}}function r(b,c,d,e){var g="",h="",i=c.parent&&c.parent.mode!==P;a.htmlEscape!==!1&&(i&&d===0&&e&&(g+=a.helpersName+".escape("),i&&d===c.length-1&&e&&(h+=").toHtmlString()")),i&&d===0&&(o(b),g="__vo.push("+g),i&&d===c.length-1&&(h+="); \n"),f.push(g+b.val+h),i&&d===c.length-1&&o(b)}function q(a,b,c){f.push(a.val)}function p(a,b,c){o(a),f.push("MKP('"+a.val.replace(h,"\\$1").replace(j,"\\n")+"')MKP")}function o(b){a.debug&&f.push(a.helpersName+".__vl = __vl = "+b.line+", ",a.helpersName+".__vc = __vc = "+b.chr+"; \n")}a=a||{},d=d||{};var f=[],g=[],h=/(["'])/gi,i=/\\+(["'])/gi,j=/[\n\r]/gi,k,l,m,n=[];f.push(a.helpersName+" = "+a.helpersName+" || vash.helpers; \n"),f.push(a.helpersName+".__vo = "+a.helpersName+".__vo || []; \n"),f.push("var __vo = "+a.helpersName+".__vo; \n"),f.push(a.helpersName+".model = "+a.modelName+"; \n"),a.debug&&f.push("var __vl = "+a.helpersName+".__vl = 0,","__vc = "+a.helpersName+".__vc = 0; \n"),s(this.ast),a.useWith===!0&&(f.unshift("with("+a.modelName+" || {}){ \n"),f.push("}")),a.debug&&(f.unshift("try { \n"),f.push("} catch(e){ ",a.helpersName+".reportError","(e, __vl, __vc, ",'"'+this.originalMarkup.replace(j,"!LB!").replace(h,"\\$1").replace(i,"\\$1")+'"',") } \n")),f.push("delete "+a.helpersName+".__vo; \n"),a.debug&&(f.push("delete "+a.helpersName+".__vl \n"),f.push("delete "+a.helpersName+".__vc \n")),f.push("return __vo.join(''); \n"),k=f.join(""),k=k.split("')MKPMKP('").join("").split("MKP(").join("__vo.push(").split(")MKP").join("); \n"),a.debugCompiler&&console.log(k);try{l=new Function(a.modelName,a.helpersName,k)}catch(u){b.helpers.reportError(u,0,0,k,/\n/)}m=function(a){return l(a,d)},m.toString=function(){return l.toString()};return m},a.VLexer=J,a.VParser=L,a.VCompiler=Q,a.vQuery=K,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.4-1385",
"version": "0.5.4-1386",
"author": "Andrew Petersen <senofpeter@gmail.com>",

@@ -35,2 +35,2 @@ "bin": {

}
}
}

@@ -1384,2 +1384,111 @@ var vows = require('vows')

,'layout helpers': {
topic: function(){
this.opts = function(model){
return vash.vQuery.extend( model || {}, {
// mock up express settings
settings: {
views: __dirname + '/fixtures/views',
'view engine': 'vash'
}
});
}
return this.opts;
}
,'p': {
topic: function(opts){
vash.loadFile( 'p', opts(), this.callback );
}
,'renders': function( err, tpl ){
assert.equal( tpl( this.opts({ a: 'a' }) ), '<p>a</p>' )
}
}
,'includes': {
topic: function(opts){
vash.loadFile( 'list', opts(), this.callback );
}
,'renders': function( err, tpl ){
var actual = tpl( this.opts({ count: 2 }) )
//console.log('actual', actual )
assert.equal( actual, '<ul><li>a</li><li>a</li></ul>' )
}
}
,'extends': {
topic: function(opts){
return function(inner){
return vash.compile('@console.log("extends call - start", html.__vo.length)@html.extends("layout", function(){' + inner + '})@console.log("extends call - end", html.__vo.length)');
}
}
,'renders blank': function( maker ){
assert.equal( maker('')( this.opts() ), '' )
}
,'renders expression': function( maker ){
var actual = maker('')( this.opts({ title: 'is title' }) )
console.log('actual', actual)
assert.equal( actual, 'is title' )
}
,'renders content block': function( maker ){
var block = '@html.block("content", function(model){<p>@model.a</p>})'
assert.equal( maker(block)( this.opts({ a: 'a' }) ), '<p>a</p>' )
}
,'renders content block with include': function( maker ){
var block = '@html.block("content", function(model){@html.include("p")<p>@model.a</p>})'
assert.equal( maker(block)( this.opts({ a: 'a' }) ), '<p>a</p><p>a</p>' )
}
,'renders content block with multiple include': function( maker ){
var incp = '@html.include("p")'
,mb = '<p>@model.b</p>'
,block = '@html.block("content", function(model){' + incp + mb + incp + mb + '})'
,actual = maker(block)( this.opts({ a: 'a', b: 'b' }) )
//console.log( 'actual', actual )
assert.equal( actual , '<p>a</p><p>b</p><p>a</p><p>b</p>' );
}
,'renders appended content block': function( maker ){
var incp = '@html.include("p")'
,appf = '@html.append("footer", function(){<footer></footer>})'
,block = '@html.block("content", function(model){' + incp + appf + incp + '})'
,outp = '<p>a</p>'
,actual = maker(block)( this.opts({ a: 'a' }) )
//console.log( 'actual', actual )
assert.equal( actual, outp + outp + '<footer></footer>' );
}
,'renders prepended/appended content block': function( maker ){
var incp = '@html.include("p")'
,appf = '@html.append("footer", function(){<app></app>})'
,pref = '@html.prepend("footer", function(){<pre></pre>})'
,block = '@html.block("content", function(model){' + incp + appf + pref + incp + '})'
,outp = '<p>a</p>'
,actual = maker(block)( this.opts({ a: 'a' }) )
//console.log( 'actual', actual )
assert.equal( actual, outp + outp + '<pre></pre><app></app>' );
}
}
}
//,'putting markup into a property': {

@@ -1386,0 +1495,0 @@ // topic: function(){

Sorry, the diff of this file is not supported yet

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