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

shopify-liquid

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shopify-liquid - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

5

dist/liquid.min.js

@@ -1,2 +0,3 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Liquid=e()}}(function(){return function e(t,r,n){function s(o,u){if(!r[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[o]={exports:{}};t[o][0].call(l.exports,function(e){var r=t[o][1][e];return s(r?r:e)},l,l.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)s(n[o]);return s}({1:[function(e,t){"use strict";function r(e){return o(e).replace(/&|<|>|"|'/g,function(e){return f[e]})}function n(e){return o(e).replace(/&(amp|lt|gt|#34|#39);/g,function(e){return p[e]})}function s(e){var t=(e+"").split(".");return t.length>1?t[1].length:0}function i(e,t){return Math.max(s(e),s(t))}function o(e){return e=e||"",e+""}function u(e){return function(t,r){var n=i(t,r);return e(t,r).toFixed(n)}}function a(e){return l.forOwn(h,function(t,r){return e.registerFilter(r,t)})}var c=e("./src/util/strftime.js"),l=e("./src/util/underscore.js"),f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},p={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"},h={abs:function(e){return Math.abs(e)},append:function(e,t){return e+t},capitalize:function(e){return o(e).charAt(0).toUpperCase()+e.slice(1)},ceil:function(e){return Math.ceil(e)},date:function(e,t){return"now"===e&&(e=new Date),c(e,t)},"default":function(e,t){return t||e},divided_by:function(e,t){return Math.floor(e/t)},downcase:function(e){return e.toLowerCase()},escape:r,escape_once:function(e){return r(n(e))},first:function(e){return e[0]},floor:function(e){return Math.floor(e)},join:function(e,t){return e.join(t)},last:function(e){return e[e.length-1]},lstrip:function(e){return o(e).replace(/^\s+/,"")},map:function(e,t){return e.map(function(e){return e[t]})},minus:u(function(e,t){return e-t}),modulo:u(function(e,t){return e%t}),newline_to_br:function(e){return e.replace(/\n/g,"<br />")},plus:u(function(e,t){return e+t}),prepend:function(e,t){return t+e},remove:function(e,t){return e.split(t).join("")},remove_first:function(e,t){return e.replace(t,"")},replace:function(e,t,r){return o(e).split(t).join(r)},replace_first:function(e,t,r){return o(e).replace(t,r)},reverse:function(e){return e.reverse()},round:function(e,t){var r=Math.pow(10,t||0);return Math.round(e*r,t)/r},rstrip:function(e){return o(e).replace(/\s+$/,"")},size:function(e){return e.length},slice:function(e,t,r){return e.substr(t,void 0===r?1:r)},sort:function(e,t){return e.sort(t)},split:function(e,t){return o(e).split(t)},strip:function(e){return o(e).trim()},strip_html:function(e){return o(e).replace(/<\/?\s*\w+\s*\/?>/g,"")},strip_newlines:function(e){return o(e).replace(/\n/g,"")},times:function(e,t){return e*t},truncate:function(e,t,r){return e=o(e),r=void 0===r?"...":r,t=t||16,e.length<=t?e:e.substr(0,t-r.length)+r},truncatewords:function(e,t,r){void 0===r&&(r="...");var n=e.split(" "),s=n.slice(0,t).join(" ");return n.length>t&&(s+=r),s},uniq:function(e){var t={};return(e||[]).filter(function(e){return t.hasOwnProperty(e)?!1:(t[e]=!0,!0)})},upcase:function(e){return o(e).toUpperCase()},url_encode:encodeURIComponent};a.filters=h,t.exports=a},{"./src/util/strftime.js":20,"./src/util/underscore.js":21}],2:[function(e,t){"use strict";function r(e){e=i.assign({},e),e.root=n(e.root),e.root.length||(e.root=["."]),e.extname=e.extname||".liquid";var t=Object.create(b);return t.init(h(),g(),e),t}function n(e){return i.isArray(e)?e:i.isString(e)?[e]:[]}var s=e("./src/scope"),i=e("./src/util/underscore.js"),o=e("./src/util/assert.js"),u=e("./src/tokenizer.js"),a=e("./src/util/fs.js").statFileAsync,c=e("./src/util/fs.js").readFileAsync,l=e("path"),f=e("./src/render.js"),p=e("./src/lexical.js"),h=e("./src/tag.js"),g=e("./src/filter.js"),d=e("./src/parser"),v=e("./src/syntax.js"),m=e("./tags"),y=e("./filters"),x=e("any-promise"),w=e("./src/util/promise.js").anySeries,j=e("./src/util/error.js"),b={init:function(e,t,r){return r.cache&&(this.cache={}),this.options=r,this.tag=e,this.filter=t,this.parser=d(e,t),this.renderer=f(),m(this),y(this),this},parse:function(e){var t=u.parse(e);return this.parser.parse(t)},render:function(e,t,r){r=i.assign({},this.options,r);var n=s.factory(t,r);return this.renderer.renderTemplates(e,n)},parseAndRender:function(e,t,r){var n=this;return x.resolve().then(function(){return n.parse(e)}).then(function(e){return n.render(e,t,r)})["catch"](function(e){if(e instanceof j.RenderBreak)return e.html;throw e})},renderFile:function(e,t,r){var n=this;return r=i.assign({},r),this.getTemplate(e,r.root).then(function(e){return n.render(e,t,r)})["catch"](function(t){throw t.file=e,t})},evalOutput:function(e,t){var r=this.parser.parseOutput(e.trim());return this.renderer.evalOutput(r,t)},registerFilter:function(e,t){return this.filter.register(e,t)},registerTag:function(e,t){return this.tag.register(e,t)},lookup:function(e,t){t=this.options.root.concat(t||[]),t=i.uniq(t);var r=t.map(function(t){return l.resolve(t,e)});return w(r,function(e){return a(e).then(function(){return e})})["catch"](function(r){throw"ENOENT"===r.code&&(r.message="Failed to lookup "+e+" in: "+t),r})},getTemplate:function(e,t){var r=this;return l.extname(e)||(e+=this.options.extname),this.lookup(e,t).then(function(e){if(r.options.cache){var t=r.cache[e];return t?x.resolve(t):c(e).then(function(e){return r.parse(e)}).then(function(t){return r.cache[e]=t})}return c(e).then(function(e){return r.parse(e)})})},express:function(e){e=e||{};var t=this;return function(r,n,s){o(i.isArray(this.root)||i.isString(this.root),"illegal views root, are you using express.js?"),e.root=this.root,t.renderFile(r,n,e).then(function(e){return s(null,e)})["catch"](function(e){return s(e)})}}};r.lexical=p,r.isTruthy=v.isTruthy,r.isFalsy=v.isFalsy,r.evalExp=v.evalExp,r.evalValue=v.evalValue,r.Types={ParseError:j.ParseError,TokenizationEroor:j.TokenizationError,RenderBreak:j.RenderBreak,AssertionError:j.AssertionError},t.exports=r},{"./filters":1,"./src/filter.js":7,"./src/lexical.js":8,"./src/parser":10,"./src/render.js":11,"./src/scope":12,"./src/syntax.js":13,"./src/tag.js":14,"./src/tokenizer.js":15,"./src/util/assert.js":16,"./src/util/error.js":17,"./src/util/fs.js":18,"./src/util/promise.js":19,"./src/util/underscore.js":21,"./tags":32,"any-promise":3,path:6}],3:[function(e,t){"use strict";t.exports=e("./register")().Promise},{"./register":5}],4:[function(e,t){"use strict";var r="@@any-promise/REGISTRATION",n=null;t.exports=function(e,t){return function(s,i){s=s||null,i=i||{};var o=i.global!==!1;if(null===n&&o&&(n=e[r]||null),null!==n&&null!==s&&n.implementation!==s)throw new Error('any-promise already defined as "'+n.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return null===n&&(n=null!==s&&"undefined"!=typeof i.Promise?{Promise:i.Promise,implementation:s}:t(s),o&&(e[r]=n)),n}}},{}],5:[function(e,t){"use strict";function r(){if("undefined"==typeof window.Promise)throw new Error("any-promise browser requires a polyfill or explicit registration e.g: require('any-promise/register/bluebird')");return{Promise:window.Promise,implementation:"window.Promise"}}t.exports=e("./loader")(window,r)},{"./loader":4}],6:[function(){"use strict"},{}],7:[function(e,t){"use strict";var r=e("./lexical.js"),n=e("./syntax.js"),s=e("./util/assert.js"),i=new RegExp(""+r.value.source,"g");t.exports=function(){function e(e){var t=Object.create(a);return t.parse(e)}function t(e,t){u[e]=t}function o(){u={}}var u={},a={render:function(e,t){var r=this.args.map(function(e){return n.evalValue(e,t)});return r.unshift(e),this.filter.apply(null,r)},parse:function(e){var t=r.filterLine.exec(e);s(t,"illegal filter: "+e);var n=t[1],o=t[2]||"",a=u[n];if("function"!=typeof a)return{name:n,error:new TypeError("undefined filter: "+n)};for(var c=[];t=i.exec(o.trim());)c.push(t[0]);return this.name=n,this.filter=a,this.args=c,this}};return{construct:e,register:t,clear:o}}},{"./lexical.js":8,"./syntax.js":13,"./util/assert.js":16}],8:[function(e,t){"use strict";function r(e){return A.test(e)}function n(e){return S.test(e)}function s(e){return P.test(e)}function i(e){return O.test(e)}function o(e){return b.exec(e)}function u(e){var t;return(t=e.match(R))?Number(e):(t=e.match(M))?"true"===e.toLowerCase():(t=e.match(q))?e.slice(1,-1):void 0}var a=/'[^']*'/,c=/"[^"]*"/,l=new RegExp(a.source+"|"+c.source),f=new RegExp("(?:"+l.source+"|[^'\"])*"),p=/-?\d+/,h=/-?\d+\.?\d*|\.?\d+/,g=/true|false/,d=/[\w-]+/,v=new RegExp("\\[(?:"+l.source+"|[\\w-\\.]+)\\]"),m=new RegExp("(?:"+l.source+"|"+g.source+"|"+h.source+")"),y=new RegExp(d.source+"(?:\\."+d.source+"|"+v.source+")*"),x=new RegExp("(?:"+y.source+"|"+h.source+")"),w=new RegExp("\\("+x.source+"\\.\\."+x.source+"\\)"),j=new RegExp("\\(("+x.source+")\\.\\.("+x.source+")\\)"),b=new RegExp("(?:"+y.source+"|"+m.source+"|"+w.source+")"),E=new RegExp("(?:"+d.source+")\\s*:\\s*(?:"+b.source+")"),T=new RegExp("("+d.source+")\\s*:\\s*("+b.source+")","g"),k=new RegExp("^\\s*("+d.source+")\\s*(.*)\\s*$"),S=new RegExp("^"+m.source+"$","i"),O=new RegExp("^"+y.source+"$"),R=new RegExp("^"+h.source+"$"),M=new RegExp("^"+g.source+"$","i"),q=new RegExp("^"+l.source+"$"),P=new RegExp("^"+j.source+"$"),A=new RegExp("^"+p.source+"$"),L=new RegExp(b.source+"(\\s*,\\s*"+b.source+")*"),F=new RegExp(d.source+"(?:\\s*:\\s*"+L.source+")?","g"),D=new RegExp("("+d.source+")(?:\\s*:\\s*("+L.source+"))?"),I=new RegExp("^"+D.source+"$"),_=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/];t.exports={quoted:l,number:h,bool:g,literal:m,filter:F,integer:p,hash:E,hashCapture:T,range:w,rangeCapture:j,identifier:d,value:b,quoteBalanced:f,operators:_,quotedLine:q,numberLine:R,boolLine:M,rangeLine:P,literalLine:S,filterLine:I,tagLine:k,isLiteral:n,isVariable:i,parseLiteral:u,isRange:s,matchValue:o,isInteger:r}},{}],9:[function(e,t){"use strict";var r={"==":function(e,t){return e==t},"!=":function(e,t){return e!=t},">":function(e,t){return e>t},"<":function(e,t){return t>e},">=":function(e,t){return e>=t},"<=":function(e,t){return t>=e},contains:function(e,t){return e.indexOf(t)>-1},and:function(e,t){return e&&t},or:function(e,t){return e||t}};t.exports=r},{}],10:[function(e,t){"use strict";var r=e("./lexical.js"),n=e("./util/error.js").ParseError,s=e("./util/assert.js");t.exports=function(e,t){function i(e){for(var t,r=[];t=e.shift();)r.push(o(t,e));return r}function o(e,t){try{switch(e.type){case"tag":return u(e,t);case"output":return a(e.value);case"html":return e}}catch(r){throw new n(r.message,e.input,e.line,r)}}function u(t,r){return"continue"===t.name||"break"===t.name?t:e.construct(t,r)}function a(e){var n=r.matchValue(e);s(n,"illegal output string: "+e);var i=n[0];e=e.substr(n.index+n[0].length);for(var o=[];n=r.filter.exec(e);)o.push([n[0].trim()]);return{type:"output",initial:i,filters:o.map(function(e){return t.construct(e)})}}function c(e){var t=Object.create(l);return t.init(e)}var l={init:function(e){return this.tokens=e,this.handlers={},this},on:function(e,t){return this.handlers[e]=t,this},trigger:function(e,t){var r=this.handlers[e];return"function"==typeof r?(r(t),!0):void 0},start:function(){this.trigger("start");for(var e;!this.stopRequested&&(e=this.tokens.shift());)if(!(this.trigger("token",e)||"tag"==e.type&&this.trigger("tag:"+e.name,e))){var t=o(e,this.tokens);this.trigger("template",t)}return this.stopRequested||this.trigger("end"),this},stop:function(){return this.stopRequested=!0,this}};return{parse:i,parseTag:u,parseStream:c,parseOutput:a}}},{"./lexical.js":8,"./util/assert.js":16,"./util/error.js":17}],11:[function(e,t){"use strict";function r(){var e=Object.create(c);return e}function n(e){return"string"==typeof e?e:JSON.stringify(e)}var s=e("./syntax.js"),i=e("any-promise"),o=e("./util/promise.js").mapSeries,u=e("./util/error.js").RenderBreak,a=e("./util/assert.js"),c=(e("./util/underscore.js"),{renderTemplates:function(e,t){function r(e){return"tag"===e.type?this.renderTag(e,t).then(function(e){return void 0===e?"":e}):"output"===e.type?i.resolve(this.evalOutput(e,t)).then(function(e){return void 0===e?"":n(e)}):i.resolve(e.value)}var s=this;a(t,"unable to evalTemplates: scope undefined");var c="";return o(e,function(e){return r.call(s,e).then(function(e){return c+=e})["catch"](function(e){throw e instanceof u&&(e.resolvedHTML=c),e})}).then(function(){return c})},renderTag:function(e,t){return"continue"===e.name?i.reject(new u("continue")):"break"===e.name?i.reject(new u("break")):e.render(t)},evalOutput:function(e,t){a(t,"unable to evalOutput: scope undefined");var r=s.evalExp(e.initial,t);return e.filters.some(function(e){if(e.error){if(t.get("liquid.strict_filters"))throw e.error;return r="",!0}r=e.render(r,t)}),r}});t.exports=r},{"./syntax.js":13,"./util/assert.js":16,"./util/error.js":17,"./util/promise.js":19,"./util/underscore.js":21,"any-promise":3}],12:[function(e,t,r){"use strict";function n(e,t){for(var r=1,n=t;n<e.length;n++)if("["===e[n]&&r++,"]"===e[n]&&(r--,0===r))return n;return-1}var s=e("./util/underscore.js"),i=e("./lexical.js"),o=e("./util/assert.js"),u=/undefined variable|Cannot read property .* of undefined/,a={getAll:function(){for(var e={},t=this.scopes.length-1;t>=0;t--)s.assign(e,this.scopes[t]);return e},get:function(e){for(var t=this.scopes.length-1;t>=0;t--)try{return this.getPropertyByPath(this.scopes[t],e)}catch(r){if(!u.test(r.message)||this.opts.strict_variables)throw r.message+=": "+e,r}if(this.opts.strict_variables)throw new TypeError("undefined variable: "+e)},set:function(e,t){return this.setPropertyByPath(this.scopes[this.scopes.length-1],e,t),this},push:function(e){return o(e,"trying to push "+e+" into scopes"),this.scopes.push(e)},pop:function(){return this.scopes.pop()},unshift:function(e){return o(e,"trying to push "+e+" into scopes"),this.scopes.unshift(e)},shift:function(){return this.scopes.shift()},setPropertyByPath:function(e,t,r){if(s.isString(t))for(var n=t.replace(/\[/g,".").replace(/\]/g,"").split("."),i=0;i<n.length;i++){var o=n[i];if(i===n.length-1)return e[o]=r;void 0===e[o]&&(e[o]={}),e=e[o]||{}}},getPropertyByPath:function(e,t){var r=this.propertyAccessSeq(t+""),n=r.shift();if(!e.hasOwnProperty(n))throw new TypeError("undefined variable");var s=e[n];return r.forEach(function(e){return s=s[e]}),s},propertyAccessSeq:function(e){for(var t=[],r="",s=0;s<e.length;s++)if("["===e[s]){t.push(r),r="";var u=e[s+1];if("'"!==u&&'"'!==u){var a=n(e,s+1);o(-1!==a,"unbalanced []: "+e),r=e.slice(s+1,a),t.push(i.isInteger(r)?r:this.get(r)),r="",s=a}else a=e.indexOf(u,s+2),o(-1!==a,"unbalanced "+u+": "+e),r=e.slice(s+2,a),t.push(r),r="",s=a+1}else"."===e[s]?(t.push(r),r=""):r+=e[s];return r.length&&t.push(r),t}};r.factory=function(e,t){t=s.assign({strict_variables:!1,strict_filters:!1,blocks:{},root:[]},t),e=s.assign(e,{liquid:t});var r=Object.create(a);return r.opts=t,r.scopes=[e],r}},{"./lexical.js":8,"./util/assert.js":16,"./util/underscore.js":21}],13:[function(e,t){"use strict";function r(e,t){a(t,"unable to evalExp: scope undefined");for(var s,i=u.operators,c=0;c<i.length;c++){var l=i[c],f=new RegExp("^("+u.quoteBalanced.source+")("+l.source+")("+u.quoteBalanced.source+")$");if(s=e.match(f)){var p=r(s[1],t),h=o[s[2].trim()],g=r(s[3],t);return h(p,g)}}if(s=e.match(u.rangeLine)){for(var d=n(s[1],t),v=n(s[2],t),m=[],y=d;v>=y;y++)m.push(y);return m}return n(e,t)}function n(e,t){return e=e&&e.trim(),e?u.isLiteral(e)?u.parseLiteral(e):u.isVariable(e)?t.get(e):void 0:void 0}function s(e){return e instanceof Array?!!e.length:!!e}function i(e){return!s(e)}var o=e("./operators.js"),u=e("./lexical.js"),a=e("../src/util/assert.js");t.exports={evalExp:r,evalValue:n,isTruthy:s,isFalsy:i}},{"../src/util/assert.js":16,"./lexical.js":8,"./operators.js":9}],14:[function(e,t){"use strict";function r(e,t){var r,s={};for(n.hashCapture.lastIndex=0;r=n.hashCapture.exec(e);){var o=r[1],u=r[2];s[o]=i.evalValue(u,t)}return s}var n=e("./lexical.js"),s=e("any-promise"),i=e("./syntax.js"),o=e("./util/assert.js");t.exports=function(){function e(e,t){i[e]=t}function t(e,t){var r=Object.create(u);return r.parse(e,t),r}function n(){i={}}var i={},u={render:function(e){var t=r(this.token.args,e);return this.tagImpl.render&&this.tagImpl.render(e,t)||s.resolve("")},parse:function(e,t){this.type="tag",this.token=e,this.name=e.name;var r=i[this.name];o(r,"tag "+this.name+" not found"),this.tagImpl=Object.create(r),this.tagImpl.parse&&this.tagImpl.parse(e,t)}};return{construct:t,register:e,clear:n}}},{"./lexical.js":8,"./syntax.js":13,"./util/assert.js":16,"any-promise":3}],15:[function(e,t,r){"use strict";function n(e){function t(e,t,s){return{type:e,raw:s[t],value:s[t+1].trim(),line:n(s),input:r(s)}}function r(e){var t=e.input.lastIndexOf("\n",e.index),r=e.input.indexOf("\n",e.index);return-1===r&&(r=e.input.length),e.input.slice(t+1,r)}function n(e){var t=e.input.slice(g+1,e.index).split("\n");return d+=t.length-1,g=e.index,d+1}var a=[];u(o.isString(e),new i("illegal input type"));for(var c,l,f,p=/({%(.*?)%})|({{(.*?)}})/g,h=0,g=-1,d=0;null!==(c=p.exec(e));){if(c.index>h&&(l=e.slice(h,c.index),a.push({type:"html",raw:l,value:l})),c[1]){f=t("tag",1,c);var v=f.value.match(s.tagLine);if(!v)throw new i("illegal tag: "+f.raw,f.input,f.line);f.name=v[1],f.args=v[2],a.push(f)}else f=t("output",3,c),a.push(f);h=p.lastIndex}return e.length>h&&(l=e.slice(h,e.length),a.push({type:"html",raw:l,value:l})),a}var s=e("./lexical.js"),i=e("./util/error.js").TokenizationError,o=e("./util/underscore.js"),u=e("../src/util/assert.js");r.parse=n},{"../src/util/assert.js":16,"./lexical.js":8,"./util/error.js":17,"./util/underscore.js":21}],16:[function(e,t){"use strict";function r(e,t){if(!e){if(t instanceof Error)throw t;var t=t||"expect "+e+" to be true";throw new n(t)}}var n=e("./error.js").AssertionError;t.exports=r},{"./error.js":17}],17:[function(e,t){"use strict";function r(e,t,r){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e,this.input=t,this.line=r}function n(e,t,r,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.originalError=n,this.message=e,this.input=t,this.line=r}function s(e){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e}function i(e){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,t.exports={TokenizationError:r,ParseError:n,RenderBreak:s,AssertionError:i}},{}],18:[function(e,t){"use strict";function r(e){return new Promise(function(t,r){s.readFile(e,"utf8",function(e,n){e?r(e):t(n)})})}function n(e){return new Promise(function(t,r){s.stat(e,function(e,n){return e?r(e):t(n)})})}var s=e("fs");t.exports={readFileAsync:r,statFileAsync:n}},{fs:6}],19:[function(e,t,r){"use strict";function n(e,t){var r=i.reject(new Error("init"));return e.forEach(function(n,s){r=r["catch"](function(){return t(n,s,e)})}),r}function s(e,t){var r=i.resolve("init"),n=[];return e.forEach(function(s,i){r=r.then(function(){return t(s,i,e)}).then(function(e){return n.push(e)})}),r.then(function(){return n})}var i=e("any-promise");r.anySeries=n,r.mapSeries=s},{"any-promise":3}],20:[function(e,t){"use strict";var r=["January","February","March","April","May","June","July","August","September","October","November","December"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o={1:"st",2:"nd",3:"rd","default":"th"},u={daysInMonth:function(e){var t=u.isLeapYear(e)?29:28;return[31,t,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(e){for(var t=0,r=0;r<e.getMonth();++r)t+=u.daysInMonth(e)[r];return t+e.getDate()},getWeekOfYear:function(e,t){var r=this.getDayOfYear(e)+(t-e.getDay()),n=new Date(e.getFullYear(),0,1),s=7-n.getDay()+t;return a.pad(Math.floor((r-s)/7)+1,2)},isLeapYear:function(e){var t=e.getFullYear();return!(0!==(3&t)||!(t%100||t%400===0&&t))},getSuffix:function(e){var t=e.getDate().toString(),r=parseInt(t.slice(-1));return o[r]||o["default"]},century:function(e){return parseInt(e.getFullYear().toString().substring(0,2),10)}},a={pad:function f(e,t,r){r||(r="0");for(var n=e.toString(),f=t-n.length;f-->0;)n=r+n;return n}},c={a:function(e){return i[e.getDay()]},A:function(e){return s[e.getDay()]},b:function(e){return n[e.getMonth()]},B:function(e){return r[e.getMonth()]},c:function(e){return e.toLocaleString()},C:function(e){return u.century(e)},d:function(e){return a.pad(e.getDate(),2)},e:function(e){return a.pad(e.getDate(),2," ")},H:function(e){return a.pad(e.getHours(),2)},I:function(e){return a.pad(e.getHours()%12||12,2)},j:function(e){return a.pad(u.getDayOfYear(e),3)},k:function(e){return a.pad(e.getHours(),2," ")},l:function(e){return a.pad(e.getHours()%12||12,2," ")},L:function(e){return a.pad(e.getMilliseconds(),3)},m:function(e){return a.pad(e.getMonth()+1,2)},M:function(e){return a.pad(e.getMinutes(),2)},p:function(e){return e.getHours()<12?"AM":"PM"},P:function(e){return e.getHours()<12?"am":"pm"},q:function(e){return u.getSuffix(e)},s:function(e){return Math.round(e.valueOf()/1e3)},S:function(e){return a.pad(e.getSeconds(),2)},u:function(e){return e.getDay()||7},U:function(e){return u.getWeekOfYear(e,0)},w:function(e){return e.getDay()},W:function(e){return u.getWeekOfYear(e,1)},x:function(e){return e.toLocaleDateString()},X:function(e){return e.toLocaleTimeString()},y:function(e){return e.getFullYear().toString().substring(2,4)},Y:function(e){return e.getFullYear()},z:function(e){var t=e.getTimezoneOffset()/60*100;return(t>0?"-":"+")+a.pad(Math.abs(t),4)},"%":function(){return"%"}};c.h=c.b,c.N=c.L;var l=function(e,t){for(var r="",n=t;;){var s=/%./g,i=s.exec(n);if(!i)return r+n;r+=n.slice(0,s.lastIndex-2),n=n.slice(s.lastIndex);var o=i[0].charAt(1),u=c[o];r+=u?u.call(this,e):"%"+o}};t.exports=l},{}],21:[function(e,t,r){"use strict";function n(e){return e instanceof String||"string"==typeof e}function s(e,t){e=e||{};for(var r in e)if(e.hasOwnProperty(r)&&t(e[r],r,e)===!1)break;return e}function i(e){e=l(e)?e:{};var t=Array.prototype.slice.call(arguments,1);return t.forEach(function(t){o(e,t)}),e}function o(e,t){return e?(s(t,function(t,r){e[r]=t}),e):e}function u(e){return e instanceof Array}function a(e){return function(t){return console.log("["+e+"]",t),t}}function c(e){for(var t={},r=[],n=0,s=e.length;s>n;++n)t.hasOwnProperty(e[n])||(r.push(e[n]),t[e[n]]=1);return r}function l(e){return null!==e&&"object"===("undefined"==typeof e?"undefined":f(e))}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};r.isString=n,r.isArray=u,r.isObject=l,r.forOwn=s,r.assign=i,r.uniq=c,r.echo=a},{}],22:[function(e,t){"use strict";var r=e(".."),n=r.lexical,s=e("any-promise"),i=new RegExp("("+n.identifier.source+")\\s*=(.*)"),o=e("../src/util/assert.js");t.exports=function(e){e.registerTag("assign",{parse:function(e){var t=e.args.match(i);o(t,"illegal token "+e.raw),this.key=t[1],this.value=t[2]},render:function(t){return t.set(this.key,e.evalOutput(this.value,t)),s.resolve("")}})}},{"..":2,"../src/util/assert.js":16,"any-promise":3}],23:[function(e,t){"use strict";var r=e(".."),n=r.lexical,s=new RegExp("("+n.identifier.source+")"),i=e("../src/util/assert.js");t.exports=function(e){e.registerTag("capture",{parse:function(t,r){var n=this,o=t.args.match(s);i(o,t.args+" not valid identifier"),this.variable=o[1],this.templates=[];var u=e.parser.parseStream(r);u.on("tag:endcapture",function(){return u.stop()}).on("template",function(e){return n.templates.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),u.start()},render:function(t){var r=this;return e.renderer.renderTemplates(this.templates,t).then(function(e){t.set(r.variable,e)})}})}},{"..":2,"../src/util/assert.js":16}],24:[function(e,t){"use strict";{var r=e("..");e("../src/util/assert.js")}t.exports=function(e){e.registerTag("case",{parse:function(t,r){var n=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var s=[],i=e.parser.parseStream(r).on("tag:when",function(e){n.cases[e.args]||n.cases.push({val:e.args,templates:s=[]})}).on("tag:else",function(){return s=n.elseTemplates}).on("tag:endcase",function(){return i.stop()}).on("template",function(e){return s.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var n=0;n<this.cases.length;n++){var s=this.cases[n],i=r.evalExp(s.val,t),o=r.evalExp(this.cond,t);if(i===o)return e.renderer.renderTemplates(s.templates,t)}return e.renderer.renderTemplates(this.elseTemplates,t)}})}},{"..":2,"../src/util/assert.js":16}],25:[function(e,t){"use strict";t.exports=function(e){e.registerTag("comment",{parse:function(t,r){var n=e.parser.parseStream(r);n.on("token",function(e){"endcomment"===e.name&&n.stop()}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),n.start()}})}},{}],26:[function(e,t){"use strict";var r=e(".."),n=e("any-promise"),s=r.lexical,i=new RegExp("^(?:("+s.value.source+")\\s*:\\s*)?(.*)$"),o=new RegExp(s.value.source,"g"),u=e("../src/util/assert.js");t.exports=function(e){e.registerTag("cycle",{parse:function(e){var t=i.exec(e.args);u(t,"illegal tag: "+e.raw),this.group=t[1]||"";var r=t[2];for(this.candidates=[];t=o.exec(r);)this.candidates.push(t[0]);u(this.candidates.length,"empty candidates: "+e.raw)},render:function(e){var t=r.evalValue(this.group,e),s="cycle:"+t+":"+this.candidates.join(","),i=e.get("liquid"),o=i[s];void 0===o&&(o=i[s]=0);var u=this.candidates[o];return o=(o+1)%this.candidates.length,i[s]=o,n.resolve(r.evalValue(u,e))}})}},{"..":2,"../src/util/assert.js":16,"any-promise":3}],27:[function(e,t){"use strict";var r=e(".."),n=r.lexical,s=e("../src/util/assert.js");t.exports=function(e){e.registerTag("decrement",{parse:function(e){var t=e.args.match(n.identifier);s(t,"illegal identifier "+e.args),this.variable=t[0]},render:function(e){var t=e.get(this.variable);"number"!=typeof t&&(t=0),e.set(this.variable,t-1)}})}},{"..":2,"../src/util/assert.js":16}],28:[function(e,t){"use strict";var r=e(".."),n=(e("any-promise"),r.lexical),s=e("../src/util/promise.js").mapSeries,i=r.Types.RenderBreak,o=e("../src/util/assert.js"),u=new RegExp("^("+n.identifier.source+")\\s+in\\s+"+("("+n.value.source+")")+("(?:\\s+"+n.hash.source+")*")+"(?:\\s+(reversed))?$");t.exports=function(e){e.registerTag("for",{parse:function(t,r){var n=this,s=u.exec(t.args);o(s,"illegal tag: "+t.raw),this.variable=s[1],this.collection=s[2],this.reversed=!!s[3],this.templates=[],this.elseTemplates=[];var i,a=e.parser.parseStream(r).on("start",function(){return i=n.templates}).on("tag:else",function(){return i=n.elseTemplates}).on("tag:endfor",function(){return a.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});a.start()},render:function(t,n){var o=this,u=r.evalExp(this.collection,t);if(r.isFalsy(u))return e.renderer.renderTemplates(this.elseTemplates,t);var a=u.length,c=n.offset||0,l=void 0===n.limit?u.length:n.limit;u=u.slice(c,c+l),this.reversed&&u.reverse();var f=u.map(function(e,t){var r={};return r[o.variable]=e,r.forloop={first:0===t,index:t+1,index0:t,last:t===a-1,length:a,rindex:a-t,rindex0:a-t-1,stop:!1,skip:!1},r}),p="";return s(f,function(r){return t.push(r),e.renderer.renderTemplates(o.templates,t).then(function(e){return p+=e})["catch"](function(e){if(!(e instanceof i&&(p+=e.resolvedHTML,"continue"===e.message)))throw e}).then(function(){return t.pop()})})["catch"](function(e){if(!(e instanceof i&&"break"===e.message))throw e}).then(function(){return p})}})}},{"..":2,"../src/util/assert.js":16,"../src/util/promise.js":19,"any-promise":3}],29:[function(e,t){"use strict";var r=e("..");t.exports=function(e){e.registerTag("if",{parse:function(t,r){var n=this;this.branches=[],this.elseTemplates=[];var s,i=e.parser.parseStream(r).on("start",function(){return n.branches.push({cond:t.args,templates:s=[]})}).on("tag:elsif",function(e){n.branches[e.args]||n.branches.push({cond:e.args,templates:s=[]})}).on("tag:else",function(){return s=n.elseTemplates}).on("tag:endif",function(){return i.stop()}).on("template",function(e){return s.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var n=0;n<this.branches.length;n++){var s=this.branches[n],i=r.evalExp(s.cond,t);if(r.isTruthy(i))return e.renderer.renderTemplates(s.templates,t)}return e.renderer.renderTemplates(this.elseTemplates,t)}})}},{"..":2}],30:[function(e,t){"use strict";var r=e(".."),n=r.lexical,s=new RegExp("with\\s+("+n.value.source+")"),i=e("../src/util/assert.js");t.exports=function(e){e.registerTag("include",{parse:function(e){var t=n.value.exec(e.args);i(t,"illegal token "+e.raw),this.value=t[0],t=s.exec(e.args),t&&(this["with"]=t[1])},render:function(t,n){var s=r.evalValue(this.value,t),i=t.get("liquid"),o=i.blocks;return i.blocks={},this["with"]&&(n[s]=r.evalValue(this["with"],t)),e.getTemplate(s,i.root).then(function(r){return t.push(n),e.renderer.renderTemplates(r,t)}).then(function(e){return t.pop(),i.blocks=o,e})}})}},{"..":2,"../src/util/assert.js":16}],31:[function(e,t){"use strict";var r=e(".."),n=e("../src/util/assert.js"),s=r.lexical;t.exports=function(e){e.registerTag("increment",{parse:function(e){var t=e.args.match(s.identifier);n(t,"illegal identifier "+e.args),this.variable=t[0]},render:function(e){var t=e.get(this.variable);"number"!=typeof t&&(t=0),e.set(this.variable,t+1)}})}},{"..":2,"../src/util/assert.js":16}],32:[function(e,t){"use strict";t.exports=function(t){e("./assign.js")(t),e("./capture.js")(t),e("./case.js")(t),e("./comment.js")(t),e("./cycle.js")(t),e("./decrement.js")(t),e("./for.js")(t),e("./if.js")(t),e("./include.js")(t),e("./increment.js")(t),e("./layout.js")(t),e("./raw.js")(t),e("./tablerow.js")(t),e("./unless.js")(t)}},{"./assign.js":22,"./capture.js":23,"./case.js":24,"./comment.js":25,"./cycle.js":26,"./decrement.js":27,"./for.js":28,"./if.js":29,"./include.js":30,"./increment.js":31,"./layout.js":33,"./raw.js":34,"./tablerow.js":35,"./unless.js":36}],33:[function(e,t){"use strict";var r=e(".."),n=e("any-promise"),s=r.lexical,i=e("../src/util/assert.js");t.exports=function(e){e.registerTag("layout",{parse:function(t,r){var n=s.value.exec(t.args);i(n,"illegal token "+t.raw),this.layout=n[0],this.tpls=e.parser.parse(r)},render:function(t,n){var s=r.evalValue(this.layout,t),i=t.get("liquid");return e.renderer.renderTemplates(this.tpls,t).then(function(){return e.getTemplate(s,i.root)}).then(function(e){return t.push(n),e}).then(function(r){return e.renderer.renderTemplates(r,t)}).then(function(e){return t.pop(),e})}}),e.registerTag("block",{parse:function(t,r){var n=this,s=/\w+/.exec(t.args);this.block=s?s[0]:"anonymous",this.tpls=[];var i=e.parser.parseStream(r).on("tag:endblock",function(){return i.stop()}).on("template",function(e){return n.tpls.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){var r=this,s=t.get("liquid"),i=s.blocks[this.block];return void 0===i?e.renderer.renderTemplates(this.tpls,t).then(function(e){
return s.blocks[r.block]=e,e}):(s.blocks[this.block]=i,n.resolve(i))}})}},{"..":2,"../src/util/assert.js":16,"any-promise":3}],34:[function(e,t){"use strict";var r=e("any-promise");t.exports=function(e){e.registerTag("raw",{parse:function(t,r){var n=this;this.tokens=[];var s=e.parser.parseStream(r);s.on("token",function(e){"endraw"===e.name?s.stop():n.tokens.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),s.start()},render:function(){var e=this.tokens.map(function(e){return e.raw}).join("");return r.resolve(e)}})}},{"any-promise":3}],35:[function(e,t){"use strict";var r=e(".."),n=e("any-promise"),s=r.lexical,i=e("../src/util/assert.js"),o=new RegExp("^("+s.identifier.source+")\\s+in\\s+"+("("+s.value.source+")")+("(?:\\s+"+s.hash.source+")*$"));t.exports=function(e){e.registerTag("tablerow",{parse:function(t,r){var n=this,s=o.exec(t.args);i(s,"illegal tag: "+t.raw),this.variable=s[1],this.collection=s[2],this.templates=[];var u,a=e.parser.parseStream(r).on("start",function(){return u=n.templates}).on("tag:endtablerow",function(){return a.stop()}).on("template",function(e){return u.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});a.start()},render:function(t,s){var i,o,u=this,a=r.evalExp(this.collection,t)||[],c="<table>",l=s.offset||0,f=void 0===s.limit?a.length:s.limit,p=s.cols;if(!p)throw new Error("illegal cols: "+p);a=a.slice(l,l+f);var h=[];a.some(function(e){var t={};t[u.variable]=e,h.push(t)});var g=h.reduce(function(r,n,s){return r.then(function(){return i=Math.floor(s/p)+1,o=s%p+1,1===o&&(1!==i&&(c+="</tr>"),c+='<tr class="row'+i+'">'),c+='<td class="col'+o+'">'}).then(function(){return t.push(n),e.renderer.renderTemplates(u.templates,t)}).then(function(e){return t.pop(n),c+=e,c+="</td>"})},n.resolve(""));return g.then(function(){return i>0&&(c+="</tr>"),c+="</table>"})["catch"](function(e){throw e})}})}},{"..":2,"../src/util/assert.js":16,"any-promise":3}],36:[function(e,t){"use strict";var r=e("..");t.exports=function(e){e.registerTag("unless",{parse:function(t,r){var n=this;this.templates=[],this.elseTemplates=[];var s,i=e.parser.parseStream(r).on("start",function(){s=n.templates,n.cond=t.args}).on("tag:else",function(){return s=n.elseTemplates}).on("tag:endunless",function(){return i.stop()}).on("template",function(e){return s.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){var n=r.evalExp(this.cond,t);return r.isFalsy(n)?e.renderer.renderTemplates(this.templates,t):e.renderer.renderTemplates(this.elseTemplates,t)}})}},{"..":2}]},{},[2])(2)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.Liquid=e()}}(function(){return function e(r,t,n){function s(o,u){if(!t[o]){if(!r[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=t[o]={exports:{}};r[o][0].call(l.exports,function(e){var t=r[o][1][e];return s(t?t:e)},l,l.exports,e,r,t,n)}return t[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)s(n[o]);return s}({1:[function(e,r){"use strict";function t(e){return o(e).replace(/&|<|>|"|'/g,function(e){return f[e]})}function n(e){return o(e).replace(/&(amp|lt|gt|#34|#39);/g,function(e){return p[e]})}function s(e){var r=(e+"").split(".");return r.length>1?r[1].length:0}function i(e,r){return Math.max(s(e),s(r))}function o(e){return e=e||"",e+""}function u(e){return function(r,t){var n=i(r,t);return e(r,t).toFixed(n)}}function a(e){return l.forOwn(h,function(r,t){return e.registerFilter(t,r)})}var c=e("./src/util/strftime.js"),l=e("./src/util/underscore.js"),f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},p={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"},h={abs:function(e){return Math.abs(e)},append:function(e,r){return e+r},capitalize:function(e){return o(e).charAt(0).toUpperCase()+e.slice(1)},ceil:function(e){return Math.ceil(e)},date:function(e,r){return"now"===e&&(e=new Date),c(e,r)},"default":function(e,r){return r||e},divided_by:function(e,r){return Math.floor(e/r)},downcase:function(e){return e.toLowerCase()},escape:t,escape_once:function(e){return t(n(e))},first:function(e){return e[0]},floor:function(e){return Math.floor(e)},join:function(e,r){return e.join(r)},last:function(e){return e[e.length-1]},lstrip:function(e){return o(e).replace(/^\s+/,"")},map:function(e,r){return e.map(function(e){return e[r]})},minus:u(function(e,r){return e-r}),modulo:u(function(e,r){return e%r}),newline_to_br:function(e){return e.replace(/\n/g,"<br />")},plus:u(function(e,r){return e+r}),prepend:function(e,r){return r+e},remove:function(e,r){return e.split(r).join("")},remove_first:function(e,r){return e.replace(r,"")},replace:function(e,r,t){return o(e).split(r).join(t)},replace_first:function(e,r,t){return o(e).replace(r,t)},reverse:function(e){return e.reverse()},round:function(e,r){var t=Math.pow(10,r||0);return Math.round(e*t,r)/t},rstrip:function(e){return o(e).replace(/\s+$/,"")},size:function(e){return e.length},slice:function(e,r,t){return e.substr(r,void 0===t?1:t)},sort:function(e,r){return e.sort(r)},split:function(e,r){return o(e).split(r)},strip:function(e){return o(e).trim()},strip_html:function(e){return o(e).replace(/<\/?\s*\w+\s*\/?>/g,"")},strip_newlines:function(e){return o(e).replace(/\n/g,"")},times:function(e,r){return e*r},truncate:function(e,r,t){return e=o(e),t=void 0===t?"...":t,r=r||16,e.length<=r?e:e.substr(0,r-t.length)+t},truncatewords:function(e,r,t){void 0===t&&(t="...");var n=e.split(" "),s=n.slice(0,r).join(" ");return n.length>r&&(s+=t),s},uniq:function(e){var r={};return(e||[]).filter(function(e){return r.hasOwnProperty(e)?!1:(r[e]=!0,!0)})},upcase:function(e){return o(e).toUpperCase()},url_encode:encodeURIComponent};a.filters=h,r.exports=a},{"./src/util/strftime.js":20,"./src/util/underscore.js":21}],2:[function(e,r){"use strict";function t(e){e=i.assign({},e),e.root=n(e.root),e.root.length||(e.root=["."]),e.extname=e.extname||".liquid";var r=Object.create(b);return r.init(h(),g(),e),r}function n(e){return i.isArray(e)?e:i.isString(e)?[e]:[]}var s=e("./src/scope"),i=e("./src/util/underscore.js"),o=e("./src/util/assert.js"),u=e("./src/tokenizer.js"),a=e("./src/util/fs.js").statFileAsync,c=e("./src/util/fs.js").readFileAsync,l=e("path"),f=e("./src/render.js"),p=e("./src/lexical.js"),h=e("./src/tag.js"),g=e("./src/filter.js"),d=e("./src/parser"),v=e("./src/syntax.js"),m=e("./tags"),y=e("./filters"),j=e("any-promise"),w=e("./src/util/promise.js").anySeries,x=e("./src/util/error.js"),b={init:function(e,r,t){return t.cache&&(this.cache={}),this.options=t,this.tag=e,this.filter=r,this.parser=d(e,r),this.renderer=f(),m(this),y(this),this},parse:function(e){var r=u.parse(e);return this.parser.parse(r)},render:function(e,r,t){t=i.assign({},this.options,t);var n=s.factory(r,t);return this.renderer.renderTemplates(e,n)},parseAndRender:function(e,r,t){var n=this;return j.resolve().then(function(){return n.parse(e)}).then(function(e){return n.render(e,r,t)})["catch"](function(e){if(e instanceof x.RenderBreakError)return e.html;throw e})},renderFile:function(e,r,t){var n=this;return t=i.assign({},t),this.getTemplate(e,t.root).then(function(e){return n.render(e,r,t)})["catch"](function(r){throw r.file=e,r})},evalOutput:function(e,r){var t=this.parser.parseOutput(e.trim());return this.renderer.evalOutput(t,r)},registerFilter:function(e,r){return this.filter.register(e,r)},registerTag:function(e,r){return this.tag.register(e,r)},lookup:function(e,r){r=this.options.root.concat(r||[]),r=i.uniq(r);var t=r.map(function(r){return l.resolve(r,e)});return w(t,function(e){return a(e).then(function(){return e})})["catch"](function(t){throw"ENOENT"===t.code&&(t.message="Failed to lookup "+e+" in: "+r),t})},getTemplate:function(e,r){var t=this;return l.extname(e)||(e+=this.options.extname),this.lookup(e,r).then(function(e){if(t.options.cache){var r=t.cache[e];return r?j.resolve(r):c(e).then(function(e){return t.parse(e)}).then(function(r){return t.cache[e]=r})}return c(e).then(function(e){return t.parse(e)})})},express:function(e){e=e||{};var r=this;return function(t,n,s){o(i.isArray(this.root)||i.isString(this.root),"illegal views root, are you using express.js?"),e.root=this.root,r.renderFile(t,n,e).then(function(e){return s(null,e)})["catch"](function(e){return s(e)})}}};t.lexical=p,t.isTruthy=v.isTruthy,t.isFalsy=v.isFalsy,t.evalExp=v.evalExp,t.evalValue=v.evalValue,t.Types={ParseError:x.ParseError,TokenizationEroor:x.TokenizationError,RenderBreakError:x.RenderBreakError,AssertionError:x.AssertionError},r.exports=t},{"./filters":1,"./src/filter.js":7,"./src/lexical.js":8,"./src/parser":10,"./src/render.js":11,"./src/scope":12,"./src/syntax.js":13,"./src/tag.js":14,"./src/tokenizer.js":15,"./src/util/assert.js":16,"./src/util/error.js":17,"./src/util/fs.js":18,"./src/util/promise.js":19,"./src/util/underscore.js":21,"./tags":32,"any-promise":3,path:6}],3:[function(e,r){"use strict";r.exports=e("./register")().Promise},{"./register":5}],4:[function(e,r){"use strict";var t="@@any-promise/REGISTRATION",n=null;r.exports=function(e,r){return function(s,i){s=s||null,i=i||{};var o=i.global!==!1;if(null===n&&o&&(n=e[t]||null),null!==n&&null!==s&&n.implementation!==s)throw new Error('any-promise already defined as "'+n.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return null===n&&(n=null!==s&&"undefined"!=typeof i.Promise?{Promise:i.Promise,implementation:s}:r(s),o&&(e[t]=n)),n}}},{}],5:[function(e,r){"use strict";function t(){if("undefined"==typeof window.Promise)throw new Error("any-promise browser requires a polyfill or explicit registration e.g: require('any-promise/register/bluebird')");return{Promise:window.Promise,implementation:"window.Promise"}}r.exports=e("./loader")(window,t)},{"./loader":4}],6:[function(){"use strict"},{}],7:[function(e,r){"use strict";var t=e("./lexical.js"),n=e("./syntax.js"),s=e("./util/assert.js"),i=new RegExp(""+t.value.source,"g");r.exports=function(){function e(e){var r=Object.create(a);return r.parse(e)}function r(e,r){u[e]=r}function o(){u={}}var u={},a={render:function(e,r){var t=this.args.map(function(e){return n.evalValue(e,r)});return t.unshift(e),this.filter.apply(null,t)},parse:function(e){var r=t.filterLine.exec(e);s(r,"illegal filter: "+e);var n=r[1],o=r[2]||"",a=u[n];if("function"!=typeof a)return{name:n,error:new TypeError("undefined filter: "+n)};for(var c=[];r=i.exec(o.trim());)c.push(r[0]);return this.name=n,this.filter=a,this.args=c,this}};return{construct:e,register:r,clear:o}}},{"./lexical.js":8,"./syntax.js":13,"./util/assert.js":16}],8:[function(e,r){"use strict";function t(e){return A.test(e)}function n(e){return S.test(e)}function s(e){return P.test(e)}function i(e){return R.test(e)}function o(e){return b.exec(e)}function u(e){var r;return(r=e.match(O))?Number(e):(r=e.match(M))?"true"===e.toLowerCase():(r=e.match(q))?e.slice(1,-1):void 0}var a=/'[^']*'/,c=/"[^"]*"/,l=new RegExp(a.source+"|"+c.source),f=new RegExp("(?:"+l.source+"|[^'\"])*"),p=/-?\d+/,h=/-?\d+\.?\d*|\.?\d+/,g=/true|false/,d=/[\w-]+/,v=new RegExp("\\[(?:"+l.source+"|[\\w-\\.]+)\\]"),m=new RegExp("(?:"+l.source+"|"+g.source+"|"+h.source+")"),y=new RegExp(d.source+"(?:\\."+d.source+"|"+v.source+")*"),j=new RegExp("(?:"+y.source+"|"+h.source+")"),w=new RegExp("\\("+j.source+"\\.\\."+j.source+"\\)"),x=new RegExp("\\(("+j.source+")\\.\\.("+j.source+")\\)"),b=new RegExp("(?:"+y.source+"|"+m.source+"|"+w.source+")"),E=new RegExp("(?:"+d.source+")\\s*:\\s*(?:"+b.source+")"),T=new RegExp("("+d.source+")\\s*:\\s*("+b.source+")","g"),k=new RegExp("^\\s*("+d.source+")\\s*(.*)\\s*$"),S=new RegExp("^"+m.source+"$","i"),R=new RegExp("^"+y.source+"$"),O=new RegExp("^"+h.source+"$"),M=new RegExp("^"+g.source+"$","i"),q=new RegExp("^"+l.source+"$"),P=new RegExp("^"+x.source+"$"),A=new RegExp("^"+p.source+"$"),L=new RegExp(b.source+"(\\s*,\\s*"+b.source+")*"),F=new RegExp(d.source+"(?:\\s*:\\s*"+L.source+")?","g"),D=new RegExp("("+d.source+")(?:\\s*:\\s*("+L.source+"))?"),I=new RegExp("^"+D.source+"$"),_=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/];r.exports={quoted:l,number:h,bool:g,literal:m,filter:F,integer:p,hash:E,hashCapture:T,range:w,rangeCapture:x,identifier:d,value:b,quoteBalanced:f,operators:_,quotedLine:q,numberLine:O,boolLine:M,rangeLine:P,literalLine:S,filterLine:I,tagLine:k,isLiteral:n,isVariable:i,parseLiteral:u,isRange:s,matchValue:o,isInteger:t}},{}],9:[function(e,r){"use strict";var t={"==":function(e,r){return e==r},"!=":function(e,r){return e!=r},">":function(e,r){return e>r},"<":function(e,r){return r>e},">=":function(e,r){return e>=r},"<=":function(e,r){return r>=e},contains:function(e,r){return e.indexOf(r)>-1},and:function(e,r){return e&&r},or:function(e,r){return e||r}};r.exports=t},{}],10:[function(e,r){"use strict";var t=e("./lexical.js"),n=e("./util/error.js").ParseError,s=e("./util/assert.js");r.exports=function(e,r){function i(e){for(var r,t=[];r=e.shift();)t.push(o(r,e));return t}function o(e,r){try{var t=null;return t="tag"===e.type?u(e,r):"output"===e.type?a(e.value):e,t.token=e,t}catch(s){throw new n(s,e)}}function u(r,t){return"continue"===r.name||"break"===r.name?r:e.construct(r,t)}function a(e){var n=t.matchValue(e);s(n,"illegal output string: "+e);var i=n[0];e=e.substr(n.index+n[0].length);for(var o=[];n=t.filter.exec(e);)o.push([n[0].trim()]);return{type:"output",initial:i,filters:o.map(function(e){return r.construct(e)})}}function c(e){var r=Object.create(l);return r.init(e)}var l={init:function(e){return this.tokens=e,this.handlers={},this},on:function(e,r){return this.handlers[e]=r,this},trigger:function(e,r){var t=this.handlers[e];return"function"==typeof t?(t(r),!0):void 0},start:function(){this.trigger("start");for(var e;!this.stopRequested&&(e=this.tokens.shift());)if(!(this.trigger("token",e)||"tag"==e.type&&this.trigger("tag:"+e.name,e))){var r=o(e,this.tokens);this.trigger("template",r)}return this.stopRequested||this.trigger("end"),this},stop:function(){return this.stopRequested=!0,this}};return{parse:i,parseTag:u,parseStream:c,parseOutput:a}}},{"./lexical.js":8,"./util/assert.js":16,"./util/error.js":17}],11:[function(e,r){"use strict";function t(){var e=Object.create(l);return e}function n(e){return"string"==typeof e?e:JSON.stringify(e)}var s=e("./syntax.js"),i=e("any-promise"),o=e("./util/promise.js").mapSeries,u=e("./util/error.js").RenderBreakError,a=e("./util/error.js").RenderError,c=e("./util/assert.js"),l={renderTemplates:function(e,r){function t(e){var t=this;return"tag"===e.type?this.renderTag(e,r).then(function(e){return void 0===e?"":e}):"output"===e.type?i.resolve().then(function(){return t.evalOutput(e,r)}).then(function(e){return void 0===e?"":n(e)}):i.resolve(e.value)}var s=this;c(r,"unable to evalTemplates: scope undefined");var l="";return o(e,function(e){return t.call(s,e).then(function(e){return l+=e})["catch"](function(r){if(r instanceof u)throw r.resolvedHTML=l,r;throw new a(r,e)})}).then(function(){return l})},renderTag:function(e,r){return"continue"===e.name?i.reject(new u("continue")):"break"===e.name?i.reject(new u("break")):e.render(r)},evalOutput:function(e,r){c(r,"unable to evalOutput: scope undefined");var t=s.evalExp(e.initial,r);return e.filters.some(function(e){if(e.error){if(r.get("liquid.strict_filters"))throw e.error;return t="",!0}t=e.render(t,r)}),t}};r.exports=t},{"./syntax.js":13,"./util/assert.js":16,"./util/error.js":17,"./util/promise.js":19,"any-promise":3}],12:[function(e,r,t){"use strict";function n(e,r){for(var t=1,n=r;n<e.length;n++)if("["===e[n]&&t++,"]"===e[n]&&(t--,0===t))return n;return-1}var s=e("./util/underscore.js"),i=e("./lexical.js"),o=e("./util/assert.js"),u={getAll:function(){for(var e={},r=this.scopes.length-1;r>=0;r--)s.assign(e,this.scopes[r]);return e},get:function(e){for(var r=this.scopes.length-1;r>=0;r--)try{return this.getPropertyByPath(this.scopes[r],e)}catch(t){if(/undefined variable/.test(t.message))continue;if(/Cannot read property/.test(t.message)){if(this.opts.strict_variables)throw t.message+=": "+e,t;continue}throw t.message+=": "+e,t}if(this.opts.strict_variables)throw new TypeError("undefined variable: "+e)},set:function(e,r){return this.setPropertyByPath(this.scopes[this.scopes.length-1],e,r),this},push:function(e){return o(e,"trying to push "+e+" into scopes"),this.scopes.push(e)},pop:function(){return this.scopes.pop()},unshift:function(e){return o(e,"trying to push "+e+" into scopes"),this.scopes.unshift(e)},shift:function(){return this.scopes.shift()},setPropertyByPath:function(e,r,t){if(s.isString(r))for(var n=r.replace(/\[/g,".").replace(/\]/g,"").split("."),i=0;i<n.length;i++){var o=n[i];if(i===n.length-1)return e[o]=t;void 0===e[o]&&(e[o]={}),e=e[o]||{}}},getPropertyByPath:function(e,r){var t=this.propertyAccessSeq(r+""),n=t.shift();if(!e.hasOwnProperty(n))throw new TypeError("undefined variable");var s=e[n];return t.forEach(function(e){return s=s[e]}),s},propertyAccessSeq:function(e){for(var r=[],t="",s=0;s<e.length;s++)if("["===e[s]){r.push(t),t="";var u=e[s+1];if("'"!==u&&'"'!==u){var a=n(e,s+1);o(-1!==a,"unbalanced []: "+e),t=e.slice(s+1,a),r.push(i.isInteger(t)?t:this.get(t)),t="",s=a}else a=e.indexOf(u,s+2),o(-1!==a,"unbalanced "+u+": "+e),t=e.slice(s+2,a),r.push(t),t="",s=a+1}else"."===e[s]?(r.push(t),t=""):t+=e[s];return t.length&&r.push(t),r}};t.factory=function(e,r){r=s.assign({strict_variables:!1,strict_filters:!1,blocks:{},root:[]},r),e=s.assign(e,{liquid:r});var t=Object.create(u);return t.opts=r,t.scopes=[e],t}},{"./lexical.js":8,"./util/assert.js":16,"./util/underscore.js":21}],13:[function(e,r){"use strict";function t(e,r){a(r,"unable to evalExp: scope undefined");for(var s,i=u.operators,c=0;c<i.length;c++){var l=i[c],f=new RegExp("^("+u.quoteBalanced.source+")("+l.source+")("+u.quoteBalanced.source+")$");if(s=e.match(f)){var p=t(s[1],r),h=o[s[2].trim()],g=t(s[3],r);return h(p,g)}}if(s=e.match(u.rangeLine)){for(var d=n(s[1],r),v=n(s[2],r),m=[],y=d;v>=y;y++)m.push(y);return m}return n(e,r)}function n(e,r){return e=e&&e.trim(),e?u.isLiteral(e)?u.parseLiteral(e):u.isVariable(e)?r.get(e):void 0:void 0}function s(e){return e instanceof Array?!!e.length:!!e}function i(e){return!s(e)}var o=e("./operators.js"),u=e("./lexical.js"),a=e("../src/util/assert.js");r.exports={evalExp:t,evalValue:n,isTruthy:s,isFalsy:i}},{"../src/util/assert.js":16,"./lexical.js":8,"./operators.js":9}],14:[function(e,r){"use strict";function t(e,r){var t,s={};for(n.hashCapture.lastIndex=0;t=n.hashCapture.exec(e);){var i=t[1],u=t[2];s[i]=o.evalValue(u,r)}return s}var n=e("./lexical.js"),s=e("./util/underscore.js"),i=e("any-promise"),o=e("./syntax.js"),u=e("./util/assert.js");r.exports=function(){function e(e,r){o[e]=r}function r(e,r){var t=Object.create(a);return t.parse(e,r),t}function n(){o={}}var o={},a={render:function(e){var r=t(this.token.args,e),n=this.tagImpl;return"function"!=typeof n.render?i.resolve(""):i.resolve().then(function(){return"function"==typeof n.render?n.render(e,r):""})["catch"](function(e){if(s.isError(e))throw e;var r="Please reject with an Error in "+n.render+", got "+e;throw new Error(r)})},parse:function(e,r){this.type="tag",this.token=e,this.name=e.name;var t=o[this.name];u(t,"tag "+this.name+" not found"),this.tagImpl=Object.create(t),this.tagImpl.parse&&this.tagImpl.parse(e,r)}};return{construct:r,register:e,clear:n}}},{"./lexical.js":8,"./syntax.js":13,"./util/assert.js":16,"./util/underscore.js":21,"any-promise":3}],15:[function(e,r,t){"use strict";function n(e){function r(r,n,s){return{type:r,raw:s[n],value:s[n+1].trim(),line:t(s),input:e}}function t(e){var r=e.input.slice(h+1,e.index).split("\n");return g+=r.length-1,h=e.index,g+1}u(o.isString(e),"illegal input type");for(var n,a,c,l=[],f=/({%(.*?)%})|({{(.*?)}})/g,p=0,h=-1,g=0;null!==(n=f.exec(e));){if(n.index>p&&(a=e.slice(p,n.index),l.push({type:"html",raw:a,value:a})),n[1]){c=r("tag",1,n);var d=c.value.match(s.tagLine);if(!d)throw new i("illegal tag syntax",c);c.name=d[1],c.args=d[2],l.push(c)}else c=r("output",3,n),l.push(c);p=f.lastIndex}return e.length>p&&(a=e.slice(p,e.length),l.push({type:"html",raw:a,value:a})),l}var s=e("./lexical.js"),i=e("./util/error.js").TokenizationError,o=e("./util/underscore.js"),u=e("../src/util/assert.js");t.parse=n},{"../src/util/assert.js":16,"./lexical.js":8,"./util/error.js":17,"./util/underscore.js":21}],16:[function(e,r){"use strict";function t(e,r){if(!e){if(r instanceof Error)throw r;var r=r||"expect "+e+" to be true";throw new n(r)}}var n=e("./error.js").AssertionError;r.exports=t},{"./error.js":17}],17:[function(e,r){"use strict";function t(e,r){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.input=r.input,this.line=r.line;var t=u(r.input,r.line);this.message=e+"\n"+t}function n(e,r){this.name=this.constructor.name,this.stack=e.stack,this.input=r.input,this.line=r.line;var t=u(r.input,r.line);this.message=e.message+"\n"+t}function s(e,r){this.name=this.constructor.name,this.stack=e.stack,this.input=r.token.input,this.line=r.token.line;var t=u(r.token.input,r.token.line);this.message=e.message+"\n"+t}function i(e){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||""}function o(e){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e}function u(e,r){var t=e.split("\n"),n=Math.max(r-2,1),s=Math.min(r+3,t.length),i=c.range(n,s+1).map(function(e){return[e===r?">> ":" ",a(e,s),"| ",t[e-1]].join("")}).join("\n");return i}function a(e,r){var t=(r+"").length,n=e+"",s=Array(t-n.length).join(" ");return s+n}var c=e("./underscore.js");t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,o.prototype=Object.create(Error.prototype),o.prototype.constructor=o,r.exports={TokenizationError:t,ParseError:n,RenderBreakError:i,AssertionError:o,RenderError:s}},{"./underscore.js":21}],18:[function(e,r){"use strict";function t(e){return new Promise(function(r,t){s.readFile(e,"utf8",function(e,n){e?t(e):r(n)})})}function n(e){return new Promise(function(r,t){s.stat(e,function(e,n){return e?t(e):r(n)})})}var s=e("fs");r.exports={readFileAsync:t,statFileAsync:n}},{fs:6}],19:[function(e,r,t){"use strict";function n(e,r){var t=i.reject(new Error("init"));return e.forEach(function(n,s){t=t["catch"](function(){return r(n,s,e)})}),t}function s(e,r){var t=i.resolve("init"),n=[];return e.forEach(function(s,i){t=t.then(function(){return r(s,i,e)}).then(function(e){return n.push(e)})}),t.then(function(){return n})}var i=e("any-promise");t.anySeries=n,t.mapSeries=s},{"any-promise":3}],20:[function(e,r){"use strict";var t=["January","February","March","April","May","June","July","August","September","October","November","December"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o={1:"st",2:"nd",3:"rd","default":"th"},u={daysInMonth:function(e){var r=u.isLeapYear(e)?29:28;return[31,r,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(e){for(var r=0,t=0;t<e.getMonth();++t)r+=u.daysInMonth(e)[t];return r+e.getDate()},getWeekOfYear:function(e,r){var t=this.getDayOfYear(e)+(r-e.getDay()),n=new Date(e.getFullYear(),0,1),s=7-n.getDay()+r;return a.pad(Math.floor((t-s)/7)+1,2)},isLeapYear:function(e){var r=e.getFullYear();return!(0!==(3&r)||!(r%100||r%400===0&&r))},getSuffix:function(e){var r=e.getDate().toString(),t=parseInt(r.slice(-1));return o[t]||o["default"]},century:function(e){return parseInt(e.getFullYear().toString().substring(0,2),10)}},a={pad:function f(e,r,t){t||(t="0");for(var n=e.toString(),f=r-n.length;f-->0;)n=t+n;return n}},c={a:function(e){return i[e.getDay()]},A:function(e){return s[e.getDay()]},b:function(e){return n[e.getMonth()]},B:function(e){return t[e.getMonth()]},c:function(e){return e.toLocaleString()},C:function(e){return u.century(e)},d:function(e){return a.pad(e.getDate(),2)},e:function(e){return a.pad(e.getDate(),2," ")},H:function(e){return a.pad(e.getHours(),2)},I:function(e){return a.pad(e.getHours()%12||12,2)},j:function(e){return a.pad(u.getDayOfYear(e),3)},k:function(e){return a.pad(e.getHours(),2," ")},l:function(e){return a.pad(e.getHours()%12||12,2," ")},L:function(e){return a.pad(e.getMilliseconds(),3)},m:function(e){return a.pad(e.getMonth()+1,2)},M:function(e){return a.pad(e.getMinutes(),2)},p:function(e){return e.getHours()<12?"AM":"PM"},P:function(e){return e.getHours()<12?"am":"pm"},q:function(e){return u.getSuffix(e)},s:function(e){return Math.round(e.valueOf()/1e3)},S:function(e){return a.pad(e.getSeconds(),2)},u:function(e){return e.getDay()||7},U:function(e){return u.getWeekOfYear(e,0)},w:function(e){return e.getDay()},W:function(e){return u.getWeekOfYear(e,1)},x:function(e){return e.toLocaleDateString()},X:function(e){return e.toLocaleTimeString()},y:function(e){return e.getFullYear().toString().substring(2,4)},Y:function(e){return e.getFullYear()},z:function(e){var r=e.getTimezoneOffset()/60*100;return(r>0?"-":"+")+a.pad(Math.abs(r),4)},"%":function(){return"%"}};c.h=c.b,c.N=c.L;var l=function(e,r){for(var t="",n=r;;){var s=/%./g,i=s.exec(n);if(!i)return t+n;t+=n.slice(0,s.lastIndex-2),n=n.slice(s.lastIndex);var o=i[0].charAt(1),u=c[o];t+=u?u.call(this,e):"%"+o}};r.exports=l},{}],21:[function(e,r,t){"use strict";function n(e){return e instanceof String||"string"==typeof e}function s(e){var r=Object.prototype.toString.call(e);return"Error"===r.substr(-6,5)||"string"==typeof e.message&&"string"==typeof e.name}function i(e,r){e=e||{};for(var t in e)if(e.hasOwnProperty(t)&&r(e[t],t,e)===!1)break;return e}function o(e){e=f(e)?e:{};var r=Array.prototype.slice.call(arguments,1);return r.forEach(function(r){u(e,r)}),e}function u(e,r){return e?(i(r,function(r,t){e[t]=r}),e):e}function a(e){return e instanceof Array}function c(e){return function(r){return console.log("["+e+"]",r),r}}function l(e){for(var r={},t=[],n=0,s=e.length;s>n;++n)r.hasOwnProperty(e[n])||(t.push(e[n]),r[e[n]]=1);return t}function f(e){return null!==e&&"object"===("undefined"==typeof e?"undefined":h(e))}function p(e,r,t){1===arguments.length&&(r=e,e=0),t=t||1;for(var n=[],s=e;r>s;s+=t)n.push(s);return n}var h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};t.isString=n,t.isArray=a,t.isObject=f,t.isError=s,t.range=p,t.forOwn=i,t.assign=o,t.uniq=l,t.echo=c},{}],22:[function(e,r){"use strict";var t=e(".."),n=t.lexical,s=e("any-promise"),i=new RegExp("("+n.identifier.source+")\\s*=(.*)"),o=e("../src/util/assert.js");r.exports=function(e){e.registerTag("assign",{parse:function(e){var r=e.args.match(i);o(r,"illegal token "+e.raw),this.key=r[1],this.value=r[2]},render:function(r){return r.set(this.key,e.evalOutput(this.value,r)),s.resolve("")}})}},{"..":2,"../src/util/assert.js":16,"any-promise":3}],23:[function(e,r){"use strict";var t=e(".."),n=t.lexical,s=new RegExp("("+n.identifier.source+")"),i=e("../src/util/assert.js");r.exports=function(e){e.registerTag("capture",{parse:function(r,t){var n=this,o=r.args.match(s);i(o,r.args+" not valid identifier"),this.variable=o[1],this.templates=[];var u=e.parser.parseStream(t);u.on("tag:endcapture",function(){return u.stop()}).on("template",function(e){return n.templates.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")}),u.start()},render:function(r){var t=this;return e.renderer.renderTemplates(this.templates,r).then(function(e){r.set(t.variable,e)})}})}},{"..":2,"../src/util/assert.js":16}],24:[function(e,r){"use strict";{var t=e("..");e("../src/util/assert.js")}r.exports=function(e){e.registerTag("case",{parse:function(r,t){var n=this;this.cond=r.args,this.cases=[],this.elseTemplates=[];var s=[],i=e.parser.parseStream(t).on("tag:when",function(e){n.cases[e.args]||n.cases.push({val:e.args,templates:s=[]})}).on("tag:else",function(){return s=n.elseTemplates}).on("tag:endcase",function(){return i.stop()}).on("template",function(e){return s.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});i.start()},render:function(r){for(var n=0;n<this.cases.length;n++){var s=this.cases[n],i=t.evalExp(s.val,r),o=t.evalExp(this.cond,r);if(i===o)return e.renderer.renderTemplates(s.templates,r)}return e.renderer.renderTemplates(this.elseTemplates,r)}})}},{"..":2,"../src/util/assert.js":16}],25:[function(e,r){"use strict";r.exports=function(e){e.registerTag("comment",{parse:function(r,t){var n=e.parser.parseStream(t);n.on("token",function(e){"endcomment"===e.name&&n.stop()}).on("end",function(){throw new Error("tag "+r.raw+" not closed")}),n.start()}})}},{}],26:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),s=t.lexical,i=new RegExp("^(?:("+s.value.source+")\\s*:\\s*)?(.*)$"),o=new RegExp(s.value.source,"g"),u=e("../src/util/assert.js");r.exports=function(e){e.registerTag("cycle",{parse:function(e){var r=i.exec(e.args);u(r,"illegal tag: "+e.raw),this.group=r[1]||"";var t=r[2];for(this.candidates=[];r=o.exec(t);)this.candidates.push(r[0]);u(this.candidates.length,"empty candidates: "+e.raw)},render:function(e){var r=t.evalValue(this.group,e),s="cycle:"+r+":"+this.candidates.join(","),i=e.get("liquid"),o=i[s];void 0===o&&(o=i[s]=0);var u=this.candidates[o];return o=(o+1)%this.candidates.length,i[s]=o,n.resolve(t.evalValue(u,e))}})}},{"..":2,"../src/util/assert.js":16,"any-promise":3}],27:[function(e,r){"use strict";var t=e(".."),n=t.lexical,s=e("../src/util/assert.js");r.exports=function(e){e.registerTag("decrement",{parse:function(e){var r=e.args.match(n.identifier);s(r,"illegal identifier "+e.args),this.variable=r[0]},render:function(e){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r-1)}})}},{"..":2,"../src/util/assert.js":16}],28:[function(e,r){"use strict";var t=e(".."),n=t.lexical,s=e("../src/util/promise.js").mapSeries,i=t.Types.RenderBreakError,o=e("../src/util/assert.js"),u=new RegExp("^("+n.identifier.source+")\\s+in\\s+"+("("+n.value.source+")")+("(?:\\s+"+n.hash.source+")*")+"(?:\\s+(reversed))?$");r.exports=function(e){e.registerTag("for",{parse:function(r,t){var n=this,s=u.exec(r.args);o(s,"illegal tag: "+r.raw),this.variable=s[1],this.collection=s[2],this.reversed=!!s[3],this.templates=[],this.elseTemplates=[];var i,a=e.parser.parseStream(t).on("start",function(){return i=n.templates}).on("tag:else",function(){return i=n.elseTemplates}).on("tag:endfor",function(){return a.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});a.start()},render:function(r,n){var o=this,u=t.evalExp(this.collection,r);if(t.isFalsy(u))return e.renderer.renderTemplates(this.elseTemplates,r);var a=u.length,c=n.offset||0,l=void 0===n.limit?u.length:n.limit;u=u.slice(c,c+l),this.reversed&&u.reverse();var f=u.map(function(e,r){var t={};return t[o.variable]=e,t.forloop={first:0===r,index:r+1,index0:r,last:r===a-1,length:a,rindex:a-r,rindex0:a-r-1,stop:!1,skip:!1},t}),p="";return s(f,function(t){return r.push(t),e.renderer.renderTemplates(o.templates,r).then(function(e){return p+=e})["catch"](function(e){if(!(e instanceof i&&(p+=e.resolvedHTML,"continue"===e.message)))throw e}).then(function(){return r.pop()})})["catch"](function(e){if(!(e instanceof i&&"break"===e.message))throw e}).then(function(){return p})}})}},{"..":2,"../src/util/assert.js":16,"../src/util/promise.js":19}],29:[function(e,r){"use strict";var t=e("..");r.exports=function(e){e.registerTag("if",{parse:function(r,t){var n=this;this.branches=[],this.elseTemplates=[];var s,i=e.parser.parseStream(t).on("start",function(){return n.branches.push({cond:r.args,templates:s=[]})}).on("tag:elsif",function(e){n.branches[e.args]||n.branches.push({cond:e.args,templates:s=[]})}).on("tag:else",function(){return s=n.elseTemplates}).on("tag:endif",function(){return i.stop()}).on("template",function(e){return s.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});i.start()},render:function(r){for(var n=0;n<this.branches.length;n++){var s=this.branches[n],i=t.evalExp(s.cond,r);if(t.isTruthy(i))return e.renderer.renderTemplates(s.templates,r)}return e.renderer.renderTemplates(this.elseTemplates,r)}})}},{"..":2}],30:[function(e,r){"use strict";var t=e(".."),n=t.lexical,s=new RegExp("with\\s+("+n.value.source+")"),i=e("../src/util/assert.js");r.exports=function(e){e.registerTag("include",{parse:function(e){var r=n.value.exec(e.args);i(r,"illegal token "+e.raw),this.value=r[0],r=s.exec(e.args),r&&(this["with"]=r[1])},render:function(r,n){var s=t.evalValue(this.value,r),i=r.get("liquid"),o=i.blocks;return i.blocks={},this["with"]&&(n[s]=t.evalValue(this["with"],r)),e.getTemplate(s,i.root).then(function(t){return r.push(n),e.renderer.renderTemplates(t,r)}).then(function(e){return r.pop(),i.blocks=o,e})}})}},{"..":2,"../src/util/assert.js":16}],31:[function(e,r){"use strict";var t=e(".."),n=e("../src/util/assert.js"),s=t.lexical;r.exports=function(e){e.registerTag("increment",{parse:function(e){var r=e.args.match(s.identifier);n(r,"illegal identifier "+e.args),this.variable=r[0]},render:function(e){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r+1)}})}},{"..":2,"../src/util/assert.js":16}],32:[function(e,r){"use strict";r.exports=function(r){e("./assign.js")(r),e("./capture.js")(r),e("./case.js")(r),e("./comment.js")(r),e("./cycle.js")(r),e("./decrement.js")(r),e("./for.js")(r),e("./if.js")(r),e("./include.js")(r),e("./increment.js")(r),e("./layout.js")(r),e("./raw.js")(r),e("./tablerow.js")(r),e("./unless.js")(r)}},{"./assign.js":22,"./capture.js":23,"./case.js":24,"./comment.js":25,"./cycle.js":26,"./decrement.js":27,"./for.js":28,"./if.js":29,"./include.js":30,"./increment.js":31,"./layout.js":33,"./raw.js":34,"./tablerow.js":35,"./unless.js":36}],33:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),s=t.lexical,i=e("../src/util/assert.js");
r.exports=function(e){e.registerTag("layout",{parse:function(r,t){var n=s.value.exec(r.args);i(n,"illegal token "+r.raw),this.layout=n[0],this.tpls=e.parser.parse(t)},render:function(r,n){var s=t.evalValue(this.layout,r),i=r.get("liquid");return e.renderer.renderTemplates(this.tpls,r).then(function(){return e.getTemplate(s,i.root)}).then(function(e){return r.push(n),e}).then(function(t){return e.renderer.renderTemplates(t,r)}).then(function(e){return r.pop(),e})}}),e.registerTag("block",{parse:function(r,t){var n=this,s=/\w+/.exec(r.args);this.block=s?s[0]:"anonymous",this.tpls=[];var i=e.parser.parseStream(t).on("tag:endblock",function(){return i.stop()}).on("template",function(e){return n.tpls.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});i.start()},render:function(r){var t=this,s=r.get("liquid"),i=s.blocks[this.block];return void 0===i?e.renderer.renderTemplates(this.tpls,r).then(function(e){return s.blocks[t.block]=e,e}):(s.blocks[this.block]=i,n.resolve(i))}})}},{"..":2,"../src/util/assert.js":16,"any-promise":3}],34:[function(e,r){"use strict";var t=e("any-promise");r.exports=function(e){e.registerTag("raw",{parse:function(r,t){var n=this;this.tokens=[];var s=e.parser.parseStream(t);s.on("token",function(e){"endraw"===e.name?s.stop():n.tokens.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")}),s.start()},render:function(){var e=this.tokens.map(function(e){return e.raw}).join("");return t.resolve(e)}})}},{"any-promise":3}],35:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),s=t.lexical,i=e("../src/util/assert.js"),o=new RegExp("^("+s.identifier.source+")\\s+in\\s+"+("("+s.value.source+")")+("(?:\\s+"+s.hash.source+")*$"));r.exports=function(e){e.registerTag("tablerow",{parse:function(r,t){var n=this,s=o.exec(r.args);i(s,"illegal tag: "+r.raw),this.variable=s[1],this.collection=s[2],this.templates=[];var u,a=e.parser.parseStream(t).on("start",function(){return u=n.templates}).on("tag:endtablerow",function(){return a.stop()}).on("template",function(e){return u.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});a.start()},render:function(r,s){var i,o,u=this,a=t.evalExp(this.collection,r)||[],c="<table>",l=s.offset||0,f=void 0===s.limit?a.length:s.limit,p=s.cols;if(!p)throw new Error("illegal cols: "+p);a=a.slice(l,l+f);var h=[];a.some(function(e){var r={};r[u.variable]=e,h.push(r)});var g=h.reduce(function(t,n,s){return t.then(function(){return i=Math.floor(s/p)+1,o=s%p+1,1===o&&(1!==i&&(c+="</tr>"),c+='<tr class="row'+i+'">'),c+='<td class="col'+o+'">'}).then(function(){return r.push(n),e.renderer.renderTemplates(u.templates,r)}).then(function(e){return r.pop(n),c+=e,c+="</td>"})},n.resolve(""));return g.then(function(){return i>0&&(c+="</tr>"),c+="</table>"})["catch"](function(e){throw e})}})}},{"..":2,"../src/util/assert.js":16,"any-promise":3}],36:[function(e,r){"use strict";var t=e("..");r.exports=function(e){e.registerTag("unless",{parse:function(r,t){var n=this;this.templates=[],this.elseTemplates=[];var s,i=e.parser.parseStream(t).on("start",function(){s=n.templates,n.cond=r.args}).on("tag:else",function(){return s=n.elseTemplates}).on("tag:endunless",function(){return i.stop()}).on("template",function(e){return s.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});i.start()},render:function(r){var n=t.evalExp(this.cond,r);return t.isFalsy(n)?e.renderer.renderTemplates(this.templates,r):e.renderer.renderTemplates(this.elseTemplates,r)}})}},{"..":2}]},{},[2])(2)});

4

index.js

@@ -50,3 +50,3 @@ const Scope = require('./src/scope');

.catch(e => {
if (e instanceof Errors.RenderBreak) {
if (e instanceof Errors.RenderBreakError) {
return e.html;

@@ -149,3 +149,3 @@ }

TokenizationEroor: Errors.TokenizationError,
RenderBreak: Errors.RenderBreak,
RenderBreakError: Errors.RenderBreakError,
AssertionError: Errors.AssertionError

@@ -152,0 +152,0 @@ };

{
"name": "shopify-liquid",
"version": "1.3.2",
"version": "1.3.3",
"description": "Liquid template engine for JavaScript, Node.js and Browser",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -55,12 +55,14 @@ const lexical = require('./lexical.js');

try {
switch (token.type) {
case 'tag':
return parseTag(token, tokens);
case 'output':
return parseOutput(token.value);
case 'html':
return token;
var tpl = null;
if (token.type === 'tag') {
tpl = parseTag(token, tokens);
} else if (token.type === 'output') {
tpl = parseOutput(token.value);
} else { // token.type === 'html'
tpl = token;
}
tpl.token = token;
return tpl;
} catch (e) {
throw new ParseError(e.message, token.input, token.line, e);
throw new ParseError(e, token);
}

@@ -82,3 +84,3 @@ }

var filters = [];
while(match = lexical.filter.exec(str)){
while (match = lexical.filter.exec(str)) {
filters.push([match[0].trim()]);

@@ -100,4 +102,7 @@ }

return {
parse, parseTag, parseStream, parseOutput
parse,
parseTag,
parseStream,
parseOutput
};
};
const Syntax = require('./syntax.js');
const Promise = require('any-promise');
const mapSeries = require('./util/promise.js').mapSeries;
const RenderBreak = require('./util/error.js').RenderBreak;
const RenderBreakError = require('./util/error.js').RenderBreakError;
const RenderError = require('./util/error.js').RenderError;
const assert = require('./util/assert.js');
const _ = require('./util/underscore.js');

@@ -18,6 +18,7 @@ var render = {

.catch(e => {
if(e instanceof RenderBreak){
if(e instanceof RenderBreakError){
e.resolvedHTML = html;
throw e;
}
throw e;
throw new RenderError(e, tpl);
});

@@ -31,3 +32,4 @@ }).then(() => html);

} else if (template.type === 'output') {
return Promise.resolve(this.evalOutput(template, scope))
return Promise.resolve()
.then(() => this.evalOutput(template, scope))
.then(partial => partial === undefined ? '' : stringify(partial));

@@ -42,6 +44,6 @@ } else { // template.type === 'html'

if (template.name === 'continue') {
return Promise.reject(new RenderBreak('continue'));
return Promise.reject(new RenderBreakError('continue'));
}
if (template.name === 'break') {
return Promise.reject(new RenderBreak('break'));
return Promise.reject(new RenderBreakError('break'));
}

@@ -59,3 +61,3 @@ return template.render(scope);

} else {
val = ''
val = '';
return true;

@@ -62,0 +64,0 @@ }

const _ = require('./util/underscore.js');
const lexical = require('./lexical.js');
const assert = require('./util/assert.js');
const referenceError = /undefined variable|Cannot read property .* of undefined/;

@@ -19,3 +18,13 @@ var Scope = {

} catch (e) {
if (!referenceError.test(e.message) || this.opts.strict_variables) {
if (/undefined variable/.test(e.message)) {
continue;
}
if (/Cannot read property/.test(e.message)) {
if (this.opts.strict_variables) {
e.message += ': ' + str;
throw e;
} else {
continue;
}
} else {
e.message += ': ' + str;

@@ -26,3 +35,3 @@ throw e;

}
if(this.opts.strict_variables){
if (this.opts.strict_variables) {
throw new TypeError('undefined variable: ' + str);

@@ -29,0 +38,0 @@ }

const lexical = require('./lexical.js');
const _ = require('./util/underscore.js');
const Promise = require('any-promise');

@@ -7,3 +8,4 @@ const Syntax = require('./syntax.js');

function hash(markup, scope) {
var obj = {}, match;
var obj = {},
match;
lexical.hashCapture.lastIndex = 0;

@@ -24,5 +26,18 @@ while (match = lexical.hashCapture.exec(markup)) {

var obj = hash(this.token.args, scope);
return this.tagImpl.render && this.tagImpl.render(scope, obj) || Promise.resolve('');
var impl = this.tagImpl;
if (typeof impl.render !== 'function') {
return Promise.resolve('');
}
return Promise.resolve()
.then(() => typeof impl.render === 'function' ?
impl.render(scope, obj) : '')
.catch(function(e) {
if (_.isError(e)) {
throw e;
}
var msg = `Please reject with an Error in ${impl.render}, got ${e}`;
throw new Error(msg);
});
},
parse: function(token, tokens){
parse: function(token, tokens) {
this.type = 'tag';

@@ -35,3 +50,3 @@ this.token = token;

this.tagImpl = Object.create(tagImpl);
if(this.tagImpl.parse){
if (this.tagImpl.parse) {
this.tagImpl.parse(token, tokens);

@@ -57,4 +72,6 @@ }

return {
construct, register, clear
construct,
register,
clear
};
};

@@ -7,5 +7,5 @@ const lexical = require('./lexical.js');

function parse(html) {
assert(_.isString(html), 'illegal input type');
var tokens = [];
assert(_.isString(html), new TokenizationError('illegal input type'));
var syntax = /({%(.*?)%})|({{(.*?)}})/g;

@@ -31,4 +31,3 @@ var result, htmlFragment, token;

if (!match) {
throw new TokenizationError(`illegal tag: ${token.raw}`,
token.input, token.line);
throw new TokenizationError(`illegal tag syntax`, token);
}

@@ -41,4 +40,3 @@ token.name = match[1];

// output
else {
token = factory('output', 3, result);
else { token = factory('output', 3, result);
tokens.push(token);

@@ -66,13 +64,6 @@ }

line: getLineNum(match),
input: getLineContent(match)
input: html
};
}
function getLineContent(match) {
var idx1 = match.input.lastIndexOf('\n', match.index);
var idx2 = match.input.indexOf('\n', match.index);
if (idx2 === -1) idx2 = match.input.length;
return match.input.slice(idx1 + 1, idx2);
}
function getLineNum(match) {

@@ -79,0 +70,0 @@ var lines = match.input.slice(lastMatchBegin + 1, match.index).split('\n');

@@ -1,3 +0,5 @@

function TokenizationError(message, input, line) {
if(Error.captureStackTrace){
const _ = require('./underscore.js');
function TokenizationError(message, token) {
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);

@@ -7,5 +9,7 @@ }

this.message = message;
this.input = input;
this.line = line;
this.input = token.input;
this.line = token.line;
var context = mkContext(token.input, token.line);
this.message = message + '\n' + context;
}

@@ -15,12 +19,11 @@ TokenizationError.prototype = Object.create(Error.prototype);

function ParseError(message, input, line, e) {
if(Error.captureStackTrace){
Error.captureStackTrace(this, this.constructor);
}
function ParseError(e, token) {
this.name = this.constructor.name;
this.originalError = e;
this.stack = e.stack;
this.message = message;
this.input = input;
this.line = line;
this.input = token.input;
this.line = token.line;
var context = mkContext(token.input, token.line);
this.message = e.message + '\n' + context;
}

@@ -30,14 +33,27 @@ ParseError.prototype = Object.create(Error.prototype);

function RenderBreak(message){
if(Error.captureStackTrace){
function RenderError(e, tpl) {
this.name = this.constructor.name;
this.stack = e.stack;
this.input = tpl.token.input;
this.line = tpl.token.line;
var context = mkContext(tpl.token.input, tpl.token.line);
this.message = e.message + '\n' + context;
}
RenderError.prototype = Object.create(Error.prototype);
RenderError.prototype.constructor = RenderError;
function RenderBreakError(message) {
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = this.constructor.name;
this.message = message;
this.message = message || '';
}
RenderBreak.prototype = Object.create(Error.prototype);
RenderBreak.prototype.constructor = RenderBreak;
RenderBreakError.prototype = Object.create(Error.prototype);
RenderBreakError.prototype.constructor = RenderBreakError;
function AssertionError(message){
if(Error.captureStackTrace){
function AssertionError(message) {
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);

@@ -51,4 +67,33 @@ }

function mkContext(input, line) {
var lines = input.split('\n');
var begin = Math.max(line - 2, 1);
var end = Math.min(line + 3, lines.length);
var context = _
.range(begin, end + 1)
.map(l => [
(l === line) ? '>> ' : ' ',
align(l, end),
'| ',
lines[l - 1]
].join(''))
.join('\n');
return context;
}
function align(n, max) {
var length = (max + '').length;
var str = n + '';
var blank = Array(length - str.length).join(' ');
return blank + str;
}
module.exports = {
TokenizationError, ParseError, RenderBreak, AssertionError
TokenizationError,
ParseError,
RenderBreakError,
AssertionError,
RenderError
};

@@ -10,2 +10,9 @@ /*

function isError(value) {
var signature = Object.prototype.toString.call(value);
// [object XXXError]
return signature.substr(-6, 5) === 'Error' ||
(typeof value.message == 'string' && typeof value.name == 'string');
}
/*

@@ -92,6 +99,31 @@ * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.

/*
* A function to create flexibly-numbered lists of integers,
* handy for each and map loops. start, if omitted, defaults to 0; step defaults to 1.
* Returns a list of integers from start (inclusive) to stop (exclusive),
* incremented (or decremented) by step, exclusive.
* Note that ranges that stop before they start are considered to be zero-length instead of
* negative — if you'd like a negative range, use a negative step.
*/
function range(start, stop, step) {
if (arguments.length === 1) {
stop = start;
start = 0;
}
step = step || 1;
var arr = [];
for (var i = start; i < stop; i += step) {
arr.push(i);
}
return arr;
}
exports.isString = isString;
exports.isArray = isArray;
exports.isObject = isObject;
exports.isError = isError;
exports.range = range;
exports.forOwn = forOwn;

@@ -98,0 +130,0 @@ exports.assign = assign;

const Liquid = require('..');
const Promise = require('any-promise');
const lexical = Liquid.lexical;
const mapSeries = require('../src/util/promise.js').mapSeries;
const RenderBreak = Liquid.Types.RenderBreak;
const RenderBreakError = Liquid.Types.RenderBreakError;
const assert = require('../src/util/assert.js');

@@ -26,7 +25,7 @@ const re = new RegExp(`^(${lexical.identifier.source})\\s+in\\s+` +

var p, stream = liquid.parser.parseStream(remainTokens)
.on('start', x => p = this.templates)
.on('tag:else', token => p = this.elseTemplates)
.on('tag:endfor', token => stream.stop())
.on('start', () => p = this.templates)
.on('tag:else', () => p = this.elseTemplates)
.on('tag:endfor', () => stream.stop())
.on('template', tpl => p.push(tpl))
.on('end', x => {
.on('end', () => {
throw new Error(`tag ${tagToken.raw} not closed`);

@@ -75,3 +74,3 @@ });

.catch(e => {
if (e instanceof RenderBreak) {
if (e instanceof RenderBreakError) {
html += e.resolvedHTML;

@@ -84,3 +83,3 @@ if (e.message === 'continue') return;

}).catch((e) => {
if (e instanceof RenderBreak && e.message === 'break') {
if (e instanceof RenderBreakError && e.message === 'break') {
return;

@@ -87,0 +86,0 @@ }

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc