Socket
Socket
Sign inDemoInstall

nunjucks

Package Overview
Dependencies
Maintainers
5
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nunjucks - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

bin/render

4

browser/nunjucks-slim.min.js

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

/*! Browser bundle of nunjucks 3.0.0 (slim, only works with precompiled templates) */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.nunjucks=e():t.nunjucks=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var r=n(1),i=n(2),o=n(14),s=n(3),u=n(3);t.exports={},t.exports.Environment=i.Environment,t.exports.Template=i.Template,t.exports.Loader=o,t.exports.FileSystemLoader=s.FileSystemLoader,t.exports.PrecompiledLoader=s.PrecompiledLoader,t.exports.WebLoader=s.WebLoader,t.exports.compiler=n(3),t.exports.parser=n(3),t.exports.lexer=n(3),t.exports.runtime=n(8),t.exports.lib=r,t.exports.nodes=n(3),t.exports.installJinjaCompat=n(15);var a;t.exports.configure=function(t,e){e=e||{},r.isObject(t)&&(e=t,t=null);var n;return s.FileSystemLoader?n=new s.FileSystemLoader(t,{watch:e.watch,noCache:e.noCache}):s.WebLoader&&(n=new s.WebLoader(t,{useCache:e.web&&e.web.useCache,async:e.web&&e.web.async})),a=new i.Environment(n,e),e&&e.express&&a.express(e.express),a},t.exports.compile=function(e,n,r,i){return a||t.exports.configure(),new t.exports.Template(e,n,r,i)},t.exports.render=function(e,n,r){return a||t.exports.configure(),a.render(e,n,r)},t.exports.renderString=function(e,n,r){return a||t.exports.configure(),a.renderString(e,n,r)},u&&(t.exports.precompile=u.precompile,t.exports.precompileString=u.precompileString)},function(t,e){"use strict";var n=Array.prototype,r=Object.prototype,i={"&":"&amp;",'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;"},o=/[&"'<>]/g,s=function(t){return i[t]},e=t.exports={};e.prettifyError=function(t,n,r){if(r.Update||(r=new e.TemplateError(r)),r.Update(t),!n){var i=r;r=new Error(i.message),r.name=i.name}return r},e.TemplateError=function(t,e,n){var r=this;if(t instanceof Error){r=t,t=t.name+": "+t.message;try{r.name=""}catch(i){r=this}}else Error.captureStackTrace&&Error.captureStackTrace(r);return r.name="Template render error",r.message=t,r.lineno=e,r.colno=n,r.firstUpdate=!0,r.Update=function(t){var e="("+(t||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?e+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(e+=" [Line "+this.lineno+"]")),e+="\n ",this.firstUpdate&&(e+=" "),this.message=e+(this.message||""),this.firstUpdate=!1,this},r},e.TemplateError.prototype=Error.prototype,e.escape=function(t){return t.replace(o,s)},e.isFunction=function(t){return"[object Function]"===r.toString.call(t)},e.isArray=Array.isArray||function(t){return"[object Array]"===r.toString.call(t)},e.isString=function(t){return"[object String]"===r.toString.call(t)},e.isObject=function(t){return"[object Object]"===r.toString.call(t)},e.groupBy=function(t,n){for(var r={},i=e.isFunction(n)?n:function(t){return t[n]},o=0;o<t.length;o++){var s=t[o],u=i(s,o);(r[u]||(r[u]=[])).push(s)}return r},e.toArray=function(t){return Array.prototype.slice.call(t)},e.without=function(t){var n=[];if(!t)return n;for(var r=-1,i=t.length,o=e.toArray(arguments).slice(1);++r<i;)-1===e.indexOf(o,t[r])&&n.push(t[r]);return n},e.extend=function(t,e){for(var n in e)t[n]=e[n];return t},e.repeat=function(t,e){for(var n="",r=0;e>r;r++)n+=t;return n},e.each=function(t,e,r){if(null!=t)if(n.each&&t.each===n.each)t.forEach(e,r);else if(t.length===+t.length)for(var i=0,o=t.length;o>i;i++)e.call(r,t[i],i,t)},e.map=function(t,e){var r=[];if(null==t)return r;if(n.map&&t.map===n.map)return t.map(e);for(var i=0;i<t.length;i++)r[r.length]=e(t[i],i);return t.length===+t.length&&(r.length=t.length),r},e.asyncIter=function(t,e,n){function r(){i++,i<t.length?e(t[i],i,r,n):n()}var i=-1;r()},e.asyncFor=function(t,n,r){function i(){u++;var e=o[u];s>u?n(e,t[e],u,s,i):r()}var o=e.keys(t),s=o.length,u=-1;i()},e.indexOf=Array.prototype.indexOf?function(t,e,n){return Array.prototype.indexOf.call(t,e,n)}:function(t,e,n){var r=this.length>>>0;for(n=+n||0,Math.abs(n)===1/0&&(n=0),0>n&&(n+=r,0>n&&(n=0));r>n;n++)if(t[n]===e)return n;return-1},Array.prototype.map||(Array.prototype.map=function(){throw new Error("map is unimplemented for this js engine")}),e.keys=function(t){if(Object.prototype.keys)return t.keys();var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},e.inOperator=function(t,n){if(e.isArray(n))return-1!==e.indexOf(n,t);if(e.isObject(n))return t in n;if(e.isString(n))return-1!==n.indexOf(t);throw new Error('Cannot use "in" operator to search for "'+t+'" in unexpected types.')}},function(t,e,n){"use strict";function r(t,e,n){s(function(){t(e,n)})}var i,o=n(3),s=n(4),u=n(1),a=n(6),c=n(3),l=n(7),f=n(3),p=n(8),h=n(9),v=n(10),d=p.Frame;f.PrecompiledLoader=n(13);var m=a.extend({init:function(t,e){e=this.opts=e||{},this.opts.dev=!!e.dev,this.opts.autoescape=null!=e.autoescape?e.autoescape:!0,this.opts.throwOnUndefined=!!e.throwOnUndefined,this.opts.trimBlocks=!!e.trimBlocks,this.opts.lstripBlocks=!!e.lstripBlocks,this.loaders=[],t?this.loaders=u.isArray(t)?t:[t]:f.FileSystemLoader?this.loaders=[new f.FileSystemLoader("views")]:f.WebLoader&&(this.loaders=[new f.WebLoader("/views")]),window.nunjucksPrecompiled&&this.loaders.unshift(new f.PrecompiledLoader(window.nunjucksPrecompiled)),this.initCache(),this.globals=h(),this.filters={},this.asyncFilters=[],this.extensions={},this.extensionsList=[];for(var n in l)this.addFilter(n,l[n])},initCache:function(){u.each(this.loaders,function(t){t.cache={},"function"==typeof t.on&&t.on("update",function(e){t.cache[e]=null})})},addExtension:function(t,e){return e._name=t,this.extensions[t]=e,this.extensionsList.push(e),this},removeExtension:function(t){var e=this.getExtension(t);e&&(this.extensionsList=u.without(this.extensionsList,e),delete this.extensions[t])},getExtension:function(t){return this.extensions[t]},hasExtension:function(t){return!!this.extensions[t]},addGlobal:function(t,e){return this.globals[t]=e,this},getGlobal:function(t){if("undefined"==typeof this.globals[t])throw new Error("global not found: "+t);return this.globals[t]},addFilter:function(t,e,n){var r=e;return n&&this.asyncFilters.push(t),this.filters[t]=r,this},getFilter:function(t){if(!this.filters[t])throw new Error("filter not found: "+t);return this.filters[t]},resolveTemplate:function(t,e,n){var r=t.isRelative&&e?t.isRelative(n):!1;return r&&t.resolve?t.resolve(e,n):n},getTemplate:function(t,e,n,r,o){var s=this,a=null;if(t&&t.raw&&(t=t.raw),u.isFunction(n)&&(o=n,n=null,e=e||!1),u.isFunction(e)&&(o=e,e=!1),t instanceof i)a=t;else{if("string"!=typeof t)throw new Error("template names must be a string: "+t);for(var c=0;c<this.loaders.length;c++){var l=this.resolveTemplate(this.loaders[c],n,t);if(a=this.loaders[c].cache[l])break}}if(!a){var f,p=this,h=function(n,s){if(s||n||r||(n=new Error("template not found: "+t)),n){if(!o)throw n;o(n)}else{var u;s?(u=new i(s.src,p,s.path,e),s.noCache||(s.loader.cache[t]=u)):u=new i("",p,"",e),o?o(null,u):f=u}};return u.asyncIter(this.loaders,function(e,r,i,o){function u(t,n){t?o(t):n?(n.loader=e,o(null,n)):i()}t=s.resolveTemplate(e,n,t),e.async?e.getSource(t,u):u(null,e.getSource(t))},h),f}return e&&a.compile(),o?void o(null,a):a},express:function(t){function e(t,e){if(this.name=t,this.path=t,this.defaultEngine=e.defaultEngine,this.ext=o.extname(t),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}var n=this;return e.prototype.render=function(t,e){n.render(this.name,t,e)},t.set("view",e),t.set("nunjucksEnv",this),this},render:function(t,e,n){u.isFunction(e)&&(n=e,e=null);var i=null;return this.getTemplate(t,function(t,o){if(t&&n)r(n,t);else{if(t)throw t;i=o.render(e,n)}}),i},renderString:function(t,e,n,r){u.isFunction(n)&&(r=n,n={}),n=n||{};var o=new i(t,this,n.path);return o.render(e,r)},waterfall:v}),g=a.extend({init:function(t,e,n){this.env=n||new m,this.ctx={};for(var r in t)t.hasOwnProperty(r)&&(this.ctx[r]=t[r]);this.blocks={},this.exported=[];for(var i in e)this.addBlock(i,e[i])},lookup:function(t){return t in this.env.globals&&!(t in this.ctx)?this.env.globals[t]:this.ctx[t]},setVariable:function(t,e){this.ctx[t]=e},getVariables:function(){return this.ctx},addBlock:function(t,e){return this.blocks[t]=this.blocks[t]||[],this.blocks[t].push(e),this},getBlock:function(t){if(!this.blocks[t])throw new Error('unknown block "'+t+'"');return this.blocks[t][0]},getSuper:function(t,e,n,r,i,o){var s=u.indexOf(this.blocks[e]||[],n),a=this.blocks[e][s+1],c=this;if(-1===s||!a)throw new Error('no super block available for "'+e+'"');a(t,c,r,i,o)},addExport:function(t){this.exported.push(t)},getExported:function(){for(var t={},e=0;e<this.exported.length;e++){var n=this.exported[e];t[n]=this.ctx[n]}return t}});i=a.extend({init:function(t,e,n,r){if(this.env=e||new m,u.isObject(t))switch(t.type){case"code":this.tmplProps=t.obj;break;case"string":this.tmplStr=t.obj}else{if(!u.isString(t))throw new Error("src must be a string or an object describing the source");this.tmplStr=t}if(this.path=n,r){var i=this;try{i._compile()}catch(o){throw u.prettifyError(this.path,this.env.opts.dev,o)}}else this.compiled=!1},render:function(t,e,n){"function"==typeof t?(n=t,t={}):"function"==typeof e&&(n=e,e=null);var i=!0;e&&(i=!1);var o=this;try{o.compile()}catch(s){var a=u.prettifyError(this.path,this.env.opts.dev,s);if(n)return r(n,a);throw a}var c=new g(t||{},o.blocks,o.env),l=e?e.push(!0):new d;l.topLevel=!0;var f=null;return o.rootRenderFunc(o.env,c,l||new d,p,function(t,e){if(t&&(t=u.prettifyError(o.path,o.env.opts.dev,t)),n)i?r(n,t,e):n(t,e);else{if(t)throw t;f=e}}),f},getExported:function(t,e,n){"function"==typeof t&&(n=t,t={}),"function"==typeof e&&(n=e,e=null);try{this.compile()}catch(r){if(n)return n(r);throw r}var i=e?e.push():new d;i.topLevel=!0;var o=new g(t||{},this.blocks,this.env);this.rootRenderFunc(this.env,o,i,p,function(t){t?n(t,null):n(null,o.getExported())})},compile:function(){this.compiled||this._compile()},_compile:function(){var t;if(this.tmplProps)t=this.tmplProps;else{var e=c.compile(this.tmplStr,this.env.asyncFilters,this.env.extensionsList,this.path,this.env.opts),n=new Function(e);t=n()}this.blocks=this._getBlocks(t),this.rootRenderFunc=t.root,this.compiled=!0},_getBlocks:function(t){var e={};for(var n in t)"b_"===n.slice(0,2)&&(e[n.slice(2)]=t[n]);return e}}),t.exports={Environment:m,Template:i}},function(t,e){},function(t,e,n){"use strict";function r(){if(a.length)throw a.shift()}function i(t){var e;e=u.length?u.pop():new o,e.task=t,s(e)}function o(){this.task=null}var s=n(5),u=[],a=[],c=s.makeRequestCallFromTimer(r);t.exports=i,o.prototype.call=function(){try{this.task.call()}catch(t){i.onerror?i.onerror(t):(a.push(t),c())}finally{this.task=null,u[u.length]=this}}},function(t,e){(function(e){"use strict";function n(t){u.length||(s(),a=!0),u[u.length]=t}function r(){for(;c<u.length;){var t=c;if(c+=1,u[t].call(),c>l){for(var e=0,n=u.length-c;n>e;e++)u[e]=u[e+c];u.length-=c,c=0}}u.length=0,c=0,a=!1}function i(t){var e=1,n=new f(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}function o(t){return function(){function e(){clearTimeout(n),clearInterval(r),t()}var n=setTimeout(e,0),r=setInterval(e,50)}}t.exports=n;var s,u=[],a=!1,c=0,l=1024,f=e.MutationObserver||e.WebKitMutationObserver;s="function"==typeof f?i(r):o(r),n.requestFlush=s,n.makeRequestCallFromTimer=o}).call(e,function(){return this}())},function(t,e){"use strict";function n(t,e,r){var i=function(){};i.prototype=t.prototype;var o=new i,s=/xyz/.test(function(){xyz})?/\bparent\b/:/.*/;r=r||{};for(var u in r){var a=r[u],c=o[u];"function"==typeof c&&"function"==typeof a&&s.test(a)?o[u]=function(t,e){return function(){var n=this.parent;this.parent=e;var r=t.apply(this,arguments);return this.parent=n,r}}(a,c):o[u]=a}o.typename=e;var l=function(){o.init&&o.init.apply(this,arguments)};return l.prototype=o,l.prototype.constructor=l,l.extend=function(t,e){return"object"==typeof t&&(e=t,t="anonymous"),n(l,t,e)},l}t.exports=n(Object,"Object",{})},function(t,e,n){"use strict";function r(t,e){return null===t||void 0===t||t===!1?e:t}var i=n(1),o=n(8),s={abs:function(t){return Math.abs(t)},batch:function(t,e,n){var r,i=[],o=[];for(r=0;r<t.length;r++)r%e===0&&o.length&&(i.push(o),o=[]),o.push(t[r]);if(o.length){if(n)for(r=o.length;e>r;r++)o.push(n);i.push(o)}return i},capitalize:function(t){t=r(t,"");var e=t.toLowerCase();return o.copySafeness(t,e.charAt(0).toUpperCase()+e.slice(1))},center:function(t,e){if(t=r(t,""),e=e||80,t.length>=e)return t;var n=e-t.length,s=i.repeat(" ",n/2-n%2),u=i.repeat(" ",n/2);return o.copySafeness(t,s+t+u)},"default":function(t,e,n){return n?t?t:e:void 0!==t?t:e},dictsort:function(t,e,n){if(!i.isObject(t))throw new i.TemplateError("dictsort filter: val must be an object");var r=[];for(var o in t)r.push([o,t[o]]);var s;if(void 0===n||"key"===n)s=0;else{if("value"!==n)throw new i.TemplateError("dictsort filter: You can only sort by either key or value");s=1}return r.sort(function(t,n){var r=t[s],o=n[s];return e||(i.isString(r)&&(r=r.toUpperCase()),i.isString(o)&&(o=o.toUpperCase())),r>o?1:r===o?0:-1}),r},dump:function(t,e){return JSON.stringify(t,null,e)},escape:function(t){return t instanceof o.SafeString?t:(t=null===t||void 0===t?"":t,o.markSafe(i.escape(t.toString())))},safe:function(t){return t instanceof o.SafeString?t:(t=null===t||void 0===t?"":t,o.markSafe(t.toString()))},first:function(t){return t[0]},groupby:function(t,e){return i.groupBy(t,e)},indent:function(t,e,n){if(t=r(t,""),""===t)return"";e=e||4;for(var s="",u=t.split("\n"),a=i.repeat(" ",e),c=0;c<u.length;c++)s+=0!==c||n?a+u[c]+"\n":u[c]+"\n";return o.copySafeness(t,s)},join:function(t,e,n){return e=e||"",n&&(t=i.map(t,function(t){return t[n]})),t.join(e)},last:function(t){return t[t.length-1]},length:function(t){var e=r(t,"");return void 0!==e?"function"==typeof Map&&e instanceof Map||"function"==typeof Set&&e instanceof Set?e.size:!i.isObject(e)||e instanceof o.SafeString?e.length:Object.keys(e).length:0},list:function(t){if(i.isString(t))return t.split("");if(i.isObject(t)){var e=[];if(Object.keys)e=Object.keys(t);else for(var n in t)e.push(n);return i.map(e,function(e){return{key:e,value:t[e]}})}if(i.isArray(t))return t;throw new i.TemplateError("list filter: type not iterable")},lower:function(t){return t=r(t,""),t.toLowerCase()},nl2br:function(t){return null===t||void 0===t?"":o.copySafeness(t,t.replace(/\r\n|\n/g,"<br />\n"))},random:function(t){return t[Math.floor(Math.random()*t.length)]},rejectattr:function(t,e){return t.filter(function(t){return!t[e]})},selectattr:function(t,e){return t.filter(function(t){return!!t[e]})},replace:function(t,e,n,r){var i=t;if(e instanceof RegExp)return t.replace(e,n);"undefined"==typeof r&&(r=-1);var s="";if("number"==typeof e)e+="";else if("string"!=typeof e)return t;if("number"==typeof t&&(t+=""),"string"!=typeof t&&!(t instanceof o.SafeString))return t;if(""===e)return s=n+t.split("").join(n)+n,o.copySafeness(t,s);var u=t.indexOf(e);if(0===r||-1===u)return t;for(var a=0,c=0;u>-1&&(-1===r||r>c);)s+=t.substring(a,u)+n,a=u+e.length,c++,u=t.indexOf(e,a);return a<t.length&&(s+=t.substring(a)),o.copySafeness(i,s)},reverse:function(t){var e;return e=i.isString(t)?s.list(t):i.map(t,function(t){return t}),e.reverse(),i.isString(t)?o.copySafeness(t,e.join("")):e},round:function(t,e,n){e=e||0;var r,i=Math.pow(10,e);return r="ceil"===n?Math.ceil:"floor"===n?Math.floor:Math.round,r(t*i)/i},slice:function(t,e,n){for(var r=Math.floor(t.length/e),i=t.length%e,o=0,s=[],u=0;e>u;u++){var a=o+u*r;i>u&&o++;var c=o+(u+1)*r,l=t.slice(a,c);n&&u>=i&&l.push(n),s.push(l)}return s},sum:function(t,e,n){var r=0;"number"==typeof n&&(r+=n),e&&(t=i.map(t,function(t){return t[e]}));for(var o=0;o<t.length;o++)r+=t[o];return r},sort:o.makeMacro(["value","reverse","case_sensitive","attribute"],[],function(t,e,n,r){return t=i.map(t,function(t){return t}),t.sort(function(t,o){var s,u;return r?(s=t[r],u=o[r]):(s=t,u=o),!n&&i.isString(s)&&i.isString(u)&&(s=s.toLowerCase(),u=u.toLowerCase()),u>s?e?1:-1:s>u?e?-1:1:0}),t}),string:function(t){return o.copySafeness(t,t)},striptags:function(t,e){t=r(t,""),e=e||!1;var n=/<\/?([a-z][a-z0-9]*)\b[^>]*>|<!--[\s\S]*?-->/gi,i=s.trim(t.replace(n,"")),u="";return u=e?i.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):i.replace(/\s+/gi," "),o.copySafeness(t,u)},title:function(t){t=r(t,"");for(var e=t.split(" "),n=0;n<e.length;n++)e[n]=s.capitalize(e[n]);return o.copySafeness(t,e.join(" "))},trim:function(t){return o.copySafeness(t,t.replace(/^\s*|\s*$/g,""))},truncate:function(t,e,n,i){var s=t;if(t=r(t,""),e=e||255,t.length<=e)return t;if(n)t=t.substring(0,e);else{var u=t.lastIndexOf(" ",e);-1===u&&(u=e),t=t.substring(0,u)}return t+=void 0!==i&&null!==i?i:"...",o.copySafeness(s,t)},upper:function(t){return t=r(t,""),t.toUpperCase()},urlencode:function(t){var e=encodeURIComponent;if(i.isString(t))return e(t);var n;if(i.isArray(t))n=t.map(function(t){return e(t[0])+"="+e(t[1])});else{n=[];for(var r in t)t.hasOwnProperty(r)&&n.push(e(r)+"="+e(t[r]))}return n.join("&")},urlize:function(t,e,n){isNaN(e)&&(e=1/0);var r=n===!0?' rel="nofollow"':"",i=/^(?:\(|<|&lt;)?(.*?)(?:\.|,|\)|\n|&gt;)?$/,o=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,s=/^https?:\/\/.*$/,u=/^www\./,a=/\.(?:org|net|com)(?:\:|\/|$)/,c=t.split(/(\s+)/).filter(function(t){return t&&t.length}).map(function(t){var n=t.match(i),c=n&&n[1]||t;return s.test(c)?'<a href="'+c+'"'+r+">"+c.substr(0,e)+"</a>":u.test(c)?'<a href="http://'+c+'"'+r+">"+c.substr(0,e)+"</a>":o.test(c)?'<a href="mailto:'+c+'">'+c+"</a>":a.test(c)?'<a href="http://'+c+'"'+r+">"+c.substr(0,e)+"</a>":t});return c.join("")},wordcount:function(t){t=r(t,"");var e=t?t.match(/\w+/g):null;return e?e.length:null},"float":function(t,e){var n=parseFloat(t);return isNaN(n)?e:n},"int":function(t,e){var n=parseInt(t,10);return isNaN(n)?e:n}};s.d=s["default"],s.e=s.escape,t.exports=s},function(t,e,n){"use strict";function r(t,e,n){return function(){var r,i,u=s(arguments),a=o(arguments);if(u>t.length){r=Array.prototype.slice.call(arguments,0,t.length);var c=Array.prototype.slice.call(arguments,r.length,u);for(i=0;i<c.length;i++)i<e.length&&(a[e[i]]=c[i]);r.push(a)}else if(u<t.length){for(r=Array.prototype.slice.call(arguments,0,u),i=u;i<t.length;i++){var l=t[i];r.push(a[l]),delete a[l]}r.push(a)}else r=arguments;return n.apply(this,r)}}function i(t){return t.__keywords=!0,t}function o(t){var e=t.length;if(e){var n=t[e-1];if(n&&n.hasOwnProperty("__keywords"))return n}return{}}function s(t){var e=t.length;if(0===e)return 0;var n=t[e-1];return n&&n.hasOwnProperty("__keywords")?e-1:e}function u(t){return"string"!=typeof t?t:(this.val=t,void(this.length=t.length))}function a(t,e){return t instanceof u?new u(e):e.toString()}function c(t){var e=typeof t;return"string"===e?new u(t):"function"!==e?t:function(){var e=t.apply(this,arguments);return"string"==typeof e?new u(e):e}}function l(t,e){return t=void 0!==t&&null!==t?t:"",!e||t instanceof u||(t=y.escape(t.toString())),t}function f(t,e,n){if(null===t||void 0===t)throw new y.TemplateError("attempted to output null or undefined value",e+1,n+1);return t}function p(t,e){return t=t||{},"function"==typeof t[e]?function(){return t[e].apply(t,arguments)}:t[e]}function h(t,e,n,r){if(!t)throw new Error("Unable to call `"+e+"`, which is undefined or falsey");if("function"!=typeof t)throw new Error("Unable to call `"+e+"`, which is not a function");return t.apply(n,r)}function v(t,e,n){var r=e.lookup(n);return void 0!==r?r:t.lookup(n)}function d(t,e,n){return t.lineno?t:new y.TemplateError(t,e,n)}function m(t,e,n,r){if(y.isArray(t)){var i=t.length;y.asyncIter(t,function(t,r,o){switch(e){case 1:n(t,r,i,o);break;case 2:n(t[0],t[1],r,i,o);break;case 3:n(t[0],t[1],t[2],r,i,o);break;default:t.push(r,o),n.apply(this,t)}},r)}else y.asyncFor(t,function(t,e,r,i,o){n(t,e,r,i,o)},r)}function g(t,e,n,r){function i(t,e){a++,u[t]=e,a===o&&r(null,u.join(""))}var o,s,u,a=0;if(y.isArray(t))if(o=t.length,u=new Array(o),0===o)r(null,"");else for(s=0;s<t.length;s++){var c=t[s];switch(e){case 1:n(c,s,o,i);break;case 2:n(c[0],c[1],s,o,i);break;case 3:n(c[0],c[1],c[2],s,o,i);break;default:c.push(s,i),n.apply(this,c)}}else{var l=y.keys(t);if(o=l.length,u=new Array(o),0===o)r(null,"");else for(s=0;s<l.length;s++){var f=l[s];n(f,t[f],s,o,i)}}}var y=n(1),w=n(6),b=w.extend({init:function(t,e){this.variables={},this.parent=t,this.topLevel=!1,this.isolateWrites=e},set:function(t,e,n){var r=t.split("."),i=this.variables,o=this;if(n&&(o=this.resolve(r[0],!0)))return void o.set(t,e);for(var s=0;s<r.length-1;s++){var u=r[s];i[u]||(i[u]={}),i=i[u]}i[r[r.length-1]]=e},get:function(t){var e=this.variables[t];return void 0!==e?e:null},lookup:function(t){var e=this.parent,n=this.variables[t];return void 0!==n?n:e&&e.lookup(t)},resolve:function(t,e){var n=e&&this.isolateWrites?void 0:this.parent,r=this.variables[t];return void 0!==r?this:n&&n.resolve(t)},push:function(t){return new b(this,t)},pop:function(){return this.parent}});u.prototype=Object.create(String.prototype,{length:{writable:!0,configurable:!0,value:0}}),u.prototype.valueOf=function(){return this.val},u.prototype.toString=function(){return this.val},t.exports={Frame:b,makeMacro:r,makeKeywordArgs:i,numArgs:s,suppressValue:l,ensureDefined:f,memberLookup:p,contextOrFrameLookup:v,callWrap:h,handleError:d,isArray:y.isArray,keys:y.keys,SafeString:u,copySafeness:a,markSafe:c,asyncEach:m,asyncAll:g,inOperator:y.inOperator}},function(t,e){"use strict";function n(t){var e=-1;return{current:null,reset:function(){e=-1,this.current=null},next:function(){return e++,e>=t.length&&(e=0),this.current=t[e],this.current}}}function r(t){t=t||",";var e=!0;return function(){var n=e?"":t;return e=!1,n}}function i(){return{range:function(t,e,n){"undefined"==typeof e?(e=t,t=0,n=1):n||(n=1);var r,i=[];if(n>0)for(r=t;e>r;r+=n)i.push(r);else for(r=t;r>e;r+=n)i.push(r);return i},cycler:function(){return n(Array.prototype.slice.call(arguments))},joiner:function(t){return r(t)}}}t.exports=i},function(t,e,n){var r,i;(function(n,o){!function(s){"use strict";var u=function(){var t=Array.prototype.slice.call(arguments);"function"==typeof t[0]&&t[0].apply(null,t.splice(1))},a=function(t){"function"==typeof n?n(t):"undefined"!=typeof o&&o.nextTick?o.nextTick(t):setTimeout(t,0)},c=function(t){var e=function(n){var r=function(){return t.length&&t[n].apply(null,arguments),r.next()};return r.next=function(){return n<t.length-1?e(n+1):null},r};return e(0)},l=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},f=function(t,e,n){var r=n?a:u;if(e=e||function(){},!l(t)){var i=new Error("First argument to waterfall must be an array of functions");return e(i)}if(!t.length)return e();var o=function(t){return function(n){if(n)e.apply(null,arguments),e=function(){};else{var i=Array.prototype.slice.call(arguments,1),s=t.next();s?i.push(o(s)):i.push(e),r(function(){t.apply(null,i)})}}};o(c(t))()};r=[],i=function(){return f}.apply(e,r),!(void 0!==i&&(t.exports=i))}(this)}).call(e,n(11).setImmediate,n(3))},function(t,e,n){(function(t,r){function i(t,e){this._id=t,this._clearFn=e}var o=n(12).nextTick,s=Function.prototype.apply,u=Array.prototype.slice,a={},c=0;e.setTimeout=function(){return new i(s.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new i(s.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},e.setImmediate="function"==typeof t?t:function(t){var n=c++,r=arguments.length<2?!1:u.call(arguments,1);return a[n]=!0,o(function(){a[n]&&(r?t.apply(null,r):t.call(null),e.clearImmediate(n))}),n},e.clearImmediate="function"==typeof r?r:function(t){delete a[t]}}).call(e,n(11).setImmediate,n(11).clearImmediate)},function(t,e){function n(){c=!1,s.length?a=s.concat(a):l=-1,a.length&&r()}function r(){if(!c){var t=setTimeout(n);c=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,c=!1,clearTimeout(t)}}function i(t,e){this.fun=t,this.array=e}function o(){}var s,u=t.exports={},a=[],c=!1,l=-1;u.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new i(t,e)),1!==a.length||c||setTimeout(r,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=o,u.addListener=o,u.once=o,u.off=o,u.removeListener=o,u.removeAllListeners=o,u.emit=o,u.binding=function(t){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(t){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(t,e,n){"use strict";var r=n(14),i=r.extend({init:function(t){this.precompiled=t||{}},getSource:function(t){return this.precompiled[t]?{src:{type:"code",obj:this.precompiled[t]},path:t}:null}});t.exports=i},function(t,e,n){"use strict";var r=n(3),i=n(6),o=n(1),s=i.extend({on:function(t,e){this.listeners=this.listeners||{},this.listeners[t]=this.listeners[t]||[],this.listeners[t].push(e)},emit:function(t){var e=Array.prototype.slice.call(arguments,1);this.listeners&&this.listeners[t]&&o.each(this.listeners[t],function(t){t.apply(null,e)})},resolve:function(t,e){return r.resolve(r.dirname(t),e)},isRelative:function(t){return 0===t.indexOf("./")||0===t.indexOf("../")}});t.exports=s},function(t,e){function n(){"use strict";var t=this.runtime,e=this.lib,n=t.contextOrFrameLookup;t.contextOrFrameLookup=function(t,e,r){var i=n.apply(this,arguments);if(void 0===i)switch(r){case"True":return!0;case"False":return!1;case"None":return null}return i};var r=t.memberLookup,i={pop:function(t){if(void 0===t)return this.pop();if(t>=this.length||0>t)throw new Error("KeyError");return this.splice(t,1)},append:function(t){return this.push(t)},remove:function(t){for(var e=0;e<this.length;e++)if(this[e]===t)return this.splice(e,1);throw new Error("ValueError")},count:function(t){for(var e=0,n=0;n<this.length;n++)this[n]===t&&e++;return e},index:function(t){var e;if(-1===(e=this.indexOf(t)))throw new Error("ValueError");return e},find:function(t){return this.indexOf(t)},insert:function(t,e){return this.splice(t,0,e)}},o={items:function(){var t=[];for(var e in this)t.push([e,this[e]]);return t},values:function(){var t=[];for(var e in this)t.push(this[e]);return t},keys:function(){var t=[];for(var e in this)t.push(e);return t},get:function(t,e){var n=this[t];return void 0===n&&(n=e),n},has_key:function(t){return this.hasOwnProperty(t)},pop:function(t,e){var n=this[t];if(void 0===n&&void 0!==e)n=e;else{if(void 0===n)throw new Error("KeyError");delete this[t]}return n},popitem:function(){for(var t in this){var e=this[t];return delete this[t],[t,e]}throw new Error("KeyError")},setdefault:function(t,e){return t in this?this[t]:(void 0===e&&(e=null),this[t]=e)},update:function(t){for(var e in t)this[e]=t[e];return null}};o.iteritems=o.items,o.itervalues=o.values,o.iterkeys=o.keys,t.memberLookup=function(t,n,s){return t=t||{},e.isArray(t)&&i.hasOwnProperty(n)?function(){return i[n].apply(t,arguments)}:e.isObject(t)&&o.hasOwnProperty(n)?function(){return o[n].apply(t,arguments)}:r.apply(this,arguments)}}t.exports=n}])});
/*! Browser bundle of nunjucks 3.0.1 (slim, only works with precompiled templates) */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.nunjucks=e():t.nunjucks=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var r=n(1),i=n(2),o=n(15),s=n(3),a=n(3);t.exports={},t.exports.Environment=i.Environment,t.exports.Template=i.Template,t.exports.Loader=o,t.exports.FileSystemLoader=s.FileSystemLoader,t.exports.PrecompiledLoader=s.PrecompiledLoader,t.exports.WebLoader=s.WebLoader,t.exports.compiler=n(3),t.exports.parser=n(3),t.exports.lexer=n(3),t.exports.runtime=n(8),t.exports.lib=r,t.exports.nodes=n(3),t.exports.installJinjaCompat=n(16);var u;t.exports.configure=function(t,e){e=e||{},r.isObject(t)&&(e=t,t=null);var n;return s.FileSystemLoader?n=new s.FileSystemLoader(t,{watch:e.watch,noCache:e.noCache}):s.WebLoader&&(n=new s.WebLoader(t,{useCache:e.web&&e.web.useCache,async:e.web&&e.web.async})),u=new i.Environment(n,e),e&&e.express&&u.express(e.express),u},t.exports.compile=function(e,n,r,i){return u||t.exports.configure(),new t.exports.Template(e,n,r,i)},t.exports.render=function(e,n,r){return u||t.exports.configure(),u.render(e,n,r)},t.exports.renderString=function(e,n,r){return u||t.exports.configure(),u.renderString(e,n,r)},a&&(t.exports.precompile=a.precompile,t.exports.precompileString=a.precompileString)},function(t,e){"use strict";var n=Array.prototype,r=Object.prototype,i={"&":"&amp;",'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;"},o=/[&"'<>]/g,s=function(t){return i[t]},e=t.exports={};e.prettifyError=function(t,n,r){if(r.Update||(r=new e.TemplateError(r)),r.Update(t),!n){var i=r;r=new Error(i.message),r.name=i.name}return r},e.TemplateError=function(t,e,n){var r=this;if(t instanceof Error){r=t,t=t.name+": "+t.message;try{r.name=""}catch(t){r=this}}else Error.captureStackTrace&&Error.captureStackTrace(r);return r.name="Template render error",r.message=t,r.lineno=e,r.colno=n,r.firstUpdate=!0,r.Update=function(t){var e="("+(t||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?e+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(e+=" [Line "+this.lineno+"]")),e+="\n ",this.firstUpdate&&(e+=" "),this.message=e+(this.message||""),this.firstUpdate=!1,this},r},e.TemplateError.prototype=Error.prototype,e.escape=function(t){return t.replace(o,s)},e.isFunction=function(t){return"[object Function]"===r.toString.call(t)},e.isArray=Array.isArray||function(t){return"[object Array]"===r.toString.call(t)},e.isString=function(t){return"[object String]"===r.toString.call(t)},e.isObject=function(t){return"[object Object]"===r.toString.call(t)},e.groupBy=function(t,n){for(var r={},i=e.isFunction(n)?n:function(t){return t[n]},o=0;o<t.length;o++){var s=t[o],a=i(s,o);(r[a]||(r[a]=[])).push(s)}return r},e.toArray=function(t){return Array.prototype.slice.call(t)},e.without=function(t){var n=[];if(!t)return n;for(var r=-1,i=t.length,o=e.toArray(arguments).slice(1);++r<i;)e.indexOf(o,t[r])===-1&&n.push(t[r]);return n},e.extend=function(t,e){for(var n in e)t[n]=e[n];return t},e.repeat=function(t,e){for(var n="",r=0;r<e;r++)n+=t;return n},e.each=function(t,e,r){if(null!=t)if(n.each&&t.each===n.each)t.forEach(e,r);else if(t.length===+t.length)for(var i=0,o=t.length;i<o;i++)e.call(r,t[i],i,t)},e.map=function(t,e){var r=[];if(null==t)return r;if(n.map&&t.map===n.map)return t.map(e);for(var i=0;i<t.length;i++)r[r.length]=e(t[i],i);return t.length===+t.length&&(r.length=t.length),r},e.asyncIter=function(t,e,n){function r(){i++,i<t.length?e(t[i],i,r,n):n()}var i=-1;r()},e.asyncFor=function(t,n,r){function i(){a++;var e=o[a];a<s?n(e,t[e],a,s,i):r()}var o=e.keys(t),s=o.length,a=-1;i()},e.indexOf=Array.prototype.indexOf?function(t,e,n){return Array.prototype.indexOf.call(t,e,n)}:function(t,e,n){var r=this.length>>>0;for(n=+n||0,Math.abs(n)===1/0&&(n=0),n<0&&(n+=r,n<0&&(n=0));n<r;n++)if(t[n]===e)return n;return-1},Array.prototype.map||(Array.prototype.map=function(){throw new Error("map is unimplemented for this js engine")}),e.keys=function(t){if(Object.prototype.keys)return t.keys();var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},e.inOperator=function(t,n){if(e.isArray(n))return e.indexOf(n,t)!==-1;if(e.isObject(n))return t in n;if(e.isString(n))return n.indexOf(t)!==-1;throw new Error('Cannot use "in" operator to search for "'+t+'" in unexpected types.')}},function(t,e,n){"use strict";function r(t,e,n){s(function(){t(e,n)})}var i,o=n(3),s=n(4),a=n(1),u=n(6),c=n(3),l=n(7),f=n(3),p=n(8),h=n(9),v=n(10),d=p.Frame;f.PrecompiledLoader=n(14);var y=u.extend({init:function(t,e){e=this.opts=e||{},this.opts.dev=!!e.dev,this.opts.autoescape=null==e.autoescape||e.autoescape,this.opts.throwOnUndefined=!!e.throwOnUndefined,this.opts.trimBlocks=!!e.trimBlocks,this.opts.lstripBlocks=!!e.lstripBlocks,this.loaders=[],t?this.loaders=a.isArray(t)?t:[t]:f.FileSystemLoader?this.loaders=[new f.FileSystemLoader("views")]:f.WebLoader&&(this.loaders=[new f.WebLoader("/views")]),window.nunjucksPrecompiled&&this.loaders.unshift(new f.PrecompiledLoader(window.nunjucksPrecompiled)),this.initCache(),this.globals=h(),this.filters={},this.asyncFilters=[],this.extensions={},this.extensionsList=[];for(var n in l)this.addFilter(n,l[n])},initCache:function(){a.each(this.loaders,function(t){t.cache={},"function"==typeof t.on&&t.on("update",function(e){t.cache[e]=null})})},addExtension:function(t,e){return e._name=t,this.extensions[t]=e,this.extensionsList.push(e),this},removeExtension:function(t){var e=this.getExtension(t);e&&(this.extensionsList=a.without(this.extensionsList,e),delete this.extensions[t])},getExtension:function(t){return this.extensions[t]},hasExtension:function(t){return!!this.extensions[t]},addGlobal:function(t,e){return this.globals[t]=e,this},getGlobal:function(t){if("undefined"==typeof this.globals[t])throw new Error("global not found: "+t);return this.globals[t]},addFilter:function(t,e,n){var r=e;return n&&this.asyncFilters.push(t),this.filters[t]=r,this},getFilter:function(t){if(!this.filters[t])throw new Error("filter not found: "+t);return this.filters[t]},resolveTemplate:function(t,e,n){var r=!(!t.isRelative||!e)&&t.isRelative(n);return r&&t.resolve?t.resolve(e,n):n},getTemplate:function(t,e,n,r,o){var s=this,u=null;if(t&&t.raw&&(t=t.raw),a.isFunction(n)&&(o=n,n=null,e=e||!1),a.isFunction(e)&&(o=e,e=!1),t instanceof i)u=t;else{if("string"!=typeof t)throw new Error("template names must be a string: "+t);for(var c=0;c<this.loaders.length;c++){var l=this.resolveTemplate(this.loaders[c],n,t);if(u=this.loaders[c].cache[l])break}}if(!u){var f,p=this,h=function(n,s){if(s||n||r||(n=new Error("template not found: "+t)),n){if(!o)throw n;o(n)}else{var a;s?(a=new i(s.src,p,s.path,e),s.noCache||(s.loader.cache[t]=a)):a=new i("",p,"",e),o?o(null,a):f=a}};return a.asyncIter(this.loaders,function(e,r,i,o){function a(t,n){t?o(t):n?(n.loader=e,o(null,n)):i()}t=s.resolveTemplate(e,n,t),e.async?e.getSource(t,a):a(null,e.getSource(t))},h),f}return e&&u.compile(),o?void o(null,u):u},express:function(t){function e(t,e){if(this.name=t,this.path=t,this.defaultEngine=e.defaultEngine,this.ext=o.extname(t),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}var n=this;return e.prototype.render=function(t,e){n.render(this.name,t,e)},t.set("view",e),t.set("nunjucksEnv",this),this},render:function(t,e,n){a.isFunction(e)&&(n=e,e=null);var i=null;return this.getTemplate(t,function(t,o){if(t&&n)r(n,t);else{if(t)throw t;i=o.render(e,n)}}),i},renderString:function(t,e,n,r){a.isFunction(n)&&(r=n,n={}),n=n||{};var o=new i(t,this,n.path);return o.render(e,r)},waterfall:v}),m=u.extend({init:function(t,e,n){this.env=n||new y,this.ctx={};for(var r in t)t.hasOwnProperty(r)&&(this.ctx[r]=t[r]);this.blocks={},this.exported=[];for(var i in e)this.addBlock(i,e[i])},lookup:function(t){return t in this.env.globals&&!(t in this.ctx)?this.env.globals[t]:this.ctx[t]},setVariable:function(t,e){this.ctx[t]=e},getVariables:function(){return this.ctx},addBlock:function(t,e){return this.blocks[t]=this.blocks[t]||[],this.blocks[t].push(e),this},getBlock:function(t){if(!this.blocks[t])throw new Error('unknown block "'+t+'"');return this.blocks[t][0]},getSuper:function(t,e,n,r,i,o){var s=a.indexOf(this.blocks[e]||[],n),u=this.blocks[e][s+1],c=this;if(s===-1||!u)throw new Error('no super block available for "'+e+'"');u(t,c,r,i,o)},addExport:function(t){this.exported.push(t)},getExported:function(){for(var t={},e=0;e<this.exported.length;e++){var n=this.exported[e];t[n]=this.ctx[n]}return t}});i=u.extend({init:function(t,e,n,r){if(this.env=e||new y,a.isObject(t))switch(t.type){case"code":this.tmplProps=t.obj;break;case"string":this.tmplStr=t.obj}else{if(!a.isString(t))throw new Error("src must be a string or an object describing the source");this.tmplStr=t}if(this.path=n,r){var i=this;try{i._compile()}catch(t){throw a.prettifyError(this.path,this.env.opts.dev,t)}}else this.compiled=!1},render:function(t,e,n){"function"==typeof t?(n=t,t={}):"function"==typeof e&&(n=e,e=null);var i=!0;e&&(i=!1);var o=this;try{o.compile()}catch(t){var s=a.prettifyError(this.path,this.env.opts.dev,t);if(n)return r(n,s);throw s}var u=new m(t||{},o.blocks,o.env),c=e?e.push(!0):new d;c.topLevel=!0;var l=null;return o.rootRenderFunc(o.env,u,c||new d,p,function(t,e){if(t&&(t=a.prettifyError(o.path,o.env.opts.dev,t)),n)i?r(n,t,e):n(t,e);else{if(t)throw t;l=e}}),l},getExported:function(t,e,n){"function"==typeof t&&(n=t,t={}),"function"==typeof e&&(n=e,e=null);try{this.compile()}catch(t){if(n)return n(t);throw t}var r=e?e.push():new d;r.topLevel=!0;var i=new m(t||{},this.blocks,this.env);this.rootRenderFunc(this.env,i,r,p,function(t){t?n(t,null):n(null,i.getExported())})},compile:function(){this.compiled||this._compile()},_compile:function(){var t;if(this.tmplProps)t=this.tmplProps;else{var e=c.compile(this.tmplStr,this.env.asyncFilters,this.env.extensionsList,this.path,this.env.opts),n=new Function(e);t=n()}this.blocks=this._getBlocks(t),this.rootRenderFunc=t.root,this.compiled=!0},_getBlocks:function(t){var e={};for(var n in t)"b_"===n.slice(0,2)&&(e[n.slice(2)]=t[n]);return e}}),t.exports={Environment:y,Template:i}},function(t,e){},function(t,e,n){"use strict";function r(){if(u.length)throw u.shift()}function i(t){var e;e=a.length?a.pop():new o,e.task=t,s(e)}function o(){this.task=null}var s=n(5),a=[],u=[],c=s.makeRequestCallFromTimer(r);t.exports=i,o.prototype.call=function(){try{this.task.call()}catch(t){i.onerror?i.onerror(t):(u.push(t),c())}finally{this.task=null,a[a.length]=this}}},function(t,e){(function(e){"use strict";function n(t){a.length||(s(),u=!0),a[a.length]=t}function r(){for(;c<a.length;){var t=c;if(c+=1,a[t].call(),c>l){for(var e=0,n=a.length-c;e<n;e++)a[e]=a[e+c];a.length-=c,c=0}}a.length=0,c=0,u=!1}function i(t){var e=1,n=new p(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}function o(t){return function(){function e(){clearTimeout(n),clearInterval(r),t()}var n=setTimeout(e,0),r=setInterval(e,50)}}t.exports=n;var s,a=[],u=!1,c=0,l=1024,f="undefined"!=typeof e?e:self,p=f.MutationObserver||f.WebKitMutationObserver;s="function"==typeof p?i(r):o(r),n.requestFlush=s,n.makeRequestCallFromTimer=o}).call(e,function(){return this}())},function(t,e){"use strict";function n(t,e,r){var i=function(){};i.prototype=t.prototype;var o=new i,s=/xyz/.test(function(){xyz})?/\bparent\b/:/.*/;r=r||{};for(var a in r){var u=r[a],c=o[a];"function"==typeof c&&"function"==typeof u&&s.test(u)?o[a]=function(t,e){return function(){var n=this.parent;this.parent=e;var r=t.apply(this,arguments);return this.parent=n,r}}(u,c):o[a]=u}o.typename=e;var l=function(){o.init&&o.init.apply(this,arguments)};return l.prototype=o,l.prototype.constructor=l,l.extend=function(t,e){return"object"==typeof t&&(e=t,t="anonymous"),n(l,t,e)},l}t.exports=n(Object,"Object",{})},function(t,e,n){"use strict";function r(t,e){return null===t||void 0===t||t===!1?e:t}var i=n(1),o=n(8),s={abs:Math.abs,batch:function(t,e,n){var r,i=[],o=[];for(r=0;r<t.length;r++)r%e===0&&o.length&&(i.push(o),o=[]),o.push(t[r]);if(o.length){if(n)for(r=o.length;r<e;r++)o.push(n);i.push(o)}return i},capitalize:function(t){t=r(t,"");var e=t.toLowerCase();return o.copySafeness(t,e.charAt(0).toUpperCase()+e.slice(1))},center:function(t,e){if(t=r(t,""),e=e||80,t.length>=e)return t;var n=e-t.length,s=i.repeat(" ",n/2-n%2),a=i.repeat(" ",n/2);return o.copySafeness(t,s+t+a)},default:function(t,e,n){return n?t?t:e:void 0!==t?t:e},dictsort:function(t,e,n){if(!i.isObject(t))throw new i.TemplateError("dictsort filter: val must be an object");var r=[];for(var o in t)r.push([o,t[o]]);var s;if(void 0===n||"key"===n)s=0;else{if("value"!==n)throw new i.TemplateError("dictsort filter: You can only sort by either key or value");s=1}return r.sort(function(t,n){var r=t[s],o=n[s];return e||(i.isString(r)&&(r=r.toUpperCase()),i.isString(o)&&(o=o.toUpperCase())),r>o?1:r===o?0:-1}),r},dump:function(t,e){return JSON.stringify(t,null,e)},escape:function(t){return t instanceof o.SafeString?t:(t=null===t||void 0===t?"":t,o.markSafe(i.escape(t.toString())))},safe:function(t){return t instanceof o.SafeString?t:(t=null===t||void 0===t?"":t,o.markSafe(t.toString()))},first:function(t){return t[0]},groupby:function(t,e){return i.groupBy(t,e)},indent:function(t,e,n){if(t=r(t,""),""===t)return"";e=e||4;for(var s="",a=t.split("\n"),u=i.repeat(" ",e),c=0;c<a.length;c++)s+=0!==c||n?u+a[c]+"\n":a[c]+"\n";return o.copySafeness(t,s)},join:function(t,e,n){return e=e||"",n&&(t=i.map(t,function(t){return t[n]})),t.join(e)},last:function(t){return t[t.length-1]},length:function(t){var e=r(t,"");return void 0!==e?"function"==typeof Map&&e instanceof Map||"function"==typeof Set&&e instanceof Set?e.size:!i.isObject(e)||e instanceof o.SafeString?e.length:Object.keys(e).length:0},list:function(t){if(i.isString(t))return t.split("");if(i.isObject(t)){var e=[];if(Object.keys)e=Object.keys(t);else for(var n in t)e.push(n);return i.map(e,function(e){return{key:e,value:t[e]}})}if(i.isArray(t))return t;throw new i.TemplateError("list filter: type not iterable")},lower:function(t){return t=r(t,""),t.toLowerCase()},nl2br:function(t){return null===t||void 0===t?"":o.copySafeness(t,t.replace(/\r\n|\n/g,"<br />\n"))},random:function(t){return t[Math.floor(Math.random()*t.length)]},rejectattr:function(t,e){return t.filter(function(t){return!t[e]})},selectattr:function(t,e){return t.filter(function(t){return!!t[e]})},replace:function(t,e,n,r){var i=t;if(e instanceof RegExp)return t.replace(e,n);"undefined"==typeof r&&(r=-1);var s="";if("number"==typeof e)e+="";else if("string"!=typeof e)return t;if("number"==typeof t&&(t+=""),"string"!=typeof t&&!(t instanceof o.SafeString))return t;if(""===e)return s=n+t.split("").join(n)+n,o.copySafeness(t,s);var a=t.indexOf(e);if(0===r||a===-1)return t;for(var u=0,c=0;a>-1&&(r===-1||c<r);)s+=t.substring(u,a)+n,u=a+e.length,c++,a=t.indexOf(e,u);return u<t.length&&(s+=t.substring(u)),o.copySafeness(i,s)},reverse:function(t){var e;return e=i.isString(t)?s.list(t):i.map(t,function(t){return t}),e.reverse(),i.isString(t)?o.copySafeness(t,e.join("")):e},round:function(t,e,n){e=e||0;var r,i=Math.pow(10,e);return r="ceil"===n?Math.ceil:"floor"===n?Math.floor:Math.round,r(t*i)/i},slice:function(t,e,n){for(var r=Math.floor(t.length/e),i=t.length%e,o=0,s=[],a=0;a<e;a++){var u=o+a*r;a<i&&o++;var c=o+(a+1)*r,l=t.slice(u,c);n&&a>=i&&l.push(n),s.push(l)}return s},sum:function(t,e,n){var r=0;"number"==typeof n&&(r+=n),e&&(t=i.map(t,function(t){return t[e]}));for(var o=0;o<t.length;o++)r+=t[o];return r},sort:o.makeMacro(["value","reverse","case_sensitive","attribute"],[],function(t,e,n,r){return t=i.map(t,function(t){return t}),t.sort(function(t,o){var s,a;return r?(s=t[r],a=o[r]):(s=t,a=o),!n&&i.isString(s)&&i.isString(a)&&(s=s.toLowerCase(),a=a.toLowerCase()),s<a?e?1:-1:s>a?e?-1:1:0}),t}),string:function(t){return o.copySafeness(t,t)},striptags:function(t,e){t=r(t,""),e=e||!1;var n=/<\/?([a-z][a-z0-9]*)\b[^>]*>|<!--[\s\S]*?-->/gi,i=s.trim(t.replace(n,"")),a="";return a=e?i.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):i.replace(/\s+/gi," "),o.copySafeness(t,a)},title:function(t){t=r(t,"");for(var e=t.split(" "),n=0;n<e.length;n++)e[n]=s.capitalize(e[n]);return o.copySafeness(t,e.join(" "))},trim:function(t){return o.copySafeness(t,t.replace(/^\s*|\s*$/g,""))},truncate:function(t,e,n,i){var s=t;if(t=r(t,""),e=e||255,t.length<=e)return t;if(n)t=t.substring(0,e);else{var a=t.lastIndexOf(" ",e);a===-1&&(a=e),t=t.substring(0,a)}return t+=void 0!==i&&null!==i?i:"...",o.copySafeness(s,t)},upper:function(t){return t=r(t,""),t.toUpperCase()},urlencode:function(t){var e=encodeURIComponent;if(i.isString(t))return e(t);var n;if(i.isArray(t))n=t.map(function(t){return e(t[0])+"="+e(t[1])});else{n=[];for(var r in t)t.hasOwnProperty(r)&&n.push(e(r)+"="+e(t[r]))}return n.join("&")},urlize:function(t,e,n){isNaN(e)&&(e=1/0);var r=n===!0?' rel="nofollow"':"",i=/^(?:\(|<|&lt;)?(.*?)(?:\.|,|\)|\n|&gt;)?$/,o=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,s=/^https?:\/\/.*$/,a=/^www\./,u=/\.(?:org|net|com)(?:\:|\/|$)/,c=t.split(/(\s+)/).filter(function(t){return t&&t.length}).map(function(t){var n=t.match(i),c=n&&n[1]||t;return s.test(c)?'<a href="'+c+'"'+r+">"+c.substr(0,e)+"</a>":a.test(c)?'<a href="http://'+c+'"'+r+">"+c.substr(0,e)+"</a>":o.test(c)?'<a href="mailto:'+c+'">'+c+"</a>":u.test(c)?'<a href="http://'+c+'"'+r+">"+c.substr(0,e)+"</a>":t});return c.join("")},wordcount:function(t){t=r(t,"");var e=t?t.match(/\w+/g):null;return e?e.length:null},float:function(t,e){var n=parseFloat(t);return isNaN(n)?e:n},int:function(t,e){var n=parseInt(t,10);return isNaN(n)?e:n}};s.d=s.default,s.e=s.escape,t.exports=s},function(t,e,n){"use strict";function r(t,e,n){return function(){var r,i,a=s(arguments),u=o(arguments);if(a>t.length){r=Array.prototype.slice.call(arguments,0,t.length);var c=Array.prototype.slice.call(arguments,r.length,a);for(i=0;i<c.length;i++)i<e.length&&(u[e[i]]=c[i]);r.push(u)}else if(a<t.length){for(r=Array.prototype.slice.call(arguments,0,a),i=a;i<t.length;i++){var l=t[i];r.push(u[l]),delete u[l]}r.push(u)}else r=arguments;return n.apply(this,r)}}function i(t){return t.__keywords=!0,t}function o(t){var e=t.length;if(e){var n=t[e-1];if(n&&n.hasOwnProperty("__keywords"))return n}return{}}function s(t){var e=t.length;if(0===e)return 0;var n=t[e-1];return n&&n.hasOwnProperty("__keywords")?e-1:e}function a(t){return"string"!=typeof t?t:(this.val=t,void(this.length=t.length))}function u(t,e){return t instanceof a?new a(e):e.toString()}function c(t){var e=typeof t;return"string"===e?new a(t):"function"!==e?t:function(){var e=t.apply(this,arguments);return"string"==typeof e?new a(e):e}}function l(t,e){return t=void 0!==t&&null!==t?t:"",!e||t instanceof a||(t=g.escape(t.toString())),t}function f(t,e,n){if(null===t||void 0===t)throw new g.TemplateError("attempted to output null or undefined value",e+1,n+1);return t}function p(t,e){return t=t||{},"function"==typeof t[e]?function(){return t[e].apply(t,arguments)}:t[e]}function h(t,e,n,r){if(!t)throw new Error("Unable to call `"+e+"`, which is undefined or falsey");if("function"!=typeof t)throw new Error("Unable to call `"+e+"`, which is not a function");return t.apply(n,r)}function v(t,e,n){var r=e.lookup(n);return void 0!==r?r:t.lookup(n)}function d(t,e,n){return t.lineno?t:new g.TemplateError(t,e,n)}function y(t,e,n,r){if(g.isArray(t)){var i=t.length;g.asyncIter(t,function(t,r,o){switch(e){case 1:n(t,r,i,o);break;case 2:n(t[0],t[1],r,i,o);break;case 3:n(t[0],t[1],t[2],r,i,o);break;default:t.push(r,o),n.apply(this,t)}},r)}else g.asyncFor(t,function(t,e,r,i,o){n(t,e,r,i,o)},r)}function m(t,e,n,r){function i(t,e){u++,a[t]=e,u===o&&r(null,a.join(""))}var o,s,a,u=0;if(g.isArray(t))if(o=t.length,a=new Array(o),0===o)r(null,"");else for(s=0;s<t.length;s++){var c=t[s];switch(e){case 1:n(c,s,o,i);break;case 2:n(c[0],c[1],s,o,i);break;case 3:n(c[0],c[1],c[2],s,o,i);break;default:c.push(s,i),n.apply(this,c)}}else{var l=g.keys(t);if(o=l.length,a=new Array(o),0===o)r(null,"");else for(s=0;s<l.length;s++){var f=l[s];n(f,t[f],s,o,i)}}}var g=n(1),w=n(6),x=w.extend({init:function(t,e){this.variables={},this.parent=t,this.topLevel=!1,this.isolateWrites=e},set:function(t,e,n){var r=t.split("."),i=this.variables,o=this;if(n&&(o=this.resolve(r[0],!0)))return void o.set(t,e);for(var s=0;s<r.length-1;s++){var a=r[s];i[a]||(i[a]={}),i=i[a]}i[r[r.length-1]]=e},get:function(t){var e=this.variables[t];return void 0!==e?e:null},lookup:function(t){var e=this.parent,n=this.variables[t];return void 0!==n?n:e&&e.lookup(t)},resolve:function(t,e){var n=e&&this.isolateWrites?void 0:this.parent,r=this.variables[t];return void 0!==r?this:n&&n.resolve(t)},push:function(t){return new x(this,t)},pop:function(){return this.parent}});a.prototype=Object.create(String.prototype,{length:{writable:!0,configurable:!0,value:0}}),a.prototype.valueOf=function(){return this.val},a.prototype.toString=function(){return this.val},t.exports={Frame:x,makeMacro:r,makeKeywordArgs:i,numArgs:s,suppressValue:l,ensureDefined:f,memberLookup:p,contextOrFrameLookup:v,callWrap:h,handleError:d,isArray:g.isArray,keys:g.keys,SafeString:a,copySafeness:u,markSafe:c,asyncEach:y,asyncAll:m,inOperator:g.inOperator}},function(t,e){"use strict";function n(t){var e=-1;return{current:null,reset:function(){e=-1,this.current=null},next:function(){return e++,e>=t.length&&(e=0),this.current=t[e],this.current}}}function r(t){t=t||",";var e=!0;return function(){var n=e?"":t;return e=!1,n}}function i(){return{range:function(t,e,n){"undefined"==typeof e?(e=t,t=0,n=1):n||(n=1);var r,i=[];if(n>0)for(r=t;r<e;r+=n)i.push(r);else for(r=t;r>e;r+=n)i.push(r);return i},cycler:function(){return n(Array.prototype.slice.call(arguments))},joiner:function(t){return r(t)}}}t.exports=i},function(t,e,n){var r,i;(function(n,o){!function(s){"use strict";var a=function(){var t=Array.prototype.slice.call(arguments);"function"==typeof t[0]&&t[0].apply(null,t.splice(1))},u=function(t){"function"==typeof n?n(t):"undefined"!=typeof o&&o.nextTick?o.nextTick(t):setTimeout(t,0)},c=function(t){var e=function(n){var r=function(){return t.length&&t[n].apply(null,arguments),r.next()};return r.next=function(){return n<t.length-1?e(n+1):null},r};return e(0)},l=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},f=function(t,e,n){var r=n?u:a;if(e=e||function(){},!l(t)){var i=new Error("First argument to waterfall must be an array of functions");return e(i)}if(!t.length)return e();var o=function(t){return function(n){if(n)e.apply(null,arguments),e=function(){};else{var i=Array.prototype.slice.call(arguments,1),s=t.next();s?i.push(o(s)):i.push(e),r(function(){t.apply(null,i)})}}};o(c(t))()};r=[],i=function(){return f}.apply(e,r),!(void 0!==i&&(t.exports=i))}(this)}).call(e,n(11).setImmediate,n(13))},function(t,e,n){function r(t,e){this._id=t,this._clearFn=e}var i=Function.prototype.apply;e.setTimeout=function(){return new r(i.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new r(i.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(12),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){"use strict";function r(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return d[v]=r,h(v),v++}function i(t){delete d[t]}function o(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}function s(t){if(y)setTimeout(s,0,t);else{var e=d[t];if(e){y=!0;try{o(e)}finally{i(t),y=!1}}}}function a(){h=function(t){e.nextTick(function(){s(t)})}}function u(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}function c(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&s(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),h=function(n){t.postMessage(e+n,"*")}}function l(){var t=new MessageChannel;t.port1.onmessage=function(t){var e=t.data;s(e)},h=function(e){t.port2.postMessage(e)}}function f(){var t=m.documentElement;h=function(e){var n=m.createElement("script");n.onreadystatechange=function(){s(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}function p(){h=function(t){setTimeout(s,0,t)}}if(!t.setImmediate){var h,v=1,d={},y=!1,m=t.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(t);g=g&&g.setTimeout?g:t,"[object process]"==={}.toString.call(t.process)?a():u()?c():t.MessageChannel?l():m&&"onreadystatechange"in m.createElement("script")?f():p(),g.setImmediate=r,g.clearImmediate=i}}("undefined"==typeof self?"undefined"==typeof t?this:t:self)}).call(e,function(){return this}(),n(13))},function(t,e){},function(t,e,n){"use strict";var r=n(15),i=r.extend({init:function(t){this.precompiled=t||{}},getSource:function(t){return this.precompiled[t]?{src:{type:"code",obj:this.precompiled[t]},path:t}:null}});t.exports=i},function(t,e,n){"use strict";var r=n(3),i=n(6),o=n(1),s=i.extend({on:function(t,e){this.listeners=this.listeners||{},this.listeners[t]=this.listeners[t]||[],this.listeners[t].push(e)},emit:function(t){var e=Array.prototype.slice.call(arguments,1);this.listeners&&this.listeners[t]&&o.each(this.listeners[t],function(t){t.apply(null,e)})},resolve:function(t,e){return r.resolve(r.dirname(t),e)},isRelative:function(t){return 0===t.indexOf("./")||0===t.indexOf("../")}});t.exports=s},function(t,e){function n(){"use strict";function t(){r.contextOrFrameLookup=c,o.prototype.assertType=l,s.prototype.parseAggregate=f,r.memberLookup=p}function e(t){return{index:t.index,lineno:t.lineno,colno:t.colno}}function n(t,e,n,i){t=t||[],null===e&&(e=i<0?t.length-1:0),null===n?n=i<0?-1:t.length:n<0&&(n+=t.length),e<0&&(e+=t.length);for(var o=[],s=e;!(s<0||s>t.length)&&!(i>0&&s>=n)&&!(i<0&&s<=n);s+=i)o.push(r.memberLookup(t,s));return o}var r=this.runtime,i=this.lib,o=this.compiler.Compiler,s=this.parser.Parser,a=this.nodes,u=this.lexer,c=r.contextOrFrameLookup,l=o.prototype.assertType,f=s.prototype.parseAggregate,p=r.memberLookup;r.contextOrFrameLookup=function(t,e,n){var r=c.apply(this,arguments);if(void 0===r)switch(n){case"True":return!0;case"False":return!1;case"None":return null}return r};var h=a.Node.extend("Slice",{fields:["start","stop","step"],init:function(t,e,n,r,i){n=n||new a.Literal(t,e,null),r=r||new a.Literal(t,e,null),i=i||new a.Literal(t,e,1),this.parent(t,e,n,r,i)}});o.prototype.assertType=function(t){if(!(t instanceof h))return l.apply(this,arguments)},o.prototype.compileSlice=function(t,e){this.emit("("),this._compileExpression(t.start,e),this.emit("),("),this._compileExpression(t.stop,e),this.emit("),("),this._compileExpression(t.step,e),this.emit(")")},s.prototype.parseAggregate=function(){var t=this,n=e(this.tokens);n.colno--,n.index--;try{return f.apply(this)}catch(f){var r=e(this.tokens),o=function(){return i.extend(t.tokens,r),f};i.extend(this.tokens,n),this.peeked=!1;var s=this.peekToken();if(s.type!==u.TOKEN_LEFT_BRACKET)throw o();this.nextToken();for(var c=new h(s.lineno,s.colno),l=!1,p=0;p<=c.fields.length&&!this.skip(u.TOKEN_RIGHT_BRACKET);p++){if(p===c.fields.length){if(!l)break;this.fail("parseSlice: too many slice components",s.lineno,s.colno)}if(this.skip(u.TOKEN_COLON))l=!0;else{var v=c.fields[p];c[v]=this.parseExpression(),l=this.skip(u.TOKEN_COLON)||l}}if(!l)throw o();return new a.Array(s.lineno,s.colno,[c])}};var v={pop:function(t){if(void 0===t)return this.pop();if(t>=this.length||t<0)throw new Error("KeyError");return this.splice(t,1)},append:function(t){return this.push(t)},remove:function(t){for(var e=0;e<this.length;e++)if(this[e]===t)return this.splice(e,1);throw new Error("ValueError")},count:function(t){for(var e=0,n=0;n<this.length;n++)this[n]===t&&e++;return e},index:function(t){var e;if((e=this.indexOf(t))===-1)throw new Error("ValueError");return e},find:function(t){return this.indexOf(t)},insert:function(t,e){return this.splice(t,0,e)}},d={items:function(){var t=[];for(var e in this)t.push([e,this[e]]);return t},values:function(){var t=[];for(var e in this)t.push(this[e]);return t},keys:function(){var t=[];for(var e in this)t.push(e);return t},get:function(t,e){var n=this[t];return void 0===n&&(n=e),n},has_key:function(t){return this.hasOwnProperty(t)},pop:function(t,e){var n=this[t];if(void 0===n&&void 0!==e)n=e;else{if(void 0===n)throw new Error("KeyError");delete this[t]}return n},popitem:function(){for(var t in this){var e=this[t];return delete this[t],[t,e]}throw new Error("KeyError")},setdefault:function(t,e){return t in this?this[t]:(void 0===e&&(e=null),this[t]=e)},update:function(t){for(var e in t)this[e]=t[e];return null}};return d.iteritems=d.items,d.itervalues=d.values,d.iterkeys=d.keys,r.memberLookup=function(t,e,r){return 4===arguments.length?n.apply(this,arguments):(t=t||{},i.isArray(t)&&v.hasOwnProperty(e)?function(){return v[e].apply(t,arguments)}:i.isObject(t)&&d.hasOwnProperty(e)?function(){return d[e].apply(t,arguments)}:p.apply(this,arguments))},t}t.exports=n}])});

