This commit is contained in:
Jun Yang
2018-05-12 22:06:35 +08:00
parent ef85bd9192
commit 0e3ead559f
3 changed files with 7 additions and 8 deletions
+5 -6
View File
@@ -132,7 +132,7 @@ var filters = {
return stringify(v).trim();
},
'strip_html': function strip_html(v) {
return stringify(v).replace(/<\/?\s*\w+\s*\/?>/g, '');
return stringify(v).replace(/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g, '');
},
'strip_newlines': function strip_newlines(v) {
return stringify(v).replace(/\n/g, '');
@@ -2285,7 +2285,6 @@ module.exports = function (liquid) {
return liquid.renderer.renderTemplates(this.elseTemplates, scope);
}
var length = collection.length;
var offset = hash.offset || 0;
var limit = hash.limit === undefined ? collection.length : hash.limit;
@@ -2299,10 +2298,10 @@ module.exports = function (liquid) {
first: i === 0,
index: i + 1,
index0: i,
last: i === length - 1,
length: length,
rindex: length - i,
rindex0: length - i - 1
last: i === collection.length - 1,
length: collection.length,
rindex: collection.length - i,
rindex0: collection.length - i - 1
};
return ctx;
});
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "liquidjs",
"version": "3.1.2",
"version": "3.1.3",
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
"main": "index.js",
"scripts": {