This commit is contained in:
harttle
2017-01-31 00:48:26 +08:00
parent 7f336ded5c
commit 0c8148c12b
3 changed files with 12 additions and 5 deletions
+8 -2
View File
@@ -1274,8 +1274,14 @@ function parse(html, filepath, options) {
function whiteSpaceCtrl(html, options) {
options = options || {};
var rLeft = options.trim_left ? /\s+({[{%])/g : /\s+({[{%]-)/g;
var rRight = options.trim_right ? /([}%]})\s+/g : /(-[}%]})\s+/g;
if (options.trim_left) {
html = html.replace(/{{-?/g, '{{-').replace(/{%-?/g, '{%-');
}
if (options.trim_right) {
html = html.replace(/-?}}/g, '-}}').replace(/-?%}/g, '-%}');
}
var rLeft = options.greedy ? /\s+({[{%]-)/g : /\n[\t\r ]*({[{%]-)/g;
var rRight = options.greedy ? /(-[}%]})\s+/g : /(-[}%]})[\t\r ]*\n/g;
return html.replace(rLeft, '$1').replace(rRight, '$1');
}
+3 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "shopify-liquid",
"version": "1.6.2",
"version": "1.7.0",
"description": "A feature-rich Liquid template engine for Node.js and browsers, with compliance with the Ruby version.",
"main": "index.js",
"scripts": {