diff --git a/bower.json b/bower.json index d47dddf2..e436f577 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "dustjs-linkedin", - "version": "2.6.0", + "version": "2.6.1", "homepage": "https://github.com/linkedin/dustjs", "authors": [ "Veena Basavaraj ", diff --git a/dist/dust-core.js b/dist/dust-core.js index d8ae68a5..6239bb43 100644 --- a/dist/dust-core.js +++ b/dist/dust-core.js @@ -1,9 +1,9 @@ -/*! Dust - Asynchronous Templating - v2.6.0 +/*! Dust - Asynchronous Templating - v2.6.1 * http://linkedin.github.io/dustjs/ * Copyright (c) 2015 Aleksander Williams; Released under the MIT License */ (function(root) { var dust = { - "version": "2.6.0" + "version": "2.6.1" }, NONE = 'NONE', ERROR = 'ERROR', diff --git a/dist/dust-core.min.js b/dist/dust-core.min.js index 404beb8e..52f49658 100644 --- a/dist/dust-core.min.js +++ b/dist/dust-core.min.js @@ -1,4 +1,4 @@ -/*! Dust - Asynchronous Templating - v2.6.0 +/*! Dust - Asynchronous Templating - v2.6.1 * http://linkedin.github.io/dustjs/ * Copyright (c) 2015 Aleksander Williams; Released under the MIT License */ -!function(root){function Context(a,b,c,d){this.stack=a,this.global=b,this.blocks=c,this.templateName=d}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.6.0"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",loggingLevels=[DEBUG,INFO,WARN,ERROR,NONE],EMPTY_FUNC=function(){},logger={},originalLog,loggerContext;dust.debugLevel=NONE,dust.config={whitespace:!1,amd:!1},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},root&&root.console&&root.console.log&&(loggerContext=root.console,originalLog=root.console.log),logger.log=loggerContext?function(){logger.log="function"==typeof originalLog?function(){originalLog.apply(loggerContext,arguments)}:function(){var a=Array.prototype.slice.apply(arguments).join(" ");originalLog(a)},logger.log.apply(this,arguments)}:function(){},dust.log=function(a,b){b=b||INFO,dust.debugLevel!==NONE&&dust.indexInArray(loggingLevels,b)>=dust.indexInArray(loggingLevels,dust.debugLevel)&&(dust.logQueue||(dust.logQueue=[]),dust.logQueue.push({message:a,type:b}),logger.log("[DUST:"+b+"]",a))},dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(dust.cache[a]=b)},dust.render=function(a,b,c){var d=new Stub(c).head;try{dust.load(a,d,Context.wrap(b,a)).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{dust.load(a,c.head,Context.wrap(b,a)).end()}catch(e){d.setError(e)}}),c},dust.renderSource=function(a,b,c){return dust.compileFn(a)(b,c)},dust.compileFn=function(a,b){b=b||null;var c=dust.loadSource(dust.compile(a,b));return function(a,d){var e=d?new Stub(d):new Stream;return dust.nextTick(function(){"function"==typeof c?c(e.head,Context.wrap(a,b)).end():dust.log(new Error("Template ["+b+"] cannot be resolved to a Dust function"),ERROR)}),e}},dust.load=function(a,b,c){var d=dust.cache[a];return d?d(b,c):dust.onLoad?b.map(function(b){dust.onLoad(a,function(d,e){return d?b.setError(d):(dust.cache[a]||dust.loadSource(dust.compile(e,a)),void dust.cache[a](b,c).end())})}):b.setError(new Error("Template Not Found: "+a))},dust.loadSource=function(source,path){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.indexInArray=function(a,b,c){if(c=+c||0,Array.prototype.indexOf)return a.indexOf(b,c);if(void 0===a||null===a)throw new TypeError('cannot call method "indexOf" of null');var d=a.length;for(1/0===Math.abs(c)&&(c=0),0>c&&(c+=d,0>c&&(c=0));d>c;c++)if(a[c]===b)return c;return-1},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return dust.isArray(a)&&!a.length?!0:0===a?!1:!a},dust.filter=function(a,b,c){if(c)for(var d=0,e=c.length;e>d;d++){var f=c[d];"s"===f?b=null:"function"==typeof dust.filters[f]?a=dust.filters[f](a):dust.log("Invalid filter ["+f+"]",WARN)}return b&&(a=dust.filters[b](a)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined. JSON parse has not been used on ["+a+"]",WARN),a)}},dust.makeBase=function(a){return new Context(new Stack,a)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(new Stack(a),{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack,i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global?this.global[d]:void 0}for(;h&&e>i;)f=h,h=h[b[i]],i++}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find the value for reference [{"+b.join(".")+"}] in template ["+this.getTemplateName()+"]"),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return new Context(new Stack(a,this.stack,b,c),this.global,this.blocks,this.getTemplateName())},Context.prototype.rebase=function(a){return new Context(new Stack(a),this.global,this.blocks,this.getTemplateName())},Context.prototype.current=function(){return this.stack.head},Context.prototype.getBlock=function(a){if("function"==typeof a){var b=new Chunk;a=a(b,this).data.join("")}var c=this.blocks;if(!c)return void dust.log("No blocks for context[{"+a+"}] in template ["+this.getTemplateName()+"]",DEBUG);for(var d,e=c.length;e--;)if(d=c[e][a])return d},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,b,this.getTemplateName())):this},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Chunk error ["+a.error+"] thrown. Ceasing to render this template.",WARN),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),dust.log("Chunk error ["+a.error+"] thrown. Ceasing to render this template.",WARN),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){if(!this.events)return dust.log("No events to emit",INFO),!1;var c=this.events[a];if(!c)return dust.log("Event type ["+a+"] does not exist",WARN),!1;if("function"==typeof c)c(b);else if(dust.isArray(c))for(var d=c.slice(0),e=0,f=d.length;f>e;e++)d[e](b);else dust.log("Event Handler ["+c+"] is not of a type that is handled by emit",WARN)},Stream.prototype.on=function(a,b){return this.events||(this.events={}),this.events[a]?"function"==typeof this.events[a]?this.events[a]=[this.events[a],b]:this.events[a].push(b):b?this.events[a]=b:dust.log("Callback for type ["+a+"] does not exist. Listener not registered.",WARN),this},Stream.prototype.pipe=function(a){return this.on("data",function(b){try{a.write(b,"utf8")}catch(c){dust.log(c,ERROR)}}).on("end",function(){try{return a.end()}catch(b){dust.log(b,ERROR)}}).on("error",function(b){a.error(b)}),this},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a&&(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk)?a:dust.isEmpty(a)?this:this.write(dust.filter(a,c,d))},Chunk.prototype.section=function(a,b,c,d){if("function"==typeof a&&!a.__dustBody){try{a=a.apply(b.current(),[this,b,c,d])}catch(e){return dust.log(e,ERROR),this.setError(e)}if(a instanceof Chunk)return a}var f=c.block,g=c["else"];if(d&&(b=b.push(d)),dust.isArray(a)){if(f){var h=a.length,i=this;if(h>0){b.stack.head&&(b.stack.head.$len=h);for(var j=0;h>j;j++)b.stack.head&&(b.stack.head.$idx=j),i=f(i,b.push(a[j],j,h));return b.stack.head&&(b.stack.head.$idx=void 0,b.stack.head.$len=void 0),i}if(g)return g(this,b)}}else if(a===!0){if(f)return f(this,b)}else if(a||0===a){if(f)return f(this,b.push(a))}else if(g)return g(this,b);return dust.log("Not rendering section (#) block in template ["+b.getTemplateName()+"], because above key was not found",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else if(d)return d(this,b);return dust.log("Not rendering exists (?) block in template ["+b.getTemplateName()+"], because above key was not found",DEBUG),this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b)}else if(e)return e(this,b);return dust.log("Not rendering not exists (^) block check in template ["+b.getTemplateName()+"], because above key was found",DEBUG),this},Chunk.prototype.block=function(a,b,c){var d=c.block;return a&&(d=a),d?d(this,b):this},Chunk.prototype.partial=function(a,b,c){var d;d=dust.makeBase(b.global),d.blocks=b.blocks,b.stack&&b.stack.tail&&(d.stack=b.stack.tail),c&&(d=d.push(c)),"string"==typeof a&&(d.templateName=a),d=d.push(b.stack.head);var e;return e="function"==typeof a?this.capture(a,d,function(a,b){d.templateName=d.templateName||a,dust.load(a,b,d).end()}):dust.load(a,this,d)},Chunk.prototype.helper=function(a,b,c,d){var e=this;if(!dust.helpers[a])return dust.log("Invalid helper ["+a+"]",WARN),e;try{return dust.helpers[a](e,b,c,d)}catch(f){return dust.log("Error in "+a+" helper: "+f,ERROR),e.setError(f)}},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined. JSON stringify has not been used on ["+a+"]",WARN),a)},"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",function(){return dust}):"object"==typeof exports?module.exports=dust:root.dust=dust}(function(){return this}()),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file +!function(root){function Context(a,b,c,d){this.stack=a,this.global=b,this.blocks=c,this.templateName=d}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.6.1"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",loggingLevels=[DEBUG,INFO,WARN,ERROR,NONE],EMPTY_FUNC=function(){},logger={},originalLog,loggerContext;dust.debugLevel=NONE,dust.config={whitespace:!1,amd:!1},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},root&&root.console&&root.console.log&&(loggerContext=root.console,originalLog=root.console.log),logger.log=loggerContext?function(){logger.log="function"==typeof originalLog?function(){originalLog.apply(loggerContext,arguments)}:function(){var a=Array.prototype.slice.apply(arguments).join(" ");originalLog(a)},logger.log.apply(this,arguments)}:function(){},dust.log=function(a,b){b=b||INFO,dust.debugLevel!==NONE&&dust.indexInArray(loggingLevels,b)>=dust.indexInArray(loggingLevels,dust.debugLevel)&&(dust.logQueue||(dust.logQueue=[]),dust.logQueue.push({message:a,type:b}),logger.log("[DUST:"+b+"]",a))},dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(dust.cache[a]=b)},dust.render=function(a,b,c){var d=new Stub(c).head;try{dust.load(a,d,Context.wrap(b,a)).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{dust.load(a,c.head,Context.wrap(b,a)).end()}catch(e){d.setError(e)}}),c},dust.renderSource=function(a,b,c){return dust.compileFn(a)(b,c)},dust.compileFn=function(a,b){b=b||null;var c=dust.loadSource(dust.compile(a,b));return function(a,d){var e=d?new Stub(d):new Stream;return dust.nextTick(function(){"function"==typeof c?c(e.head,Context.wrap(a,b)).end():dust.log(new Error("Template ["+b+"] cannot be resolved to a Dust function"),ERROR)}),e}},dust.load=function(a,b,c){var d=dust.cache[a];return d?d(b,c):dust.onLoad?b.map(function(b){dust.onLoad(a,function(d,e){return d?b.setError(d):(dust.cache[a]||dust.loadSource(dust.compile(e,a)),void dust.cache[a](b,c).end())})}):b.setError(new Error("Template Not Found: "+a))},dust.loadSource=function(source,path){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.indexInArray=function(a,b,c){if(c=+c||0,Array.prototype.indexOf)return a.indexOf(b,c);if(void 0===a||null===a)throw new TypeError('cannot call method "indexOf" of null');var d=a.length;for(Math.abs(c)===1/0&&(c=0),0>c&&(c+=d,0>c&&(c=0));d>c;c++)if(a[c]===b)return c;return-1},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return dust.isArray(a)&&!a.length?!0:0===a?!1:!a},dust.filter=function(a,b,c){if(c)for(var d=0,e=c.length;e>d;d++){var f=c[d];"s"===f?b=null:"function"==typeof dust.filters[f]?a=dust.filters[f](a):dust.log("Invalid filter ["+f+"]",WARN)}return b&&(a=dust.filters[b](a)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined. JSON parse has not been used on ["+a+"]",WARN),a)}},dust.makeBase=function(a){return new Context(new Stack,a)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(new Stack(a),{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack,i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global?this.global[d]:void 0}for(;h&&e>i;)f=h,h=h[b[i]],i++}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find the value for reference [{"+b.join(".")+"}] in template ["+this.getTemplateName()+"]"),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return new Context(new Stack(a,this.stack,b,c),this.global,this.blocks,this.getTemplateName())},Context.prototype.rebase=function(a){return new Context(new Stack(a),this.global,this.blocks,this.getTemplateName())},Context.prototype.current=function(){return this.stack.head},Context.prototype.getBlock=function(a){if("function"==typeof a){var b=new Chunk;a=a(b,this).data.join("")}var c=this.blocks;if(!c)return void dust.log("No blocks for context[{"+a+"}] in template ["+this.getTemplateName()+"]",DEBUG);for(var d,e=c.length;e--;)if(d=c[e][a])return d},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,b,this.getTemplateName())):this},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Chunk error ["+a.error+"] thrown. Ceasing to render this template.",WARN),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),dust.log("Chunk error ["+a.error+"] thrown. Ceasing to render this template.",WARN),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){if(!this.events)return dust.log("No events to emit",INFO),!1;var c=this.events[a];if(!c)return dust.log("Event type ["+a+"] does not exist",WARN),!1;if("function"==typeof c)c(b);else if(dust.isArray(c))for(var d=c.slice(0),e=0,f=d.length;f>e;e++)d[e](b);else dust.log("Event Handler ["+c+"] is not of a type that is handled by emit",WARN)},Stream.prototype.on=function(a,b){return this.events||(this.events={}),this.events[a]?"function"==typeof this.events[a]?this.events[a]=[this.events[a],b]:this.events[a].push(b):b?this.events[a]=b:dust.log("Callback for type ["+a+"] does not exist. Listener not registered.",WARN),this},Stream.prototype.pipe=function(a){return this.on("data",function(b){try{a.write(b,"utf8")}catch(c){dust.log(c,ERROR)}}).on("end",function(){try{return a.end()}catch(b){dust.log(b,ERROR)}}).on("error",function(b){a.error(b)}),this},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a&&(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk)?a:dust.isEmpty(a)?this:this.write(dust.filter(a,c,d))},Chunk.prototype.section=function(a,b,c,d){if("function"==typeof a&&!a.__dustBody){try{a=a.apply(b.current(),[this,b,c,d])}catch(e){return dust.log(e,ERROR),this.setError(e)}if(a instanceof Chunk)return a}var f=c.block,g=c["else"];if(d&&(b=b.push(d)),dust.isArray(a)){if(f){var h=a.length,i=this;if(h>0){b.stack.head&&(b.stack.head.$len=h);for(var j=0;h>j;j++)b.stack.head&&(b.stack.head.$idx=j),i=f(i,b.push(a[j],j,h));return b.stack.head&&(b.stack.head.$idx=void 0,b.stack.head.$len=void 0),i}if(g)return g(this,b)}}else if(a===!0){if(f)return f(this,b)}else if(a||0===a){if(f)return f(this,b.push(a))}else if(g)return g(this,b);return dust.log("Not rendering section (#) block in template ["+b.getTemplateName()+"], because above key was not found",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else if(d)return d(this,b);return dust.log("Not rendering exists (?) block in template ["+b.getTemplateName()+"], because above key was not found",DEBUG),this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b)}else if(e)return e(this,b);return dust.log("Not rendering not exists (^) block check in template ["+b.getTemplateName()+"], because above key was found",DEBUG),this},Chunk.prototype.block=function(a,b,c){var d=c.block;return a&&(d=a),d?d(this,b):this},Chunk.prototype.partial=function(a,b,c){var d;d=dust.makeBase(b.global),d.blocks=b.blocks,b.stack&&b.stack.tail&&(d.stack=b.stack.tail),c&&(d=d.push(c)),"string"==typeof a&&(d.templateName=a),d=d.push(b.stack.head);var e;return e="function"==typeof a?this.capture(a,d,function(a,b){d.templateName=d.templateName||a,dust.load(a,b,d).end()}):dust.load(a,this,d)},Chunk.prototype.helper=function(a,b,c,d){var e=this;if(!dust.helpers[a])return dust.log("Invalid helper ["+a+"]",WARN),e;try{return dust.helpers[a](e,b,c,d)}catch(f){return dust.log("Error in "+a+" helper: "+f,ERROR),e.setError(f)}},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined. JSON stringify has not been used on ["+a+"]",WARN),a)},"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",function(){return dust}):"object"==typeof exports?module.exports=dust:root.dust=dust}(function(){return this}()),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file diff --git a/dist/dust-full.js b/dist/dust-full.js index 8d4a9cc9..b9dfbc0b 100644 --- a/dist/dust-full.js +++ b/dist/dust-full.js @@ -1,9 +1,9 @@ -/*! Dust - Asynchronous Templating - v2.6.0 +/*! Dust - Asynchronous Templating - v2.6.1 * http://linkedin.github.io/dustjs/ * Copyright (c) 2015 Aleksander Williams; Released under the MIT License */ (function(root) { var dust = { - "version": "2.6.0" + "version": "2.6.1" }, NONE = 'NONE', ERROR = 'ERROR', @@ -1030,13 +1030,18 @@ peg$c49 = { type: "other", description: "float" }, peg$c50 = ".", peg$c51 = { type: "literal", value: ".", description: "\".\"" }, - peg$c52 = function(l, r) { return parseFloat(l + "." + r.join('')); }, - peg$c53 = { type: "other", description: "integer" }, + peg$c52 = function(l, r) { return parseFloat(l + "." + r); }, + peg$c53 = { type: "other", description: "unsigned_integer" }, peg$c54 = /^[0-9]/, peg$c55 = { type: "class", value: "[0-9]", description: "[0-9]" }, peg$c56 = function(digits) { return parseInt(digits.join(""), 10); }, - peg$c57 = { type: "other", description: "path" }, - peg$c58 = function(k, d) { + peg$c57 = { type: "other", description: "signed_integer" }, + peg$c58 = "-", + peg$c59 = { type: "literal", value: "-", description: "\"-\"" }, + peg$c60 = function(sign, n) { return n*-1; }, + peg$c61 = { type: "other", description: "integer" }, + peg$c62 = { type: "other", description: "path" }, + peg$c63 = function(k, d) { d = d[0]; if (k && d) { d.unshift(k); @@ -1044,79 +1049,79 @@ } return [true, d].concat([['line', line()], ['col', column()]]); }, - peg$c59 = function(d) { + peg$c64 = function(d) { if (d.length > 0) { return [true, d[0]].concat([['line', line()], ['col', column()]]); } return [true, []].concat([['line', line()], ['col', column()]]); }, - peg$c60 = { type: "other", description: "key" }, - peg$c61 = /^[a-zA-Z_$]/, - peg$c62 = { type: "class", value: "[a-zA-Z_$]", description: "[a-zA-Z_$]" }, - peg$c63 = /^[0-9a-zA-Z_$\-]/, - peg$c64 = { type: "class", value: "[0-9a-zA-Z_$\\-]", description: "[0-9a-zA-Z_$\\-]" }, - peg$c65 = function(h, t) { return h + t.join('') }, - peg$c66 = { type: "other", description: "array" }, - peg$c67 = function(n) {return n.join('')}, - peg$c68 = function(a) {return a; }, - peg$c69 = function(i, nk) { if(nk) { nk.unshift(i); } else {nk = [i] } return nk; }, - peg$c70 = { type: "other", description: "array_part" }, - peg$c71 = function(k) {return k}, - peg$c72 = function(d, a) { if (a) { return d.concat(a); } else { return d; } }, - peg$c73 = { type: "other", description: "inline" }, - peg$c74 = "\"", - peg$c75 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c76 = function() { return ["literal", ""].concat([['line', line()], ['col', column()]]) }, - peg$c77 = function(l) { return ["literal", l].concat([['line', line()], ['col', column()]]) }, - peg$c78 = function(p) { return ["body"].concat(p).concat([['line', line()], ['col', column()]]) }, - peg$c79 = function(l) { return ["buffer", l] }, - peg$c80 = { type: "other", description: "buffer" }, - peg$c81 = function(e, w) { return ["format", e, w.join('')].concat([['line', line()], ['col', column()]]) }, - peg$c82 = { type: "any", description: "any character" }, - peg$c83 = function(c) {return c}, - peg$c84 = function(b) { return ["buffer", b.join('')].concat([['line', line()], ['col', column()]]) }, - peg$c85 = { type: "other", description: "literal" }, - peg$c86 = /^[^"]/, - peg$c87 = { type: "class", value: "[^\"]", description: "[^\"]" }, - peg$c88 = function(b) { return b.join('') }, - peg$c89 = "\\\"", - peg$c90 = { type: "literal", value: "\\\"", description: "\"\\\\\\\"\"" }, - peg$c91 = function() { return '"' }, - peg$c92 = { type: "other", description: "raw" }, - peg$c93 = "{`", - peg$c94 = { type: "literal", value: "{`", description: "\"{`\"" }, - peg$c95 = "`}", - peg$c96 = { type: "literal", value: "`}", description: "\"`}\"" }, - peg$c97 = function(char) {return char}, - peg$c98 = function(rawText) { return ["raw", rawText.join('')].concat([['line', line()], ['col', column()]]) }, - peg$c99 = { type: "other", description: "comment" }, - peg$c100 = "{!", - peg$c101 = { type: "literal", value: "{!", description: "\"{!\"" }, - peg$c102 = "!}", - peg$c103 = { type: "literal", value: "!}", description: "\"!}\"" }, - peg$c104 = function(c) { return ["comment", c.join('')].concat([['line', line()], ['col', column()]]) }, - peg$c105 = /^[#?\^><+%:@\/~%]/, - peg$c106 = { type: "class", value: "[#?\\^><+%:@\\/~%]", description: "[#?\\^><+%:@\\/~%]" }, - peg$c107 = "{", - peg$c108 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c109 = "}", - peg$c110 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c111 = "[", - peg$c112 = { type: "literal", value: "[", description: "\"[\"" }, - peg$c113 = "]", - peg$c114 = { type: "literal", value: "]", description: "\"]\"" }, - peg$c115 = "\n", - peg$c116 = { type: "literal", value: "\n", description: "\"\\n\"" }, - peg$c117 = "\r\n", - peg$c118 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" }, - peg$c119 = "\r", - peg$c120 = { type: "literal", value: "\r", description: "\"\\r\"" }, - peg$c121 = "\u2028", - peg$c122 = { type: "literal", value: "\u2028", description: "\"\\u2028\"" }, - peg$c123 = "\u2029", - peg$c124 = { type: "literal", value: "\u2029", description: "\"\\u2029\"" }, - peg$c125 = /^[\t\x0B\f \xA0\uFEFF]/, - peg$c126 = { type: "class", value: "[\\t\\x0B\\f \\xA0\\uFEFF]", description: "[\\t\\x0B\\f \\xA0\\uFEFF]" }, + peg$c65 = { type: "other", description: "key" }, + peg$c66 = /^[a-zA-Z_$]/, + peg$c67 = { type: "class", value: "[a-zA-Z_$]", description: "[a-zA-Z_$]" }, + peg$c68 = /^[0-9a-zA-Z_$\-]/, + peg$c69 = { type: "class", value: "[0-9a-zA-Z_$\\-]", description: "[0-9a-zA-Z_$\\-]" }, + peg$c70 = function(h, t) { return h + t.join('') }, + peg$c71 = { type: "other", description: "array" }, + peg$c72 = function(n) {return n.join('')}, + peg$c73 = function(a) {return a; }, + peg$c74 = function(i, nk) { if(nk) { nk.unshift(i); } else {nk = [i] } return nk; }, + peg$c75 = { type: "other", description: "array_part" }, + peg$c76 = function(k) {return k}, + peg$c77 = function(d, a) { if (a) { return d.concat(a); } else { return d; } }, + peg$c78 = { type: "other", description: "inline" }, + peg$c79 = "\"", + peg$c80 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c81 = function() { return ["literal", ""].concat([['line', line()], ['col', column()]]) }, + peg$c82 = function(l) { return ["literal", l].concat([['line', line()], ['col', column()]]) }, + peg$c83 = function(p) { return ["body"].concat(p).concat([['line', line()], ['col', column()]]) }, + peg$c84 = function(l) { return ["buffer", l] }, + peg$c85 = { type: "other", description: "buffer" }, + peg$c86 = function(e, w) { return ["format", e, w.join('')].concat([['line', line()], ['col', column()]]) }, + peg$c87 = { type: "any", description: "any character" }, + peg$c88 = function(c) {return c}, + peg$c89 = function(b) { return ["buffer", b.join('')].concat([['line', line()], ['col', column()]]) }, + peg$c90 = { type: "other", description: "literal" }, + peg$c91 = /^[^"]/, + peg$c92 = { type: "class", value: "[^\"]", description: "[^\"]" }, + peg$c93 = function(b) { return b.join('') }, + peg$c94 = "\\\"", + peg$c95 = { type: "literal", value: "\\\"", description: "\"\\\\\\\"\"" }, + peg$c96 = function() { return '"' }, + peg$c97 = { type: "other", description: "raw" }, + peg$c98 = "{`", + peg$c99 = { type: "literal", value: "{`", description: "\"{`\"" }, + peg$c100 = "`}", + peg$c101 = { type: "literal", value: "`}", description: "\"`}\"" }, + peg$c102 = function(char) {return char}, + peg$c103 = function(rawText) { return ["raw", rawText.join('')].concat([['line', line()], ['col', column()]]) }, + peg$c104 = { type: "other", description: "comment" }, + peg$c105 = "{!", + peg$c106 = { type: "literal", value: "{!", description: "\"{!\"" }, + peg$c107 = "!}", + peg$c108 = { type: "literal", value: "!}", description: "\"!}\"" }, + peg$c109 = function(c) { return ["comment", c.join('')].concat([['line', line()], ['col', column()]]) }, + peg$c110 = /^[#?\^><+%:@\/~%]/, + peg$c111 = { type: "class", value: "[#?\\^><+%:@\\/~%]", description: "[#?\\^><+%:@\\/~%]" }, + peg$c112 = "{", + peg$c113 = { type: "literal", value: "{", description: "\"{\"" }, + peg$c114 = "}", + peg$c115 = { type: "literal", value: "}", description: "\"}\"" }, + peg$c116 = "[", + peg$c117 = { type: "literal", value: "[", description: "\"[\"" }, + peg$c118 = "]", + peg$c119 = { type: "literal", value: "]", description: "\"]\"" }, + peg$c120 = "\n", + peg$c121 = { type: "literal", value: "\n", description: "\"\\n\"" }, + peg$c122 = "\r\n", + peg$c123 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" }, + peg$c124 = "\r", + peg$c125 = { type: "literal", value: "\r", description: "\"\\r\"" }, + peg$c126 = "\u2028", + peg$c127 = { type: "literal", value: "\u2028", description: "\"\\u2028\"" }, + peg$c128 = "\u2029", + peg$c129 = { type: "literal", value: "\u2029", description: "\"\\u2029\"" }, + peg$c130 = /^[\t\x0B\f \xA0\uFEFF]/, + peg$c131 = { type: "class", value: "[\\t\\x0B\\f \\xA0\\uFEFF]", description: "[\\t\\x0B\\f \\xA0\\uFEFF]" }, peg$currPos = 0, peg$reportedPos = 0, @@ -2159,7 +2164,7 @@ } function peg$parsefloat() { - var s0, s1, s2, s3, s4; + var s0, s1, s2, s3; peg$silentFails++; s0 = peg$currPos; @@ -2173,16 +2178,7 @@ if (peg$silentFails === 0) { peg$fail(peg$c51); } } if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseinteger(); - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseinteger(); - } - } else { - s3 = peg$c3; - } + s3 = peg$parseunsigned_integer(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c52(s1, s3); @@ -2208,7 +2204,7 @@ return s0; } - function peg$parseinteger() { + function peg$parseunsigned_integer() { var s0, s1, s2; peg$silentFails++; @@ -2249,6 +2245,58 @@ return s0; } + function peg$parsesigned_integer() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c58; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c59); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseunsigned_integer(); + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c60(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c3; + } + } else { + peg$currPos = s0; + s0 = peg$c3; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c57); } + } + + return s0; + } + + function peg$parseinteger() { + var s0, s1; + + peg$silentFails++; + s0 = peg$parsesigned_integer(); + if (s0 === peg$FAILED) { + s0 = peg$parseunsigned_integer(); + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + + return s0; + } + function peg$parsepath() { var s0, s1, s2, s3; @@ -2277,7 +2325,7 @@ } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c58(s1, s2); + s1 = peg$c63(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -2311,7 +2359,7 @@ } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c64(s2); s0 = s1; } else { peg$currPos = s0; @@ -2325,7 +2373,7 @@ peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } + if (peg$silentFails === 0) { peg$fail(peg$c62); } } return s0; @@ -2336,35 +2384,35 @@ peg$silentFails++; s0 = peg$currPos; - if (peg$c61.test(input.charAt(peg$currPos))) { + if (peg$c66.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c62); } + if (peg$silentFails === 0) { peg$fail(peg$c67); } } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c63.test(input.charAt(peg$currPos))) { + if (peg$c68.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } + if (peg$silentFails === 0) { peg$fail(peg$c69); } } while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c63.test(input.charAt(peg$currPos))) { + if (peg$c68.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } + if (peg$silentFails === 0) { peg$fail(peg$c69); } } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c65(s1, s2); + s1 = peg$c70(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -2377,7 +2425,7 @@ peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } + if (peg$silentFails === 0) { peg$fail(peg$c65); } } return s0; @@ -2416,7 +2464,7 @@ } if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c67(s4); + s4 = peg$c72(s4); } s3 = s4; if (s3 === peg$FAILED) { @@ -2426,7 +2474,7 @@ s4 = peg$parserb(); if (s4 !== peg$FAILED) { peg$reportedPos = s1; - s2 = peg$c68(s3); + s2 = peg$c73(s3); s1 = s2; } else { peg$currPos = s1; @@ -2447,7 +2495,7 @@ } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c69(s1, s2); + s1 = peg$c74(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -2460,7 +2508,7 @@ peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } + if (peg$silentFails === 0) { peg$fail(peg$c71); } } return s0; @@ -2484,7 +2532,7 @@ s4 = peg$parsekey(); if (s4 !== peg$FAILED) { peg$reportedPos = s2; - s3 = peg$c71(s4); + s3 = peg$c76(s4); s2 = s3; } else { peg$currPos = s2; @@ -2509,7 +2557,7 @@ s4 = peg$parsekey(); if (s4 !== peg$FAILED) { peg$reportedPos = s2; - s3 = peg$c71(s4); + s3 = peg$c76(s4); s2 = s3; } else { peg$currPos = s2; @@ -2530,7 +2578,7 @@ } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c72(s1, s2); + s1 = peg$c77(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -2543,7 +2591,7 @@ peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { peg$fail(peg$c75); } } return s0; @@ -2555,23 +2603,23 @@ peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c74; + s1 = peg$c79; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c74; + s2 = peg$c79; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c76(); + s1 = peg$c81(); s0 = s1; } else { peg$currPos = s0; @@ -2584,25 +2632,25 @@ if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c74; + s1 = peg$c79; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s1 !== peg$FAILED) { s2 = peg$parseliteral(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c74; + s3 = peg$c79; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c77(s2); + s1 = peg$c82(s2); s0 = s1; } else { peg$currPos = s0; @@ -2619,11 +2667,11 @@ if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c74; + s1 = peg$c79; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s1 !== peg$FAILED) { s2 = []; @@ -2638,15 +2686,15 @@ } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c74; + s3 = peg$c79; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c78(s2); + s1 = peg$c83(s2); s0 = s1; } else { peg$currPos = s0; @@ -2665,7 +2713,7 @@ peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c78); } } return s0; @@ -2682,7 +2730,7 @@ s1 = peg$parseliteral(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c79(s1); + s1 = peg$c84(s1); } s0 = s1; } @@ -2706,7 +2754,7 @@ } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c81(s1, s2); + s1 = peg$c86(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -2769,11 +2817,11 @@ peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s7 !== peg$FAILED) { peg$reportedPos = s2; - s3 = peg$c83(s7); + s3 = peg$c88(s7); s2 = s3; } else { peg$currPos = s2; @@ -2848,11 +2896,11 @@ peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s7 !== peg$FAILED) { peg$reportedPos = s2; - s3 = peg$c83(s7); + s3 = peg$c88(s7); s2 = s3; } else { peg$currPos = s2; @@ -2880,14 +2928,14 @@ } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c84(s1); + s1 = peg$c89(s1); } s0 = s1; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c80); } + if (peg$silentFails === 0) { peg$fail(peg$c85); } } return s0; @@ -2913,17 +2961,17 @@ if (s3 !== peg$FAILED) { s4 = peg$parseesc(); if (s4 === peg$FAILED) { - if (peg$c86.test(input.charAt(peg$currPos))) { + if (peg$c91.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c87); } + if (peg$silentFails === 0) { peg$fail(peg$c92); } } } if (s4 !== peg$FAILED) { peg$reportedPos = s2; - s3 = peg$c83(s4); + s3 = peg$c88(s4); s2 = s3; } else { peg$currPos = s2; @@ -2950,17 +2998,17 @@ if (s3 !== peg$FAILED) { s4 = peg$parseesc(); if (s4 === peg$FAILED) { - if (peg$c86.test(input.charAt(peg$currPos))) { + if (peg$c91.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c87); } + if (peg$silentFails === 0) { peg$fail(peg$c92); } } } if (s4 !== peg$FAILED) { peg$reportedPos = s2; - s3 = peg$c83(s4); + s3 = peg$c88(s4); s2 = s3; } else { peg$currPos = s2; @@ -2976,13 +3024,13 @@ } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c88(s1); + s1 = peg$c93(s1); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c85); } + if (peg$silentFails === 0) { peg$fail(peg$c90); } } return s0; @@ -2992,16 +3040,16 @@ var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c89) { - s1 = peg$c89; + if (input.substr(peg$currPos, 2) === peg$c94) { + s1 = peg$c94; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { peg$fail(peg$c95); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c91(); + s1 = peg$c96(); } s0 = s1; @@ -3013,24 +3061,24 @@ peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c93) { - s1 = peg$c93; + if (input.substr(peg$currPos, 2) === peg$c98) { + s1 = peg$c98; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c94); } + if (peg$silentFails === 0) { peg$fail(peg$c99); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c95) { - s5 = peg$c95; + if (input.substr(peg$currPos, 2) === peg$c100) { + s5 = peg$c100; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } + if (peg$silentFails === 0) { peg$fail(peg$c101); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -3045,11 +3093,11 @@ peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s5 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c97(s5); + s4 = peg$c102(s5); s3 = s4; } else { peg$currPos = s3; @@ -3064,12 +3112,12 @@ s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c95) { - s5 = peg$c95; + if (input.substr(peg$currPos, 2) === peg$c100) { + s5 = peg$c100; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } + if (peg$silentFails === 0) { peg$fail(peg$c101); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -3084,11 +3132,11 @@ peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s5 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c97(s5); + s4 = peg$c102(s5); s3 = s4; } else { peg$currPos = s3; @@ -3100,16 +3148,16 @@ } } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c95) { - s3 = peg$c95; + if (input.substr(peg$currPos, 2) === peg$c100) { + s3 = peg$c100; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } + if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c98(s2); + s1 = peg$c103(s2); s0 = s1; } else { peg$currPos = s0; @@ -3126,7 +3174,7 @@ peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c92); } + if (peg$silentFails === 0) { peg$fail(peg$c97); } } return s0; @@ -3137,24 +3185,24 @@ peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c100) { - s1 = peg$c100; + if (input.substr(peg$currPos, 2) === peg$c105) { + s1 = peg$c105; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c101); } + if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c102) { - s5 = peg$c102; + if (input.substr(peg$currPos, 2) === peg$c107) { + s5 = peg$c107; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c103); } + if (peg$silentFails === 0) { peg$fail(peg$c108); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -3169,11 +3217,11 @@ peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s5 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c83(s5); + s4 = peg$c88(s5); s3 = s4; } else { peg$currPos = s3; @@ -3188,12 +3236,12 @@ s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c102) { - s5 = peg$c102; + if (input.substr(peg$currPos, 2) === peg$c107) { + s5 = peg$c107; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c103); } + if (peg$silentFails === 0) { peg$fail(peg$c108); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -3208,11 +3256,11 @@ peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s5 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c83(s5); + s4 = peg$c88(s5); s3 = s4; } else { peg$currPos = s3; @@ -3224,16 +3272,16 @@ } } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c102) { - s3 = peg$c102; + if (input.substr(peg$currPos, 2) === peg$c107) { + s3 = peg$c107; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c103); } + if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c104(s2); + s1 = peg$c109(s2); s0 = s1; } else { peg$currPos = s0; @@ -3250,7 +3298,7 @@ peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c99); } + if (peg$silentFails === 0) { peg$fail(peg$c104); } } return s0; @@ -3269,12 +3317,12 @@ s3 = peg$parsews(); } if (s2 !== peg$FAILED) { - if (peg$c105.test(input.charAt(peg$currPos))) { + if (peg$c110.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c106); } + if (peg$silentFails === 0) { peg$fail(peg$c111); } } if (s3 !== peg$FAILED) { s4 = []; @@ -3313,7 +3361,7 @@ peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s9 !== peg$FAILED) { s7 = [s7, s8, s9]; @@ -3361,7 +3409,7 @@ peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s9 !== peg$FAILED) { s7 = [s7, s8, s9]; @@ -3433,11 +3481,11 @@ var s0; if (input.charCodeAt(peg$currPos) === 123) { - s0 = peg$c107; + s0 = peg$c112; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c108); } + if (peg$silentFails === 0) { peg$fail(peg$c113); } } return s0; @@ -3447,11 +3495,11 @@ var s0; if (input.charCodeAt(peg$currPos) === 125) { - s0 = peg$c109; + s0 = peg$c114; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } + if (peg$silentFails === 0) { peg$fail(peg$c115); } } return s0; @@ -3461,11 +3509,11 @@ var s0; if (input.charCodeAt(peg$currPos) === 91) { - s0 = peg$c111; + s0 = peg$c116; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c112); } + if (peg$silentFails === 0) { peg$fail(peg$c117); } } return s0; @@ -3475,11 +3523,11 @@ var s0; if (input.charCodeAt(peg$currPos) === 93) { - s0 = peg$c113; + s0 = peg$c118; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c114); } + if (peg$silentFails === 0) { peg$fail(peg$c119); } } return s0; @@ -3489,43 +3537,43 @@ var s0; if (input.charCodeAt(peg$currPos) === 10) { - s0 = peg$c115; + s0 = peg$c120; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c116); } + if (peg$silentFails === 0) { peg$fail(peg$c121); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c117) { - s0 = peg$c117; + if (input.substr(peg$currPos, 2) === peg$c122) { + s0 = peg$c122; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c118); } + if (peg$silentFails === 0) { peg$fail(peg$c123); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 13) { - s0 = peg$c119; + s0 = peg$c124; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c120); } + if (peg$silentFails === 0) { peg$fail(peg$c125); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8232) { - s0 = peg$c121; + s0 = peg$c126; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c122); } + if (peg$silentFails === 0) { peg$fail(peg$c127); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8233) { - s0 = peg$c123; + s0 = peg$c128; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } + if (peg$silentFails === 0) { peg$fail(peg$c129); } } } } @@ -3538,12 +3586,12 @@ function peg$parsews() { var s0; - if (peg$c125.test(input.charAt(peg$currPos))) { + if (peg$c130.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c126); } + if (peg$silentFails === 0) { peg$fail(peg$c131); } } if (s0 === peg$FAILED) { s0 = peg$parseeol(); @@ -3811,7 +3859,7 @@ }, format: function(context, node) { - return '.w(' + escape(node[1] + node[2]) + ')'; + return '.w(' + escape(node[1]) + ')'; }, reference: function(context, node) { diff --git a/dist/dust-full.min.js b/dist/dust-full.min.js index 2942cb5b..cbae50ce 100644 --- a/dist/dust-full.min.js +++ b/dist/dust-full.min.js @@ -1,5 +1,5 @@ -/*! Dust - Asynchronous Templating - v2.6.0 +/*! Dust - Asynchronous Templating - v2.6.1 * http://linkedin.github.io/dustjs/ * Copyright (c) 2015 Aleksander Williams; Released under the MIT License */ -!function(root){function Context(a,b,c,d){this.stack=a,this.global=b,this.blocks=c,this.templateName=d}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.6.0"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",loggingLevels=[DEBUG,INFO,WARN,ERROR,NONE],EMPTY_FUNC=function(){},logger={},originalLog,loggerContext;dust.debugLevel=NONE,dust.config={whitespace:!1,amd:!1},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},root&&root.console&&root.console.log&&(loggerContext=root.console,originalLog=root.console.log),logger.log=loggerContext?function(){logger.log="function"==typeof originalLog?function(){originalLog.apply(loggerContext,arguments)}:function(){var a=Array.prototype.slice.apply(arguments).join(" ");originalLog(a)},logger.log.apply(this,arguments)}:function(){},dust.log=function(a,b){b=b||INFO,dust.debugLevel!==NONE&&dust.indexInArray(loggingLevels,b)>=dust.indexInArray(loggingLevels,dust.debugLevel)&&(dust.logQueue||(dust.logQueue=[]),dust.logQueue.push({message:a,type:b}),logger.log("[DUST:"+b+"]",a))},dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(dust.cache[a]=b)},dust.render=function(a,b,c){var d=new Stub(c).head;try{dust.load(a,d,Context.wrap(b,a)).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{dust.load(a,c.head,Context.wrap(b,a)).end()}catch(e){d.setError(e)}}),c},dust.renderSource=function(a,b,c){return dust.compileFn(a)(b,c)},dust.compileFn=function(a,b){b=b||null;var c=dust.loadSource(dust.compile(a,b));return function(a,d){var e=d?new Stub(d):new Stream;return dust.nextTick(function(){"function"==typeof c?c(e.head,Context.wrap(a,b)).end():dust.log(new Error("Template ["+b+"] cannot be resolved to a Dust function"),ERROR)}),e}},dust.load=function(a,b,c){var d=dust.cache[a];return d?d(b,c):dust.onLoad?b.map(function(b){dust.onLoad(a,function(d,e){return d?b.setError(d):(dust.cache[a]||dust.loadSource(dust.compile(e,a)),void dust.cache[a](b,c).end())})}):b.setError(new Error("Template Not Found: "+a))},dust.loadSource=function(source,path){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.indexInArray=function(a,b,c){if(c=+c||0,Array.prototype.indexOf)return a.indexOf(b,c);if(void 0===a||null===a)throw new TypeError('cannot call method "indexOf" of null');var d=a.length;for(1/0===Math.abs(c)&&(c=0),0>c&&(c+=d,0>c&&(c=0));d>c;c++)if(a[c]===b)return c;return-1},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return dust.isArray(a)&&!a.length?!0:0===a?!1:!a},dust.filter=function(a,b,c){if(c)for(var d=0,e=c.length;e>d;d++){var f=c[d];"s"===f?b=null:"function"==typeof dust.filters[f]?a=dust.filters[f](a):dust.log("Invalid filter ["+f+"]",WARN)}return b&&(a=dust.filters[b](a)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined. JSON parse has not been used on ["+a+"]",WARN),a)}},dust.makeBase=function(a){return new Context(new Stack,a)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(new Stack(a),{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack,i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global?this.global[d]:void 0}for(;h&&e>i;)f=h,h=h[b[i]],i++}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find the value for reference [{"+b.join(".")+"}] in template ["+this.getTemplateName()+"]"),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return new Context(new Stack(a,this.stack,b,c),this.global,this.blocks,this.getTemplateName())},Context.prototype.rebase=function(a){return new Context(new Stack(a),this.global,this.blocks,this.getTemplateName())},Context.prototype.current=function(){return this.stack.head},Context.prototype.getBlock=function(a){if("function"==typeof a){var b=new Chunk;a=a(b,this).data.join("")}var c=this.blocks;if(!c)return void dust.log("No blocks for context[{"+a+"}] in template ["+this.getTemplateName()+"]",DEBUG);for(var d,e=c.length;e--;)if(d=c[e][a])return d},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,b,this.getTemplateName())):this},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Chunk error ["+a.error+"] thrown. Ceasing to render this template.",WARN),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),dust.log("Chunk error ["+a.error+"] thrown. Ceasing to render this template.",WARN),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){if(!this.events)return dust.log("No events to emit",INFO),!1;var c=this.events[a];if(!c)return dust.log("Event type ["+a+"] does not exist",WARN),!1;if("function"==typeof c)c(b);else if(dust.isArray(c))for(var d=c.slice(0),e=0,f=d.length;f>e;e++)d[e](b);else dust.log("Event Handler ["+c+"] is not of a type that is handled by emit",WARN)},Stream.prototype.on=function(a,b){return this.events||(this.events={}),this.events[a]?"function"==typeof this.events[a]?this.events[a]=[this.events[a],b]:this.events[a].push(b):b?this.events[a]=b:dust.log("Callback for type ["+a+"] does not exist. Listener not registered.",WARN),this},Stream.prototype.pipe=function(a){return this.on("data",function(b){try{a.write(b,"utf8")}catch(c){dust.log(c,ERROR)}}).on("end",function(){try{return a.end()}catch(b){dust.log(b,ERROR)}}).on("error",function(b){a.error(b)}),this},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a&&(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk)?a:dust.isEmpty(a)?this:this.write(dust.filter(a,c,d))},Chunk.prototype.section=function(a,b,c,d){if("function"==typeof a&&!a.__dustBody){try{a=a.apply(b.current(),[this,b,c,d])}catch(e){return dust.log(e,ERROR),this.setError(e)}if(a instanceof Chunk)return a}var f=c.block,g=c["else"];if(d&&(b=b.push(d)),dust.isArray(a)){if(f){var h=a.length,i=this;if(h>0){b.stack.head&&(b.stack.head.$len=h);for(var j=0;h>j;j++)b.stack.head&&(b.stack.head.$idx=j),i=f(i,b.push(a[j],j,h));return b.stack.head&&(b.stack.head.$idx=void 0,b.stack.head.$len=void 0),i}if(g)return g(this,b)}}else if(a===!0){if(f)return f(this,b)}else if(a||0===a){if(f)return f(this,b.push(a))}else if(g)return g(this,b);return dust.log("Not rendering section (#) block in template ["+b.getTemplateName()+"], because above key was not found",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else if(d)return d(this,b);return dust.log("Not rendering exists (?) block in template ["+b.getTemplateName()+"], because above key was not found",DEBUG),this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b)}else if(e)return e(this,b);return dust.log("Not rendering not exists (^) block check in template ["+b.getTemplateName()+"], because above key was found",DEBUG),this},Chunk.prototype.block=function(a,b,c){var d=c.block;return a&&(d=a),d?d(this,b):this},Chunk.prototype.partial=function(a,b,c){var d;d=dust.makeBase(b.global),d.blocks=b.blocks,b.stack&&b.stack.tail&&(d.stack=b.stack.tail),c&&(d=d.push(c)),"string"==typeof a&&(d.templateName=a),d=d.push(b.stack.head);var e;return e="function"==typeof a?this.capture(a,d,function(a,b){d.templateName=d.templateName||a,dust.load(a,b,d).end()}):dust.load(a,this,d)},Chunk.prototype.helper=function(a,b,c,d){var e=this;if(!dust.helpers[a])return dust.log("Invalid helper ["+a+"]",WARN),e;try{return dust.helpers[a](e,b,c,d)}catch(f){return dust.log("Error in "+a+" helper: "+f,ERROR),e.setError(f)}},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined. JSON stringify has not been used on ["+a+"]",WARN),a)},"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",function(){return dust}):"object"==typeof exports?module.exports=dust:root.dust=dust}(function(){return this}()),function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.parse",["dust.core"],function(dust){return b(dust).parse}):"object"==typeof exports?module.exports=b(require("./dust")):b(a.dust)}(this,function(dust){var a=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,b,c,d,e,f){this.message=a,this.expected=b,this.found=c,this.offset=d,this.line=e,this.column=f,this.name="SyntaxError"}function c(a){function c(){return f(nd).line}function d(){return f(nd).column}function e(a){throw h(a,null,nd)}function f(b){function c(b,c,d){var e,f;for(e=c;d>e;e++)f=a.charAt(e),"\n"===f?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(b.line++,b.column=1,b.seenCR=!0):(b.column++,b.seenCR=!1)}return od!==b&&(od>b&&(od=0,pd={line:1,column:1,seenCR:!1}),c(pd,od,b),od=b),pd}function g(a){qd>md||(md>qd&&(qd=md,rd=[]),rd.push(a))}function h(c,d,e){function g(a){var b=1;for(a.sort(function(a,b){return a.descriptionb.description?1:0});b1?g.slice(0,-1).join(", ")+" or "+g[a.length-1]:g[0],e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}var i=f(e),j=emd?(j=a.charAt(md),md++):(j=T,0===sd&&g(vc)),j!==T?(nd=d,e=wc(j),d=e):(md=d,d=Y)):(md=d,d=Y)):(md=d,d=Y)):(md=d,d=Y)):(md=d,d=Y),d!==T)for(;d!==T;)c.push(d),d=md,e=md,sd++,f=K(),sd--,f===T?e=_:(md=e,e=Y),e!==T?(f=md,sd++,h=I(),sd--,h===T?f=_:(md=f,f=Y),f!==T?(h=md,sd++,i=J(),sd--,i===T?h=_:(md=h,h=Y),h!==T?(i=md,sd++,j=P(),sd--,j===T?i=_:(md=i,i=Y),i!==T?(a.length>md?(j=a.charAt(md),md++):(j=T,0===sd&&g(vc)),j!==T?(nd=d,e=wc(j),d=e):(md=d,d=Y)):(md=d,d=Y)):(md=d,d=Y)):(md=d,d=Y)):(md=d,d=Y);else c=Y;c!==T&&(nd=b,c=xc(c)),b=c}return sd--,b===T&&(c=T,0===sd&&g(tc)),b}function G(){var b,c,d,e,f;if(sd++,b=md,c=[],d=md,e=md,sd++,f=K(),sd--,f===T?e=_:(md=e,e=Y),e!==T?(f=H(),f===T&&(zc.test(a.charAt(md))?(f=a.charAt(md),md++):(f=T,0===sd&&g(Ac))),f!==T?(nd=d,e=wc(f),d=e):(md=d,d=Y)):(md=d,d=Y),d!==T)for(;d!==T;)c.push(d),d=md,e=md,sd++,f=K(),sd--,f===T?e=_:(md=e,e=Y),e!==T?(f=H(),f===T&&(zc.test(a.charAt(md))?(f=a.charAt(md),md++):(f=T,0===sd&&g(Ac))),f!==T?(nd=d,e=wc(f),d=e):(md=d,d=Y)):(md=d,d=Y);else c=Y;return c!==T&&(nd=b,c=Bc(c)),b=c,sd--,b===T&&(c=T,0===sd&&g(yc)),b}function H(){var b,c;return b=md,a.substr(md,2)===Cc?(c=Cc,md+=2):(c=T,0===sd&&g(Dc)),c!==T&&(nd=b,c=Ec()),b=c}function I(){var b,c,d,e,f,h;if(sd++,b=md,a.substr(md,2)===Gc?(c=Gc,md+=2):(c=T,0===sd&&g(Hc)),c!==T){for(d=[],e=md,f=md,sd++,a.substr(md,2)===Ic?(h=Ic,md+=2):(h=T,0===sd&&g(Jc)),sd--,h===T?f=_:(md=f,f=Y),f!==T?(a.length>md?(h=a.charAt(md),md++):(h=T,0===sd&&g(vc)),h!==T?(nd=e,f=Kc(h),e=f):(md=e,e=Y)):(md=e,e=Y);e!==T;)d.push(e),e=md,f=md,sd++,a.substr(md,2)===Ic?(h=Ic,md+=2):(h=T,0===sd&&g(Jc)),sd--,h===T?f=_:(md=f,f=Y),f!==T?(a.length>md?(h=a.charAt(md),md++):(h=T,0===sd&&g(vc)),h!==T?(nd=e,f=Kc(h),e=f):(md=e,e=Y)):(md=e,e=Y);d!==T?(a.substr(md,2)===Ic?(e=Ic,md+=2):(e=T,0===sd&&g(Jc)),e!==T?(nd=b,c=Lc(d),b=c):(md=b,b=Y)):(md=b,b=Y)}else md=b,b=Y;return sd--,b===T&&(c=T,0===sd&&g(Fc)),b}function J(){var b,c,d,e,f,h;if(sd++,b=md,a.substr(md,2)===Nc?(c=Nc,md+=2):(c=T,0===sd&&g(Oc)),c!==T){for(d=[],e=md,f=md,sd++,a.substr(md,2)===Pc?(h=Pc,md+=2):(h=T,0===sd&&g(Qc)),sd--,h===T?f=_:(md=f,f=Y),f!==T?(a.length>md?(h=a.charAt(md),md++):(h=T,0===sd&&g(vc)),h!==T?(nd=e,f=wc(h),e=f):(md=e,e=Y)):(md=e,e=Y);e!==T;)d.push(e),e=md,f=md,sd++,a.substr(md,2)===Pc?(h=Pc,md+=2):(h=T,0===sd&&g(Qc)),sd--,h===T?f=_:(md=f,f=Y),f!==T?(a.length>md?(h=a.charAt(md),md++):(h=T,0===sd&&g(vc)),h!==T?(nd=e,f=wc(h),e=f):(md=e,e=Y)):(md=e,e=Y);d!==T?(a.substr(md,2)===Pc?(e=Pc,md+=2):(e=T,0===sd&&g(Qc)),e!==T?(nd=b,c=Rc(d),b=c):(md=b,b=Y)):(md=b,b=Y)}else md=b,b=Y;return sd--,b===T&&(c=T,0===sd&&g(Mc)),b}function K(){var b,c,d,e,f,h,i,j,k,l;if(b=md,c=L(),c!==T){for(d=[],e=Q();e!==T;)d.push(e),e=Q();if(d!==T)if(Sc.test(a.charAt(md))?(e=a.charAt(md),md++):(e=T,0===sd&&g(Tc)),e!==T){for(f=[],h=Q();h!==T;)f.push(h),h=Q();if(f!==T){if(h=[],i=md,j=md,sd++,k=M(),sd--,k===T?j=_:(md=j,j=Y),j!==T?(k=md,sd++,l=P(),sd--,l===T?k=_:(md=k,k=Y),k!==T?(a.length>md?(l=a.charAt(md),md++):(l=T,0===sd&&g(vc)),l!==T?(j=[j,k,l],i=j):(md=i,i=Y)):(md=i,i=Y)):(md=i,i=Y),i!==T)for(;i!==T;)h.push(i),i=md,j=md,sd++,k=M(),sd--,k===T?j=_:(md=j,j=Y),j!==T?(k=md,sd++,l=P(),sd--,l===T?k=_:(md=k,k=Y),k!==T?(a.length>md?(l=a.charAt(md),md++):(l=T,0===sd&&g(vc)),l!==T?(j=[j,k,l],i=j):(md=i,i=Y)):(md=i,i=Y)):(md=i,i=Y);else h=Y;if(h!==T){for(i=[],j=Q();j!==T;)i.push(j),j=Q();i!==T?(j=M(),j!==T?(c=[c,d,e,f,h,i,j],b=c):(md=b,b=Y)):(md=b,b=Y)}else md=b,b=Y}else md=b,b=Y}else md=b,b=Y;else md=b,b=Y}else md=b,b=Y;return b===T&&(b=r()),b}function L(){var b;return 123===a.charCodeAt(md)?(b=Uc,md++):(b=T,0===sd&&g(Vc)),b}function M(){var b;return 125===a.charCodeAt(md)?(b=Wc,md++):(b=T,0===sd&&g(Xc)),b}function N(){var b;return 91===a.charCodeAt(md)?(b=Yc,md++):(b=T,0===sd&&g(Zc)),b}function O(){var b;return 93===a.charCodeAt(md)?(b=$c,md++):(b=T,0===sd&&g(_c)),b}function P(){var b;return 10===a.charCodeAt(md)?(b=ad,md++):(b=T,0===sd&&g(bd)),b===T&&(a.substr(md,2)===cd?(b=cd,md+=2):(b=T,0===sd&&g(dd)),b===T&&(13===a.charCodeAt(md)?(b=ed,md++):(b=T,0===sd&&g(fd)),b===T&&(8232===a.charCodeAt(md)?(b=gd,md++):(b=T,0===sd&&g(hd)),b===T&&(8233===a.charCodeAt(md)?(b=id,md++):(b=T,0===sd&&g(jd)))))),b}function Q(){var b;return kd.test(a.charAt(md))?(b=a.charAt(md),md++):(b=T,0===sd&&g(ld)),b===T&&(b=P()),b}var R,S=arguments.length>1?arguments[1]:{},T={},U={start:i},V=i,W=function(a){return["body"].concat(a).concat([["line",c()],["col",d()]])},X={type:"other",description:"section"},Y=T,Z=null,$=function(a,b,c,d){return d&&a[1].text===d.text||e("Expected end tag for "+a[1].text+" but it was not found."),!0},_=void 0,ab=function(a,b,e){return e.push(["param",["literal","block"],b]),a.push(e),a.concat([["line",c()],["col",d()]])},bb="/",cb={type:"literal",value:"/",description:'"/"'},db=function(a){return a.push(["bodies"]),a.concat([["line",c()],["col",d()]])},eb=/^[#?\^<+@%]/,fb={type:"class",value:"[#?\\^<+@%]",description:"[#?\\^<+@%]"},gb=function(a,b,c,d){return[a,b,c,d]},hb={type:"other",description:"end tag"},ib=function(a){return a},jb=":",kb={type:"literal",value:":",description:'":"'},lb=function(a){return a},mb=function(a){return a?["context",a]:["context"]},nb={type:"other",description:"params"},ob="=",pb={type:"literal",value:"=",description:'"="'},qb=function(a,b){return["param",["literal",a],b]},rb=function(a){return["params"].concat(a)},sb={type:"other",description:"bodies"},tb=function(a){return["bodies"].concat(a)},ub={type:"other",description:"reference"},vb=function(a,b){return["reference",a,b].concat([["line",c()],["col",d()]])},wb={type:"other",description:"partial"},xb=">",yb={type:"literal",value:">",description:'">"'},zb="+",Ab={type:"literal",value:"+",description:'"+"'},Bb=function(a){return["literal",a]},Cb=function(a,b,e,f){var g=">"===a?"partial":a;return[g,b,e,f].concat([["line",c()],["col",d()]])},Db={type:"other",description:"filters"},Eb="|",Fb={type:"literal",value:"|",description:'"|"'},Gb=function(a){return["filters"].concat(a)},Hb={type:"other",description:"special"},Ib="~",Jb={type:"literal",value:"~",description:'"~"'},Kb=function(a){return["special",a].concat([["line",c()],["col",d()]])},Lb={type:"other",description:"identifier"},Mb=function(a){var b=["path"].concat(a);return b.text=a[1].join(".").replace(/,line,\d+,col,\d+/g,""),b},Nb=function(a){var b=["key",a];return b.text=a,b},Ob={type:"other",description:"number"},Pb=function(a){return["literal",a]},Qb={type:"other",description:"float"},Rb=".",Sb={type:"literal",value:".",description:'"."'},Tb=function(a,b){return parseFloat(a+"."+b.join(""))},Ub={type:"other",description:"integer"},Vb=/^[0-9]/,Wb={type:"class",value:"[0-9]",description:"[0-9]"},Xb=function(a){return parseInt(a.join(""),10)},Yb={type:"other",description:"path"},Zb=function(a,b){return b=b[0],a&&b?(b.unshift(a),[!1,b].concat([["line",c()],["col",d()]])):[!0,b].concat([["line",c()],["col",d()]])},$b=function(a){return a.length>0?[!0,a[0]].concat([["line",c()],["col",d()]]):[!0,[]].concat([["line",c()],["col",d()]])},_b={type:"other",description:"key"},ac=/^[a-zA-Z_$]/,bc={type:"class",value:"[a-zA-Z_$]",description:"[a-zA-Z_$]"},cc=/^[0-9a-zA-Z_$\-]/,dc={type:"class",value:"[0-9a-zA-Z_$\\-]",description:"[0-9a-zA-Z_$\\-]"},ec=function(a,b){return a+b.join("")},fc={type:"other",description:"array"},gc=function(a){return a.join("")},hc=function(a){return a},ic=function(a,b){return b?b.unshift(a):b=[a],b},jc={type:"other",description:"array_part"},kc=function(a){return a},lc=function(a,b){return b?a.concat(b):a},mc={type:"other",description:"inline"},nc='"',oc={type:"literal",value:'"',description:'"\\""'},pc=function(){return["literal",""].concat([["line",c()],["col",d()]])},qc=function(a){return["literal",a].concat([["line",c()],["col",d()]])},rc=function(a){return["body"].concat(a).concat([["line",c()],["col",d()]])},sc=function(a){return["buffer",a]},tc={type:"other",description:"buffer"},uc=function(a,b){return["format",a,b.join("")].concat([["line",c()],["col",d()]])},vc={type:"any",description:"any character"},wc=function(a){return a},xc=function(a){return["buffer",a.join("")].concat([["line",c()],["col",d()]])},yc={type:"other",description:"literal"},zc=/^[^"]/,Ac={type:"class",value:'[^"]',description:'[^"]'},Bc=function(a){return a.join("")},Cc='\\"',Dc={type:"literal",value:'\\"',description:'"\\\\\\""'},Ec=function(){return'"'},Fc={type:"other",description:"raw"},Gc="{`",Hc={type:"literal",value:"{`",description:'"{`"'},Ic="`}",Jc={type:"literal",value:"`}",description:'"`}"'},Kc=function(a){return a},Lc=function(a){return["raw",a.join("")].concat([["line",c()],["col",d()]])},Mc={type:"other",description:"comment"},Nc="{!",Oc={type:"literal",value:"{!",description:'"{!"'},Pc="!}",Qc={type:"literal",value:"!}",description:'"!}"'},Rc=function(a){return["comment",a.join("")].concat([["line",c()],["col",d()]])},Sc=/^[#?\^><+%:@\/~%]/,Tc={type:"class",value:"[#?\\^><+%:@\\/~%]",description:"[#?\\^><+%:@\\/~%]"},Uc="{",Vc={type:"literal",value:"{",description:'"{"'},Wc="}",Xc={type:"literal",value:"}",description:'"}"'},Yc="[",Zc={type:"literal",value:"[",description:'"["'},$c="]",_c={type:"literal",value:"]",description:'"]"'},ad="\n",bd={type:"literal",value:"\n",description:'"\\n"'},cd="\r\n",dd={type:"literal",value:"\r\n",description:'"\\r\\n"'},ed="\r",fd={type:"literal",value:"\r",description:'"\\r"'},gd="\u2028",hd={type:"literal",value:"\u2028",description:'"\\u2028"'},id="\u2029",jd={type:"literal",value:"\u2029",description:'"\\u2029"'},kd=/^[\t\x0B\f \xA0\uFEFF]/,ld={type:"class",value:"[\\t\\x0B\\f \\xA0\\uFEFF]",description:"[\\t\\x0B\\f \\xA0\\uFEFF]"},md=0,nd=0,od=0,pd={line:1,column:1,seenCR:!1},qd=0,rd=[],sd=0;if("startRule"in S){if(!(S.startRule in U))throw new Error("Can't start parsing from rule \""+S.startRule+'".');V=U[S.startRule]}if(R=V(),R!==T&&md===a.length)return R;throw R!==T&&mdc;c++)e=o.filterNode(a,b[c]),e&&f.push(e);return f}function d(a,b){var c,d,e,f,g=[b[0]];for(d=1,e=b.length;e>d;d++)f=o.filterNode(a,b[d]),f&&("buffer"===f[0]||"format"===f[0]?c?(c[0]="buffer"===f[0]?"buffer":c[0],c[1]+=f.slice(1,-2).join("")):(c=f,g.push(f)):(c=null,g.push(f)));return g}function e(a,b){return["buffer",q[b[1]],b[2],b[3]]}function f(a,b){return b}function g(){}function h(a,b){return dust.config.whitespace?(b.splice(1,2,b.slice(1,-2).join("")),b):null}function i(a,b){var c={name:b,bodies:[],blocks:{},index:0,auto:"h"},d=dust.escapeJs(b),e="function(dust){dust.register("+(b?'"'+d+'"':"null")+","+o.compileNode(c,a)+");"+j(c)+k(c)+"return body_0;}"; -return dust.config.amd?'define("'+d+'",["dust.core"],'+e+");":"("+e+")(dust);"}function j(a){var b,c=[],d=a.blocks;for(b in d)c.push('"'+b+'":'+d[b]);return c.length?(a.blocks="ctx=ctx.shiftBlocks(blocks);","var blocks={"+c.join(",")+"};"):a.blocks=""}function k(a){var b,c,d=[],e=a.bodies,f=a.blocks;for(b=0,c=e.length;c>b;b++)d[b]="function body_"+b+"(chk,ctx){"+f+"return chk"+e[b]+";}body_"+b+".__dustBody=!0;";return d.join("")}function l(a,b){var c,d,e="";for(c=1,d=b.length;d>c;c++)e+=o.compileNode(a,b[c]);return e}function m(a,b,c){return"."+(dust._aliases[c]||c)+"("+o.compileNode(a,b[1])+","+o.compileNode(a,b[2])+","+o.compileNode(a,b[4])+","+o.compileNode(a,b[3])+")"}function n(a){return a.replace(r,"\\\\").replace(s,'\\"').replace(t,"\\f").replace(u,"\\n").replace(v,"\\r").replace(w,"\\t")}var o={},p=dust.isArray;o.compile=function(c,d){if(!d&&null!==d)throw new Error("Template name parameter cannot be undefined when calling dust.compile");try{var e=b(a(c));return i(e,d)}catch(f){if(!f.line||!f.column)throw f;throw new SyntaxError(f.message+" At line : "+f.line+", column : "+f.column)}},o.filterNode=function(a,b){return o.optimizers[b[0]](a,b)},o.optimizers={body:d,buffer:f,special:e,format:h,reference:c,"#":c,"?":c,"^":c,"<":c,"+":c,"@":c,"%":c,partial:c,context:c,params:c,bodies:c,param:c,filters:f,key:f,path:f,literal:f,raw:f,comment:g,line:g,col:g},o.pragmas={esc:function(a,b,c){var d,e=a.auto;return b||(b="h"),a.auto="s"===b?"":b,d=l(a,c.block),a.auto=e,d}};var q={s:" ",n:"\n",r:"\r",lb:"{",rb:"}"};o.compileNode=function(a,b){return o.nodes[b[0]](a,b)},o.nodes={body:function(a,b){var c=a.index++,d="body_"+c;return a.bodies[c]=l(a,b),d},buffer:function(a,b){return".w("+x(b[1])+")"},format:function(a,b){return".w("+x(b[1]+b[2])+")"},reference:function(a,b){return".f("+o.compileNode(a,b[1])+",ctx,"+o.compileNode(a,b[2])+")"},"#":function(a,b){return m(a,b,"section")},"?":function(a,b){return m(a,b,"exists")},"^":function(a,b){return m(a,b,"notexists")},"<":function(a,b){for(var c=b[4],d=1,e=c.length;e>d;d++){var f=c[d],g=f[1][1];if("block"===g)return a.blocks[b[1].text]=o.compileNode(a,f[2]),""}return""},"+":function(a,b){return"undefined"==typeof b[1].text&&"undefined"==typeof b[4]?".block(ctx.getBlock("+o.compileNode(a,b[1])+",chk, ctx),"+o.compileNode(a,b[2])+", {},"+o.compileNode(a,b[3])+")":".block(ctx.getBlock("+x(b[1].text)+"),"+o.compileNode(a,b[2])+","+o.compileNode(a,b[4])+","+o.compileNode(a,b[3])+")"},"@":function(a,b){return".h("+x(b[1].text)+","+o.compileNode(a,b[2])+","+o.compileNode(a,b[4])+","+o.compileNode(a,b[3])+")"},"%":function(a,b){var c,d,e,f,g,h,i,j,k,l=b[1][1];if(!o.pragmas[l])return"";for(c=b[4],d={},j=1,k=c.length;k>j;j++)h=c[j],d[h[1][1]]=h[2];for(e=b[3],f={},j=1,k=e.length;k>j;j++)i=e[j],f[i[1][1]]=i[2][1];return g=b[2][1]?b[2][1].text:null,o.pragmas[l](a,g,d,f)},partial:function(a,b){return".p("+o.compileNode(a,b[1])+","+o.compileNode(a,b[2])+","+o.compileNode(a,b[3])+")"},context:function(a,b){return b[1]?"ctx.rebase("+o.compileNode(a,b[1])+")":"ctx"},params:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(o.compileNode(a,b[d]));return c.length?"{"+c.join(",")+"}":"{}"},bodies:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(o.compileNode(a,b[d]));return"{"+c.join(",")+"}"},param:function(a,b){return o.compileNode(a,b[1])+":"+o.compileNode(a,b[2])},filters:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++){var f=b[d];c.push('"'+f+'"')}return'"'+a.auto+'"'+(c.length?",["+c.join(",")+"]":"")},key:function(a,b){return'ctx.get(["'+b[1]+'"], false)'},path:function(a,b){for(var c=b[1],d=b[2],e=[],f=0,g=d.length;g>f;f++)e.push(p(d[f])?o.compileNode(a,d[f]):'"'+d[f]+'"');return"ctx.getPath("+c+", ["+e.join(",")+"])"},literal:function(a,b){return x(b[1])},raw:function(a,b){return".w("+x(b[1])+")"}};var r=/\\/g,s=/"/g,t=/\f/g,u=/\n/g,v=/\r/g,w=/\t/g,x="undefined"==typeof JSON?function(a){return'"'+n(a)+'"'}:JSON.stringify;return dust.compile=o.compile,dust.filterNode=o.filterNode,dust.optimizers=o.optimizers,dust.pragmas=o.pragmas,dust.compileNode=o.compileNode,dust.nodes=o.nodes,o}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core","dust.compile"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file +!function(root){function Context(a,b,c,d){this.stack=a,this.global=b,this.blocks=c,this.templateName=d}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.6.1"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",loggingLevels=[DEBUG,INFO,WARN,ERROR,NONE],EMPTY_FUNC=function(){},logger={},originalLog,loggerContext;dust.debugLevel=NONE,dust.config={whitespace:!1,amd:!1},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},root&&root.console&&root.console.log&&(loggerContext=root.console,originalLog=root.console.log),logger.log=loggerContext?function(){logger.log="function"==typeof originalLog?function(){originalLog.apply(loggerContext,arguments)}:function(){var a=Array.prototype.slice.apply(arguments).join(" ");originalLog(a)},logger.log.apply(this,arguments)}:function(){},dust.log=function(a,b){b=b||INFO,dust.debugLevel!==NONE&&dust.indexInArray(loggingLevels,b)>=dust.indexInArray(loggingLevels,dust.debugLevel)&&(dust.logQueue||(dust.logQueue=[]),dust.logQueue.push({message:a,type:b}),logger.log("[DUST:"+b+"]",a))},dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(dust.cache[a]=b)},dust.render=function(a,b,c){var d=new Stub(c).head;try{dust.load(a,d,Context.wrap(b,a)).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{dust.load(a,c.head,Context.wrap(b,a)).end()}catch(e){d.setError(e)}}),c},dust.renderSource=function(a,b,c){return dust.compileFn(a)(b,c)},dust.compileFn=function(a,b){b=b||null;var c=dust.loadSource(dust.compile(a,b));return function(a,d){var e=d?new Stub(d):new Stream;return dust.nextTick(function(){"function"==typeof c?c(e.head,Context.wrap(a,b)).end():dust.log(new Error("Template ["+b+"] cannot be resolved to a Dust function"),ERROR)}),e}},dust.load=function(a,b,c){var d=dust.cache[a];return d?d(b,c):dust.onLoad?b.map(function(b){dust.onLoad(a,function(d,e){return d?b.setError(d):(dust.cache[a]||dust.loadSource(dust.compile(e,a)),void dust.cache[a](b,c).end())})}):b.setError(new Error("Template Not Found: "+a))},dust.loadSource=function(source,path){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.indexInArray=function(a,b,c){if(c=+c||0,Array.prototype.indexOf)return a.indexOf(b,c);if(void 0===a||null===a)throw new TypeError('cannot call method "indexOf" of null');var d=a.length;for(Math.abs(c)===1/0&&(c=0),0>c&&(c+=d,0>c&&(c=0));d>c;c++)if(a[c]===b)return c;return-1},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return dust.isArray(a)&&!a.length?!0:0===a?!1:!a},dust.filter=function(a,b,c){if(c)for(var d=0,e=c.length;e>d;d++){var f=c[d];"s"===f?b=null:"function"==typeof dust.filters[f]?a=dust.filters[f](a):dust.log("Invalid filter ["+f+"]",WARN)}return b&&(a=dust.filters[b](a)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined. JSON parse has not been used on ["+a+"]",WARN),a)}},dust.makeBase=function(a){return new Context(new Stack,a)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(new Stack(a),{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack,i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global?this.global[d]:void 0}for(;h&&e>i;)f=h,h=h[b[i]],i++}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find the value for reference [{"+b.join(".")+"}] in template ["+this.getTemplateName()+"]"),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return new Context(new Stack(a,this.stack,b,c),this.global,this.blocks,this.getTemplateName())},Context.prototype.rebase=function(a){return new Context(new Stack(a),this.global,this.blocks,this.getTemplateName())},Context.prototype.current=function(){return this.stack.head},Context.prototype.getBlock=function(a){if("function"==typeof a){var b=new Chunk;a=a(b,this).data.join("")}var c=this.blocks;if(!c)return void dust.log("No blocks for context[{"+a+"}] in template ["+this.getTemplateName()+"]",DEBUG);for(var d,e=c.length;e--;)if(d=c[e][a])return d},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,b,this.getTemplateName())):this},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Chunk error ["+a.error+"] thrown. Ceasing to render this template.",WARN),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),dust.log("Chunk error ["+a.error+"] thrown. Ceasing to render this template.",WARN),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){if(!this.events)return dust.log("No events to emit",INFO),!1;var c=this.events[a];if(!c)return dust.log("Event type ["+a+"] does not exist",WARN),!1;if("function"==typeof c)c(b);else if(dust.isArray(c))for(var d=c.slice(0),e=0,f=d.length;f>e;e++)d[e](b);else dust.log("Event Handler ["+c+"] is not of a type that is handled by emit",WARN)},Stream.prototype.on=function(a,b){return this.events||(this.events={}),this.events[a]?"function"==typeof this.events[a]?this.events[a]=[this.events[a],b]:this.events[a].push(b):b?this.events[a]=b:dust.log("Callback for type ["+a+"] does not exist. Listener not registered.",WARN),this},Stream.prototype.pipe=function(a){return this.on("data",function(b){try{a.write(b,"utf8")}catch(c){dust.log(c,ERROR)}}).on("end",function(){try{return a.end()}catch(b){dust.log(b,ERROR)}}).on("error",function(b){a.error(b)}),this},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a&&(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk)?a:dust.isEmpty(a)?this:this.write(dust.filter(a,c,d))},Chunk.prototype.section=function(a,b,c,d){if("function"==typeof a&&!a.__dustBody){try{a=a.apply(b.current(),[this,b,c,d])}catch(e){return dust.log(e,ERROR),this.setError(e)}if(a instanceof Chunk)return a}var f=c.block,g=c["else"];if(d&&(b=b.push(d)),dust.isArray(a)){if(f){var h=a.length,i=this;if(h>0){b.stack.head&&(b.stack.head.$len=h);for(var j=0;h>j;j++)b.stack.head&&(b.stack.head.$idx=j),i=f(i,b.push(a[j],j,h));return b.stack.head&&(b.stack.head.$idx=void 0,b.stack.head.$len=void 0),i}if(g)return g(this,b)}}else if(a===!0){if(f)return f(this,b)}else if(a||0===a){if(f)return f(this,b.push(a))}else if(g)return g(this,b);return dust.log("Not rendering section (#) block in template ["+b.getTemplateName()+"], because above key was not found",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else if(d)return d(this,b);return dust.log("Not rendering exists (?) block in template ["+b.getTemplateName()+"], because above key was not found",DEBUG),this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b)}else if(e)return e(this,b);return dust.log("Not rendering not exists (^) block check in template ["+b.getTemplateName()+"], because above key was found",DEBUG),this},Chunk.prototype.block=function(a,b,c){var d=c.block;return a&&(d=a),d?d(this,b):this},Chunk.prototype.partial=function(a,b,c){var d;d=dust.makeBase(b.global),d.blocks=b.blocks,b.stack&&b.stack.tail&&(d.stack=b.stack.tail),c&&(d=d.push(c)),"string"==typeof a&&(d.templateName=a),d=d.push(b.stack.head);var e;return e="function"==typeof a?this.capture(a,d,function(a,b){d.templateName=d.templateName||a,dust.load(a,b,d).end()}):dust.load(a,this,d)},Chunk.prototype.helper=function(a,b,c,d){var e=this;if(!dust.helpers[a])return dust.log("Invalid helper ["+a+"]",WARN),e;try{return dust.helpers[a](e,b,c,d)}catch(f){return dust.log("Error in "+a+" helper: "+f,ERROR),e.setError(f)}},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined. JSON stringify has not been used on ["+a+"]",WARN),a)},"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",function(){return dust}):"object"==typeof exports?module.exports=dust:root.dust=dust}(function(){return this}()),function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.parse",["dust.core"],function(dust){return b(dust).parse}):"object"==typeof exports?module.exports=b(require("./dust")):b(a.dust)}(this,function(dust){var a=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,b,c,d,e,f){this.message=a,this.expected=b,this.found=c,this.offset=d,this.line=e,this.column=f,this.name="SyntaxError"}function c(a){function c(){return f(uc).line}function d(){return f(uc).column}function e(a){throw h(a,null,uc)}function f(b){function c(b,c,d){var e,f;for(e=c;d>e;e++)f=a.charAt(e),"\n"===f?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(b.line++,b.column=1,b.seenCR=!0):(b.column++,b.seenCR=!1)}return vc!==b&&(vc>b&&(vc=0,wc={line:1,column:1,seenCR:!1}),c(wc,vc,b),vc=b),wc}function g(a){xc>tc||(tc>xc&&(xc=tc,yc=[]),yc.push(a))}function h(c,d,e){function g(a){var b=1;for(a.sort(function(a,b){return a.descriptionb.description?1:0});b1?g.slice(0,-1).join(", ")+" or "+g[a.length-1]:g[0],e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}var i=f(e),j=etc?(j=a.charAt(tc),tc++):(j=V,0===zc&&g(Cb)),j!==V?(uc=d,e=Db(j),d=e):(tc=d,d=$)):(tc=d,d=$)):(tc=d,d=$)):(tc=d,d=$)):(tc=d,d=$),d!==V)for(;d!==V;)c.push(d),d=tc,e=tc,zc++,f=M(),zc--,f===V?e=ba:(tc=e,e=$),e!==V?(f=tc,zc++,h=K(),zc--,h===V?f=ba:(tc=f,f=$),f!==V?(h=tc,zc++,i=L(),zc--,i===V?h=ba:(tc=h,h=$),h!==V?(i=tc,zc++,j=R(),zc--,j===V?i=ba:(tc=i,i=$),i!==V?(a.length>tc?(j=a.charAt(tc),tc++):(j=V,0===zc&&g(Cb)),j!==V?(uc=d,e=Db(j),d=e):(tc=d,d=$)):(tc=d,d=$)):(tc=d,d=$)):(tc=d,d=$)):(tc=d,d=$);else c=$;c!==V&&(uc=b,c=Eb(c)),b=c}return zc--,b===V&&(c=V,0===zc&&g(Ab)),b}function I(){var b,c,d,e,f;if(zc++,b=tc,c=[],d=tc,e=tc,zc++,f=M(),zc--,f===V?e=ba:(tc=e,e=$),e!==V?(f=J(),f===V&&(Gb.test(a.charAt(tc))?(f=a.charAt(tc),tc++):(f=V,0===zc&&g(Hb))),f!==V?(uc=d,e=Db(f),d=e):(tc=d,d=$)):(tc=d,d=$),d!==V)for(;d!==V;)c.push(d),d=tc,e=tc,zc++,f=M(),zc--,f===V?e=ba:(tc=e,e=$),e!==V?(f=J(),f===V&&(Gb.test(a.charAt(tc))?(f=a.charAt(tc),tc++):(f=V,0===zc&&g(Hb))),f!==V?(uc=d,e=Db(f),d=e):(tc=d,d=$)):(tc=d,d=$);else c=$;return c!==V&&(uc=b,c=Ib(c)),b=c,zc--,b===V&&(c=V,0===zc&&g(Fb)),b}function J(){var b,c;return b=tc,a.substr(tc,2)===Jb?(c=Jb,tc+=2):(c=V,0===zc&&g(Kb)),c!==V&&(uc=b,c=Lb()),b=c}function K(){var b,c,d,e,f,h;if(zc++,b=tc,a.substr(tc,2)===Nb?(c=Nb,tc+=2):(c=V,0===zc&&g(Ob)),c!==V){for(d=[],e=tc,f=tc,zc++,a.substr(tc,2)===Pb?(h=Pb,tc+=2):(h=V,0===zc&&g(Qb)),zc--,h===V?f=ba:(tc=f,f=$),f!==V?(a.length>tc?(h=a.charAt(tc),tc++):(h=V,0===zc&&g(Cb)),h!==V?(uc=e,f=Rb(h),e=f):(tc=e,e=$)):(tc=e,e=$);e!==V;)d.push(e),e=tc,f=tc,zc++,a.substr(tc,2)===Pb?(h=Pb,tc+=2):(h=V,0===zc&&g(Qb)),zc--,h===V?f=ba:(tc=f,f=$),f!==V?(a.length>tc?(h=a.charAt(tc),tc++):(h=V,0===zc&&g(Cb)),h!==V?(uc=e,f=Rb(h),e=f):(tc=e,e=$)):(tc=e,e=$);d!==V?(a.substr(tc,2)===Pb?(e=Pb,tc+=2):(e=V,0===zc&&g(Qb)),e!==V?(uc=b,c=Sb(d),b=c):(tc=b,b=$)):(tc=b,b=$)}else tc=b,b=$;return zc--,b===V&&(c=V,0===zc&&g(Mb)),b}function L(){var b,c,d,e,f,h;if(zc++,b=tc,a.substr(tc,2)===Ub?(c=Ub,tc+=2):(c=V,0===zc&&g(Vb)),c!==V){for(d=[],e=tc,f=tc,zc++,a.substr(tc,2)===Wb?(h=Wb,tc+=2):(h=V,0===zc&&g(Xb)),zc--,h===V?f=ba:(tc=f,f=$),f!==V?(a.length>tc?(h=a.charAt(tc),tc++):(h=V,0===zc&&g(Cb)),h!==V?(uc=e,f=Db(h),e=f):(tc=e,e=$)):(tc=e,e=$);e!==V;)d.push(e),e=tc,f=tc,zc++,a.substr(tc,2)===Wb?(h=Wb,tc+=2):(h=V,0===zc&&g(Xb)),zc--,h===V?f=ba:(tc=f,f=$),f!==V?(a.length>tc?(h=a.charAt(tc),tc++):(h=V,0===zc&&g(Cb)),h!==V?(uc=e,f=Db(h),e=f):(tc=e,e=$)):(tc=e,e=$);d!==V?(a.substr(tc,2)===Wb?(e=Wb,tc+=2):(e=V,0===zc&&g(Xb)),e!==V?(uc=b,c=Yb(d),b=c):(tc=b,b=$)):(tc=b,b=$)}else tc=b,b=$;return zc--,b===V&&(c=V,0===zc&&g(Tb)),b}function M(){var b,c,d,e,f,h,i,j,k,l;if(b=tc,c=N(),c!==V){for(d=[],e=S();e!==V;)d.push(e),e=S();if(d!==V)if(Zb.test(a.charAt(tc))?(e=a.charAt(tc),tc++):(e=V,0===zc&&g($b)),e!==V){for(f=[],h=S();h!==V;)f.push(h),h=S();if(f!==V){if(h=[],i=tc,j=tc,zc++,k=O(),zc--,k===V?j=ba:(tc=j,j=$),j!==V?(k=tc,zc++,l=R(),zc--,l===V?k=ba:(tc=k,k=$),k!==V?(a.length>tc?(l=a.charAt(tc),tc++):(l=V,0===zc&&g(Cb)),l!==V?(j=[j,k,l],i=j):(tc=i,i=$)):(tc=i,i=$)):(tc=i,i=$),i!==V)for(;i!==V;)h.push(i),i=tc,j=tc,zc++,k=O(),zc--,k===V?j=ba:(tc=j,j=$),j!==V?(k=tc,zc++,l=R(),zc--,l===V?k=ba:(tc=k,k=$),k!==V?(a.length>tc?(l=a.charAt(tc),tc++):(l=V,0===zc&&g(Cb)),l!==V?(j=[j,k,l],i=j):(tc=i,i=$)):(tc=i,i=$)):(tc=i,i=$);else h=$;if(h!==V){for(i=[],j=S();j!==V;)i.push(j),j=S();i!==V?(j=O(),j!==V?(c=[c,d,e,f,h,i,j],b=c):(tc=b,b=$)):(tc=b,b=$)}else tc=b,b=$}else tc=b,b=$}else tc=b,b=$;else tc=b,b=$}else tc=b,b=$;return b===V&&(b=r()),b}function N(){var b;return 123===a.charCodeAt(tc)?(b=_b,tc++):(b=V,0===zc&&g(ac)),b}function O(){var b;return 125===a.charCodeAt(tc)?(b=bc,tc++):(b=V,0===zc&&g(cc)),b}function P(){var b;return 91===a.charCodeAt(tc)?(b=dc,tc++):(b=V,0===zc&&g(ec)),b}function Q(){var b;return 93===a.charCodeAt(tc)?(b=fc,tc++):(b=V,0===zc&&g(gc)),b}function R(){var b;return 10===a.charCodeAt(tc)?(b=hc,tc++):(b=V,0===zc&&g(ic)),b===V&&(a.substr(tc,2)===jc?(b=jc,tc+=2):(b=V,0===zc&&g(kc)),b===V&&(13===a.charCodeAt(tc)?(b=lc,tc++):(b=V,0===zc&&g(mc)),b===V&&(8232===a.charCodeAt(tc)?(b=nc,tc++):(b=V,0===zc&&g(oc)),b===V&&(8233===a.charCodeAt(tc)?(b=pc,tc++):(b=V,0===zc&&g(qc)))))),b}function S(){var b;return rc.test(a.charAt(tc))?(b=a.charAt(tc),tc++):(b=V,0===zc&&g(sc)),b===V&&(b=R()),b}var T,U=arguments.length>1?arguments[1]:{},V={},W={start:i},X=i,Y=function(a){return["body"].concat(a).concat([["line",c()],["col",d()]])},Z={type:"other",description:"section"},$=V,_=null,aa=function(a,b,c,d){return d&&a[1].text===d.text||e("Expected end tag for "+a[1].text+" but it was not found."),!0},ba=void 0,ca=function(a,b,e){return e.push(["param",["literal","block"],b]),a.push(e),a.concat([["line",c()],["col",d()]])},da="/",ea={type:"literal",value:"/",description:'"/"'},fa=function(a){return a.push(["bodies"]),a.concat([["line",c()],["col",d()]])},ga=/^[#?\^<+@%]/,ha={type:"class",value:"[#?\\^<+@%]",description:"[#?\\^<+@%]"},ia=function(a,b,c,d){return[a,b,c,d]},ja={type:"other",description:"end tag"},ka=function(a){return a},la=":",ma={type:"literal",value:":",description:'":"'},na=function(a){return a},oa=function(a){return a?["context",a]:["context"]},pa={type:"other",description:"params"},qa="=",ra={type:"literal",value:"=",description:'"="'},sa=function(a,b){return["param",["literal",a],b]},ta=function(a){return["params"].concat(a)},ua={type:"other",description:"bodies"},va=function(a){return["bodies"].concat(a)},wa={type:"other",description:"reference"},xa=function(a,b){return["reference",a,b].concat([["line",c()],["col",d()]])},ya={type:"other",description:"partial"},za=">",Aa={type:"literal",value:">",description:'">"'},Ba="+",Ca={type:"literal",value:"+",description:'"+"'},Da=function(a){return["literal",a]},Ea=function(a,b,e,f){var g=">"===a?"partial":a;return[g,b,e,f].concat([["line",c()],["col",d()]])},Fa={type:"other",description:"filters"},Ga="|",Ha={type:"literal",value:"|",description:'"|"'},Ia=function(a){return["filters"].concat(a)},Ja={type:"other",description:"special"},Ka="~",La={type:"literal",value:"~",description:'"~"'},Ma=function(a){return["special",a].concat([["line",c()],["col",d()]])},Na={type:"other",description:"identifier"},Oa=function(a){var b=["path"].concat(a);return b.text=a[1].join(".").replace(/,line,\d+,col,\d+/g,""),b},Pa=function(a){var b=["key",a];return b.text=a,b},Qa={type:"other",description:"number"},Ra=function(a){return["literal",a]},Sa={type:"other",description:"float"},Ta=".",Ua={type:"literal",value:".",description:'"."'},Va=function(a,b){return parseFloat(a+"."+b)},Wa={type:"other",description:"unsigned_integer"},Xa=/^[0-9]/,Ya={type:"class",value:"[0-9]",description:"[0-9]"},Za=function(a){return parseInt(a.join(""),10)},$a={type:"other",description:"signed_integer"},_a="-",ab={type:"literal",value:"-",description:'"-"'},bb=function(a,b){return-1*b},cb={type:"other",description:"integer"},db={type:"other",description:"path"},eb=function(a,b){return b=b[0],a&&b?(b.unshift(a),[!1,b].concat([["line",c()],["col",d()]])):[!0,b].concat([["line",c()],["col",d()]])},fb=function(a){return a.length>0?[!0,a[0]].concat([["line",c()],["col",d()]]):[!0,[]].concat([["line",c()],["col",d()]])},gb={type:"other",description:"key"},hb=/^[a-zA-Z_$]/,ib={type:"class",value:"[a-zA-Z_$]",description:"[a-zA-Z_$]"},jb=/^[0-9a-zA-Z_$\-]/,kb={type:"class",value:"[0-9a-zA-Z_$\\-]",description:"[0-9a-zA-Z_$\\-]"},lb=function(a,b){return a+b.join("")},mb={type:"other",description:"array"},nb=function(a){return a.join("")},ob=function(a){return a},pb=function(a,b){return b?b.unshift(a):b=[a],b},qb={type:"other",description:"array_part"},rb=function(a){return a},sb=function(a,b){return b?a.concat(b):a},tb={type:"other",description:"inline"},ub='"',vb={type:"literal",value:'"',description:'"\\""'},wb=function(){return["literal",""].concat([["line",c()],["col",d()]])},xb=function(a){return["literal",a].concat([["line",c()],["col",d()]])},yb=function(a){return["body"].concat(a).concat([["line",c()],["col",d()]])},zb=function(a){return["buffer",a]},Ab={type:"other",description:"buffer"},Bb=function(a,b){return["format",a,b.join("")].concat([["line",c()],["col",d()]])},Cb={type:"any",description:"any character"},Db=function(a){return a},Eb=function(a){return["buffer",a.join("")].concat([["line",c()],["col",d()]])},Fb={type:"other",description:"literal"},Gb=/^[^"]/,Hb={type:"class",value:'[^"]',description:'[^"]'},Ib=function(a){return a.join("")},Jb='\\"',Kb={type:"literal",value:'\\"',description:'"\\\\\\""'},Lb=function(){return'"'},Mb={type:"other",description:"raw"},Nb="{`",Ob={type:"literal",value:"{`",description:'"{`"'},Pb="`}",Qb={type:"literal",value:"`}",description:'"`}"'},Rb=function(a){return a},Sb=function(a){return["raw",a.join("")].concat([["line",c()],["col",d()]])},Tb={type:"other",description:"comment"},Ub="{!",Vb={type:"literal",value:"{!",description:'"{!"'},Wb="!}",Xb={type:"literal",value:"!}",description:'"!}"'},Yb=function(a){return["comment",a.join("")].concat([["line",c()],["col",d()]])},Zb=/^[#?\^><+%:@\/~%]/,$b={type:"class",value:"[#?\\^><+%:@\\/~%]",description:"[#?\\^><+%:@\\/~%]"},_b="{",ac={type:"literal",value:"{",description:'"{"'},bc="}",cc={type:"literal",value:"}",description:'"}"'},dc="[",ec={type:"literal",value:"[",description:'"["'},fc="]",gc={type:"literal",value:"]",description:'"]"'},hc="\n",ic={type:"literal",value:"\n",description:'"\\n"'},jc="\r\n",kc={type:"literal",value:"\r\n",description:'"\\r\\n"'},lc="\r",mc={type:"literal",value:"\r",description:'"\\r"'},nc="\u2028",oc={type:"literal",value:"\u2028",description:'"\\u2028"'},pc="\u2029",qc={type:"literal",value:"\u2029",description:'"\\u2029"'},rc=/^[\t\x0B\f \xA0\uFEFF]/,sc={type:"class",value:"[\\t\\x0B\\f \\xA0\\uFEFF]",description:"[\\t\\x0B\\f \\xA0\\uFEFF]"},tc=0,uc=0,vc=0,wc={line:1,column:1,seenCR:!1},xc=0,yc=[],zc=0;if("startRule"in U){if(!(U.startRule in W))throw new Error("Can't start parsing from rule \""+U.startRule+'".');X=W[U.startRule]}if(T=X(),T!==V&&tc===a.length)return T;throw T!==V&&tcc;c++)e=o.filterNode(a,b[c]),e&&f.push(e);return f}function d(a,b){ +var c,d,e,f,g=[b[0]];for(d=1,e=b.length;e>d;d++)f=o.filterNode(a,b[d]),f&&("buffer"===f[0]||"format"===f[0]?c?(c[0]="buffer"===f[0]?"buffer":c[0],c[1]+=f.slice(1,-2).join("")):(c=f,g.push(f)):(c=null,g.push(f)));return g}function e(a,b){return["buffer",q[b[1]],b[2],b[3]]}function f(a,b){return b}function g(){}function h(a,b){return dust.config.whitespace?(b.splice(1,2,b.slice(1,-2).join("")),b):null}function i(a,b){var c={name:b,bodies:[],blocks:{},index:0,auto:"h"},d=dust.escapeJs(b),e="function(dust){dust.register("+(b?'"'+d+'"':"null")+","+o.compileNode(c,a)+");"+j(c)+k(c)+"return body_0;}";return dust.config.amd?'define("'+d+'",["dust.core"],'+e+");":"("+e+")(dust);"}function j(a){var b,c=[],d=a.blocks;for(b in d)c.push('"'+b+'":'+d[b]);return c.length?(a.blocks="ctx=ctx.shiftBlocks(blocks);","var blocks={"+c.join(",")+"};"):a.blocks=""}function k(a){var b,c,d=[],e=a.bodies,f=a.blocks;for(b=0,c=e.length;c>b;b++)d[b]="function body_"+b+"(chk,ctx){"+f+"return chk"+e[b]+";}body_"+b+".__dustBody=!0;";return d.join("")}function l(a,b){var c,d,e="";for(c=1,d=b.length;d>c;c++)e+=o.compileNode(a,b[c]);return e}function m(a,b,c){return"."+(dust._aliases[c]||c)+"("+o.compileNode(a,b[1])+","+o.compileNode(a,b[2])+","+o.compileNode(a,b[4])+","+o.compileNode(a,b[3])+")"}function n(a){return a.replace(r,"\\\\").replace(s,'\\"').replace(t,"\\f").replace(u,"\\n").replace(v,"\\r").replace(w,"\\t")}var o={},p=dust.isArray;o.compile=function(c,d){if(!d&&null!==d)throw new Error("Template name parameter cannot be undefined when calling dust.compile");try{var e=b(a(c));return i(e,d)}catch(f){if(!f.line||!f.column)throw f;throw new SyntaxError(f.message+" At line : "+f.line+", column : "+f.column)}},o.filterNode=function(a,b){return o.optimizers[b[0]](a,b)},o.optimizers={body:d,buffer:f,special:e,format:h,reference:c,"#":c,"?":c,"^":c,"<":c,"+":c,"@":c,"%":c,partial:c,context:c,params:c,bodies:c,param:c,filters:f,key:f,path:f,literal:f,raw:f,comment:g,line:g,col:g},o.pragmas={esc:function(a,b,c){var d,e=a.auto;return b||(b="h"),a.auto="s"===b?"":b,d=l(a,c.block),a.auto=e,d}};var q={s:" ",n:"\n",r:"\r",lb:"{",rb:"}"};o.compileNode=function(a,b){return o.nodes[b[0]](a,b)},o.nodes={body:function(a,b){var c=a.index++,d="body_"+c;return a.bodies[c]=l(a,b),d},buffer:function(a,b){return".w("+x(b[1])+")"},format:function(a,b){return".w("+x(b[1])+")"},reference:function(a,b){return".f("+o.compileNode(a,b[1])+",ctx,"+o.compileNode(a,b[2])+")"},"#":function(a,b){return m(a,b,"section")},"?":function(a,b){return m(a,b,"exists")},"^":function(a,b){return m(a,b,"notexists")},"<":function(a,b){for(var c=b[4],d=1,e=c.length;e>d;d++){var f=c[d],g=f[1][1];if("block"===g)return a.blocks[b[1].text]=o.compileNode(a,f[2]),""}return""},"+":function(a,b){return"undefined"==typeof b[1].text&&"undefined"==typeof b[4]?".block(ctx.getBlock("+o.compileNode(a,b[1])+",chk, ctx),"+o.compileNode(a,b[2])+", {},"+o.compileNode(a,b[3])+")":".block(ctx.getBlock("+x(b[1].text)+"),"+o.compileNode(a,b[2])+","+o.compileNode(a,b[4])+","+o.compileNode(a,b[3])+")"},"@":function(a,b){return".h("+x(b[1].text)+","+o.compileNode(a,b[2])+","+o.compileNode(a,b[4])+","+o.compileNode(a,b[3])+")"},"%":function(a,b){var c,d,e,f,g,h,i,j,k,l=b[1][1];if(!o.pragmas[l])return"";for(c=b[4],d={},j=1,k=c.length;k>j;j++)h=c[j],d[h[1][1]]=h[2];for(e=b[3],f={},j=1,k=e.length;k>j;j++)i=e[j],f[i[1][1]]=i[2][1];return g=b[2][1]?b[2][1].text:null,o.pragmas[l](a,g,d,f)},partial:function(a,b){return".p("+o.compileNode(a,b[1])+","+o.compileNode(a,b[2])+","+o.compileNode(a,b[3])+")"},context:function(a,b){return b[1]?"ctx.rebase("+o.compileNode(a,b[1])+")":"ctx"},params:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(o.compileNode(a,b[d]));return c.length?"{"+c.join(",")+"}":"{}"},bodies:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(o.compileNode(a,b[d]));return"{"+c.join(",")+"}"},param:function(a,b){return o.compileNode(a,b[1])+":"+o.compileNode(a,b[2])},filters:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++){var f=b[d];c.push('"'+f+'"')}return'"'+a.auto+'"'+(c.length?",["+c.join(",")+"]":"")},key:function(a,b){return'ctx.get(["'+b[1]+'"], false)'},path:function(a,b){for(var c=b[1],d=b[2],e=[],f=0,g=d.length;g>f;f++)e.push(p(d[f])?o.compileNode(a,d[f]):'"'+d[f]+'"');return"ctx.getPath("+c+", ["+e.join(",")+"])"},literal:function(a,b){return x(b[1])},raw:function(a,b){return".w("+x(b[1])+")"}};var r=/\\/g,s=/"/g,t=/\f/g,u=/\n/g,v=/\r/g,w=/\t/g,x="undefined"==typeof JSON?function(a){return'"'+n(a)+'"'}:JSON.stringify;return dust.compile=o.compile,dust.filterNode=o.filterNode,dust.optimizers=o.optimizers,dust.pragmas=o.pragmas,dust.compileNode=o.compileNode,dust.nodes=o.nodes,o}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core","dust.compile"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file diff --git a/lib/dust.js b/lib/dust.js index 43424e02..e18fc5c8 100644 --- a/lib/dust.js +++ b/lib/dust.js @@ -1,7 +1,7 @@ /*jshint evil:true*/ (function(root) { var dust = { - "version": "2.6.0" + "version": "2.6.1" }, NONE = 'NONE', ERROR = 'ERROR', diff --git a/package.json b/package.json index f2d2abb3..7d5b187d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "dustjs-linkedin", "title": "Dust - Asynchronous Templating", - "version": "2.6.0", + "version": "2.6.1", "author": { "name": "Aleksander Williams", "url": "http://akdubya.github.com/dustjs"