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

liquidjs

Package Overview
Dependencies
Maintainers
1
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liquidjs - npm Package Compare versions

Comparing version 1.9.6 to 1.9.7

.npmignore

2

dist/liquid.min.js

@@ -1,1 +0,1 @@

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

@@ -42,19 +42,19 @@ "main": "index.js",

"chai-as-promised": "^7.1.1",
"coveralls": "^2.13.1",
"eslint": "^4.6.1",
"coveralls": "^3.0.0",
"eslint": "^4.8.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-mocha": "^4.11.0",
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^3.0.1",
"express": "^4.15.4",
"express": "^4.16.1",
"istanbul": "^0.4.5",
"mocha": "^3.5.3",
"mocha": "^4.0.0",
"mock-fs": "^4.4.1",
"sinon": "^3.2.1",
"sinon-chai": "^2.13.0",
"sinon": "^4.0.1",
"sinon-chai": "^2.14.0",
"supertest": "^3.0.0",
"uglify-js": "^3.1.0"
"uglify-js": "^3.1.3"
}
}

@@ -46,3 +46,3 @@ const Liquid = require('..')

} else if (_.isObject(collection)) {
collection = Object.keys(collection)
collection = Object.keys(collection).map((key) => [key, collection[key]])
}

@@ -49,0 +49,0 @@ }

@@ -1,42 +0,40 @@

const Liquid = require('..');
const lexical = Liquid.lexical;
const withRE = new RegExp(`with\\s+(${lexical.value.source})`);
const assert = require('../src/util/assert.js');
const Liquid = require('..')
const lexical = Liquid.lexical
const withRE = new RegExp(`with\\s+(${lexical.value.source})`)
const assert = require('../src/util/assert.js')
module.exports = function(liquid) {
module.exports = function (liquid) {
liquid.registerTag('include', {
parse: function (token) {
var match = lexical.value.exec(token.args)
assert(match, `illegal token ${token.raw}`)
this.value = match[0]
liquid.registerTag('include', {
parse: function(token){
var match = lexical.value.exec(token.args);
assert(match, `illegal token ${token.raw}`);
this.value = match[0];
match = withRE.exec(token.args)
if (match) {
this.with = match[1]
}
},
render: function (scope, hash) {
var filepath = Liquid.evalValue(this.value, scope)
match = withRE.exec(token.args);
if(match){
this.with = match[1];
}
},
render: function(scope, hash) {
var filepath = Liquid.evalValue(this.value, scope);
var register = scope.get('liquid')
var originBlocks = register.blocks
register.blocks = {}
var register = scope.get('liquid');
var originBlocks = register.blocks;
register.blocks = {};
if(this.with){
hash[filepath] = Liquid.evalValue(this.with, scope);
}
return liquid.getTemplate(filepath, register.root)
.then((templates) => {
scope.push(hash);
return liquid.renderer.renderTemplates(templates, scope);
})
.then((html) => {
scope.pop();
register.blocks = originBlocks;
return html;
});
}
});
};
if (this.with) {
hash[filepath] = Liquid.evalValue(this.with, scope)
}
return liquid.getTemplate(filepath, register.root)
.then((templates) => {
scope.push(hash)
return liquid.renderer.renderTemplates(templates, scope)
})
.then((html) => {
scope.pop()
register.blocks = originBlocks
return html
})
}
})
}

@@ -1,66 +0,68 @@

const Liquid = require('..');
const Promise = require('any-promise');
const lexical = Liquid.lexical;
const assert = require('../src/util/assert.js');
const Liquid = require('..')
const Promise = require('any-promise')
const lexical = Liquid.lexical
const assert = require('../src/util/assert.js')
module.exports = function(liquid) {
module.exports = function (liquid) {
liquid.registerTag('layout', {
parse: function (token, remainTokens) {
var match = lexical.value.exec(token.args)
assert(match, `illegal token ${token.raw}`)
liquid.registerTag('layout', {
parse: function(token, remainTokens){
var match = lexical.value.exec(token.args);
assert(match, `illegal token ${token.raw}`);
this.layout = match[0]
this.tpls = liquid.parser.parse(remainTokens)
},
render: function (scope, hash) {
var layout = Liquid.evalValue(this.layout, scope)
var register = scope.get('liquid')
this.layout = match[0];
this.tpls = liquid.parser.parse(remainTokens);
},
render: function(scope, hash) {
var layout = Liquid.evalValue(this.layout, scope);
var register = scope.get('liquid');
// render the remaining tokens immediately
return liquid.renderer.renderTemplates(this.tpls, scope)
// now register.blocks contains rendered blocks
.then(() => liquid.getTemplate(layout, register.root))
.then(templates => {
// push the hash
scope.push(hash)
// render the parent
return liquid.renderer.renderTemplates(templates, scope)
})
// pop the hash
.then(partial => {
scope.pop()
return partial
})
}
})
// render the remaining tokens immediately
return liquid.renderer.renderTemplates(this.tpls, scope)
// now register.blocks contains rendered blocks
.then(() => liquid.getTemplate(layout, register.root))
// push the hash
.then(templates => (scope.push(hash), templates))
// render the parent
.then(templates => liquid.renderer.renderTemplates(templates, scope))
// pop the hash
.then(partial => (scope.pop(), partial));
}
});
liquid.registerTag('block', {
parse: function (token, remainTokens) {
var match = /\w+/.exec(token.args)
this.block = match ? match[0] : 'anonymous'
liquid.registerTag('block', {
parse: function(token, remainTokens){
var match = /\w+/.exec(token.args);
this.block = match ? match[0] : 'anonymous';
this.tpls = [];
var stream = liquid.parser.parseStream(remainTokens)
.on('tag:endblock', () => stream.stop())
.on('template', tpl => this.tpls.push(tpl))
.on('end', () => {
throw new Error(`tag ${token.raw} not closed`);
});
stream.start();
},
render: function(scope){
var register = scope.get('liquid');
var html = register.blocks[this.block];
// if not defined yet
if (html === undefined) {
return liquid.renderer.renderTemplates(this.tpls, scope)
.then((partial) => {
register.blocks[this.block] = partial;
return partial;
});
}
// if already defined by desendents
else {
register.blocks[this.block] = html;
return Promise.resolve(html);
}
}
});
};
this.tpls = []
var stream = liquid.parser.parseStream(remainTokens)
.on('tag:endblock', () => stream.stop())
.on('template', tpl => this.tpls.push(tpl))
.on('end', () => {
throw new Error(`tag ${token.raw} not closed`)
})
stream.start()
},
render: function (scope) {
var register = scope.get('liquid')
var html = register.blocks[this.block]
// if not defined yet
if (html === undefined) {
return liquid.renderer.renderTemplates(this.tpls, scope)
.then((partial) => {
register.blocks[this.block] = partial
return partial
})
} else {
// if already defined by desendents
register.blocks[this.block] = html
return Promise.resolve(html)
}
}
})
}

Sorry, the diff of this file is not supported yet

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