@@ -5,3 +5,26 @@ Changelog

3.x (unreleased)
3.0.1 (May 24 2017)
-------------------
* Fix handling methods and attributes of static arrays, objects and primitives.
Solves the issue [#937](https://github.com/mozilla/nunjucks/issues/937)
* Add support for python-style array slices with Jinja compat enabled.
Fixes [#188](https://github.com/mozilla/nunjucks/issues/188); merge of
[#976](https://github.com/mozilla/nunjucks/pull/976).
* Fix call blocks having access to their parent scope. Fixes
[#906](https://github.com/mozilla/nunjucks/issues/906); merge of
[#994](https://github.com/mozilla/nunjucks/pull/994).
* Fix a bug that caused capturing block tags (e.g. set/endset,
filter/endfilter) to write to the global buffer rather than capturing
their contents. Fixes
[#914](https://github.com/mozilla/nunjucks/issues/914) and
[#972](https://github.com/mozilla/nunjucks/issues/972); merge of
[#990](https://github.com/mozilla/nunjucks/pull/990). Thanks [Noah
Lange](@noahlange).
3.0.0 (Nov 5 2016)
----------------

@@ -8,0 +31,0 @@

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

**Nunjucks is currently lacking an active maintainer. Issues and pull requests
will not be reviewed or merged, unfortunately. If you are interested in
picking up nunjucks maintenance, file an issue and mention @vecmezoni.**
# Contributing

@@ -21,3 +25,3 @@

* We don't aim for parity of language specific syntax like Python's splice notation `{{ foo[start:end:step] }}`.
* We don't aim for parity of all language specific syntax.
* We don't aim for parity of language specific filters like [Twig's PHP date format](http://twig.sensiolabs.org/doc/functions/date.html).

@@ -24,0 +28,0 @@

{
"name": "nunjucks",
"description": "A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired)",
"version": "3.0.0",
"version": "3.0.1",
"author": "James Long <longster@gmail.com>",

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

@@ -798,6 +798,7 @@ 'use strict';

_compileMacro: function(node) {
_compileMacro: function(node, frame) {
var args = [];
var kwargs = null;
var funcId = 'macro_' + this.tmpid();
var keepFrame = (frame !== undefined);

@@ -828,3 +829,7 @@ // Type check the definition of the args

// (essentially default values). See runtime.js.
var frame = new Frame();
if (keepFrame) {
frame = frame.push(true);
} else {
frame = new Frame();
}
this.emitLines(

@@ -836,3 +841,3 @@ 'var ' + funcId + ' = runtime.makeMacro(',

'var callerFrame = frame;',
'frame = new runtime.Frame();',
'frame = ' + ((keepFrame) ? 'frame.push(true);' : 'new runtime.Frame();'),
'kwargs = kwargs || {};',

@@ -871,3 +876,3 @@ 'if (kwargs.hasOwnProperty("caller")) {',

this.emitLine('frame = callerFrame;');
this.emitLine('frame = ' + ((keepFrame) ? 'frame.pop();' : 'callerFrame;'));
this.emitLine('return new runtime.SafeString(' + bufferId + ');');

@@ -881,3 +886,3 @@ this.emitLine('});');

compileMacro: function(node, frame) {
var funcId = this._compileMacro(node, frame);
var funcId = this._compileMacro(node);

@@ -1067,2 +1072,6 @@ // Expose the macro to the templates

compileCapture: function(node, frame) {
// we need to temporarily override the current buffer id as 'output'
// so the set block writes to the capture output instead of the buffer
var buffer = this.buffer;
this.buffer = 'output';
this.emitLine('(function() {');

@@ -1075,2 +1084,4 @@ this.emitLine('var output = "";');

this.emitLine('})()');
// and of course, revert back to the old buffer id
this.buffer = buffer;
},

@@ -1077,0 +1088,0 @@

@@ -14,5 +14,3 @@ 'use strict';

var filters = {
abs: function(n) {
return Math.abs(n);
},
abs: Math.abs,

@@ -19,0 +17,0 @@ batch: function(arr, linecount, fill_with) {

function installCompat() {
'use strict';
'use strict';
// This must be called like `nunjucks.installCompat` so that `this`
// references the nunjucks instance
var runtime = this.runtime; // jshint ignore:line
var lib = this.lib; // jshint ignore:line
// This must be called like `nunjucks.installCompat` so that `this`
// references the nunjucks instance
var runtime = this.runtime; // jshint ignore:line
var lib = this.lib; // jshint ignore:line
var Compiler = this.compiler.Compiler; // jshint ignore:line
var Parser = this.parser.Parser; // jshint ignore:line
var nodes = this.nodes; // jshint ignore:line
var lexer = this.lexer; // jshint ignore:line
var orig_contextOrFrameLookup = runtime.contextOrFrameLookup;
runtime.contextOrFrameLookup = function(context, frame, key) {
var val = orig_contextOrFrameLookup.apply(this, arguments);
if (val === undefined) {
switch (key) {
case 'True':
return true;
case 'False':
return false;
case 'None':
return null;
}
var orig_contextOrFrameLookup = runtime.contextOrFrameLookup;
var orig_Compiler_assertType = Compiler.prototype.assertType;
var orig_Parser_parseAggregate = Parser.prototype.parseAggregate;
var orig_memberLookup = runtime.memberLookup;
function uninstall() {
runtime.contextOrFrameLookup = orig_contextOrFrameLookup;
Compiler.prototype.assertType = orig_Compiler_assertType;
Parser.prototype.parseAggregate = orig_Parser_parseAggregate;
runtime.memberLookup = orig_memberLookup;
}
return val;
};
runtime.contextOrFrameLookup = function(context, frame, key) {
var val = orig_contextOrFrameLookup.apply(this, arguments);
if (val === undefined) {
switch (key) {
case 'True':
return true;
case 'False':
return false;
case 'None':
return null;
}
}
var orig_memberLookup = runtime.memberLookup;
var ARRAY_MEMBERS = {
pop: function(index) {
if (index === undefined) {
return this.pop();
}
if (index >= this.length || index < 0) {
throw new Error('KeyError');
}
return this.splice(index, 1);
},
append: function(element) {
return this.push(element);
},
remove: function(element) {
for (var i = 0; i < this.length; i++) {
if (this[i] === element) {
return this.splice(i, 1);
return val;
};
var Slice = nodes.Node.extend('Slice', {
fields: ['start', 'stop', 'step'],
init: function(lineno, colno, start, stop, step) {
start = start || new nodes.Literal(lineno, colno, null);
stop = stop || new nodes.Literal(lineno, colno, null);
step = step || new nodes.Literal(lineno, colno, 1);
this.parent(lineno, colno, start, stop, step);
}
}
throw new Error('ValueError');
},
count: function(element) {
var count = 0;
for (var i = 0; i < this.length; i++) {
if (this[i] === element) {
count++;
});
Compiler.prototype.assertType = function(node) {
if (node instanceof Slice) {
return;
}
}
return count;
},
index: function(element) {
var i;
if ((i = this.indexOf(element)) === -1) {
throw new Error('ValueError');
}
return i;
},
find: function(element) {
return this.indexOf(element);
},
insert: function(index, elem) {
return this.splice(index, 0, elem);
}
};
var OBJECT_MEMBERS = {
items: function() {
var ret = [];
for(var k in this) {
ret.push([k, this[k]]);
}
return ret;
},
values: function() {
var ret = [];
for(var k in this) {
ret.push(this[k]);
}
return ret;
},
keys: function() {
var ret = [];
for(var k in this) {
ret.push(k);
}
return ret;
},
get: function(key, def) {
var output = this[key];
if (output === undefined) {
output = def;
}
return output;
},
has_key: function(key) {
return this.hasOwnProperty(key);
},
pop: function(key, def) {
var output = this[key];
if (output === undefined && def !== undefined) {
output = def;
} else if (output === undefined) {
throw new Error('KeyError');
} else {
delete this[key];
}
return output;
},
popitem: function() {
for (var k in this) {
// Return the first object pair.
var val = this[k];
delete this[k];
return [k, val];
}
throw new Error('KeyError');
},
setdefault: function(key, def) {
if (key in this) {
return this[key];
}
if (def === undefined) {
def = null;
}
return this[key] = def;
},
update: function(kwargs) {
for (var k in kwargs) {
this[k] = kwargs[k];
}
return null; // Always returns None
}
};
OBJECT_MEMBERS.iteritems = OBJECT_MEMBERS.items;
OBJECT_MEMBERS.itervalues = OBJECT_MEMBERS.values;
OBJECT_MEMBERS.iterkeys = OBJECT_MEMBERS.keys;
runtime.memberLookup = function(obj, val, autoescape) { // jshint ignore:line
obj = obj || {};
return orig_Compiler_assertType.apply(this, arguments);
};
Compiler.prototype.compileSlice = function(node, frame) {
this.emit('(');
this._compileExpression(node.start, frame);
this.emit('),(');
this._compileExpression(node.stop, frame);
this.emit('),(');
this._compileExpression(node.step, frame);
this.emit(')');
};
// If the object is an object, return any of the methods that Python would
// otherwise provide.
if (lib.isArray(obj) && ARRAY_MEMBERS.hasOwnProperty(val)) {
return function() {return ARRAY_MEMBERS[val].apply(obj, arguments);};
function getTokensState(tokens) {
return {
index: tokens.index,
lineno: tokens.lineno,
colno: tokens.colno
};
}
if (lib.isObject(obj) && OBJECT_MEMBERS.hasOwnProperty(val)) {
return function() {return OBJECT_MEMBERS[val].apply(obj, arguments);};
Parser.prototype.parseAggregate = function() {
var self = this;
var origState = getTokensState(this.tokens);
// Set back one accounting for opening bracket/parens
origState.colno--;
origState.index--;
try {
return orig_Parser_parseAggregate.apply(this);
} catch(e) {
var errState = getTokensState(this.tokens);
var rethrow = function() {
lib.extend(self.tokens, errState);
return e;
};
// Reset to state before original parseAggregate called
lib.extend(this.tokens, origState);
this.peeked = false;
var tok = this.peekToken();
if (tok.type !== lexer.TOKEN_LEFT_BRACKET) {
throw rethrow();
} else {
this.nextToken();
}
var node = new Slice(tok.lineno, tok.colno);
// If we don't encounter a colon while parsing, this is not a slice,
// so re-raise the original exception.
var isSlice = false;
for (var i = 0; i <= node.fields.length; i++) {
if (this.skip(lexer.TOKEN_RIGHT_BRACKET)) {
break;
}
if (i === node.fields.length) {
if (isSlice) {
this.fail('parseSlice: too many slice components', tok.lineno, tok.colno);
} else {
break;
}
}
if (this.skip(lexer.TOKEN_COLON)) {
isSlice = true;
} else {
var field = node.fields[i];
node[field] = this.parseExpression();
isSlice = this.skip(lexer.TOKEN_COLON) || isSlice;
}
}
if (!isSlice) {
throw rethrow();
}
return new nodes.Array(tok.lineno, tok.colno, [node]);
}
};
function sliceLookup(obj, start, stop, step) {
obj = obj || [];
if (start === null) {
start = (step < 0) ? (obj.length - 1) : 0;
}
if (stop === null) {
stop = (step < 0) ? -1 : obj.length;
} else {
if (stop < 0) {
stop += obj.length;
}
}
if (start < 0) {
start += obj.length;
}
var results = [];
for (var i = start; ; i += step) {
if (i < 0 || i > obj.length) {
break;
}
if (step > 0 && i >= stop) {
break;
}
if (step < 0 && i <= stop) {
break;
}
results.push(runtime.memberLookup(obj, i));
}
return results;
}
return orig_memberLookup.apply(this, arguments);
};
var ARRAY_MEMBERS = {
pop: function(index) {
if (index === undefined) {
return this.pop();
}
if (index >= this.length || index < 0) {
throw new Error('KeyError');
}
return this.splice(index, 1);
},
append: function(element) {
return this.push(element);
},
remove: function(element) {
for (var i = 0; i < this.length; i++) {
if (this[i] === element) {
return this.splice(i, 1);
}
}
throw new Error('ValueError');
},
count: function(element) {
var count = 0;
for (var i = 0; i < this.length; i++) {
if (this[i] === element) {
count++;
}
}
return count;
},
index: function(element) {
var i;
if ((i = this.indexOf(element)) === -1) {
throw new Error('ValueError');
}
return i;
},
find: function(element) {
return this.indexOf(element);
},
insert: function(index, elem) {
return this.splice(index, 0, elem);
}
};
var OBJECT_MEMBERS = {
items: function() {
var ret = [];
for(var k in this) {
ret.push([k, this[k]]);
}
return ret;
},
values: function() {
var ret = [];
for(var k in this) {
ret.push(this[k]);
}
return ret;
},
keys: function() {
var ret = [];
for(var k in this) {
ret.push(k);
}
return ret;
},
get: function(key, def) {
var output = this[key];
if (output === undefined) {
output = def;
}
return output;
},
has_key: function(key) {
return this.hasOwnProperty(key);
},
pop: function(key, def) {
var output = this[key];
if (output === undefined && def !== undefined) {
output = def;
} else if (output === undefined) {
throw new Error('KeyError');
} else {
delete this[key];
}
return output;
},
popitem: function() {
for (var k in this) {
// Return the first object pair.
var val = this[k];
delete this[k];
return [k, val];
}
throw new Error('KeyError');
},
setdefault: function(key, def) {
if (key in this) {
return this[key];
}
if (def === undefined) {
def = null;
}
return this[key] = def;
},
update: function(kwargs) {
for (var k in kwargs) {
this[k] = kwargs[k];
}
return null; // Always returns None
}
};
OBJECT_MEMBERS.iteritems = OBJECT_MEMBERS.items;
OBJECT_MEMBERS.itervalues = OBJECT_MEMBERS.values;
OBJECT_MEMBERS.iterkeys = OBJECT_MEMBERS.keys;
runtime.memberLookup = function(obj, val, autoescape) { // jshint ignore:line
if (arguments.length === 4) {
return sliceLookup.apply(this, arguments);
}
obj = obj || {};
// If the object is an object, return any of the methods that Python would
// otherwise provide.
if (lib.isArray(obj) && ARRAY_MEMBERS.hasOwnProperty(val)) {
return function() {return ARRAY_MEMBERS[val].apply(obj, arguments);};
}
if (lib.isObject(obj) && OBJECT_MEMBERS.hasOwnProperty(val)) {
return function() {return OBJECT_MEMBERS[val].apply(obj, arguments);};
}
return orig_memberLookup.apply(this, arguments);
};
return uninstall;
}
module.exports = installCompat;

@@ -9,5 +9,2 @@ 'use strict';

// Node <0.7.1 compatibility
var existsSync = fs.existsSync || path.existsSync;
var FileSystemLoader = Loader.extend({

@@ -40,3 +37,3 @@ init: function(searchPaths, opts) {

var chokidar = require('chokidar');
var paths = this.searchPaths.filter(function(p) { return existsSync(p); });
var paths = this.searchPaths.filter(fs.existsSync);
var watcher = chokidar.watch(paths);

@@ -66,3 +63,3 @@ var _this = this;

// underneath it to be searched
if(p.indexOf(basePath) === 0 && existsSync(p)) {
if(p.indexOf(basePath) === 0 && fs.existsSync(p)) {
fullpath = p;

@@ -69,0 +66,0 @@ break;

@@ -971,6 +971,2 @@ 'use strict';

node = new nodes.Symbol(tok.lineno, tok.colno, tok.value);
if(!noPostfix) {
node = this.parsePostfix(node);
}
}

@@ -984,2 +980,6 @@ else {

if(!noPostfix) {
node = this.parsePostfix(node);
}
if(node) {

@@ -1299,3 +1299,4 @@ return node;

return p.parseAsRoot();
}
},
Parser: Parser
};

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

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

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