From 57c08093d9e3524f03452a68f81ea0c27b129209 Mon Sep 17 00:00:00 2001
From: LarkinKin <913634310@qq.com>
Date: Thu, 19 Oct 2017 21:12:22 +0800
Subject: [PATCH 1/2] Update index.js
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@bugfix 修正v-for template问题
@bugfix 修正template中无法使用单引号的问题
---
index.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/index.js b/index.js
index 2b92b53..8443ca6 100644
--- a/index.js
+++ b/index.js
@@ -146,14 +146,14 @@ module.exports = function(options) {
treeAdapter.appendChild(docFragment, node);
var tpl = parse5.serialize(docFragment);
- tpl = tpl.replace('', '').replace('', '');
+ tpl = tpl.replace('', '');
}
tpl.split("\n").forEach(function(line){
if (line) contents.template.push(line.trim());
});
- contents.template = contents.template.join("").toString().replace(/'/g, "'");
+ contents.template = contents.template.join("").toString().replace(\(<\/template>)(?!.*\1)\, '').replace(/'/g, "\\'");
}
if (type === "script") {
@@ -231,4 +231,4 @@ module.exports = function(options) {
callback(null, file);
});
-}
\ No newline at end of file
+}
From c57957226a3a148a35600db1d8b18843fab0d0c4 Mon Sep 17 00:00:00 2001
From: LarkinKin <913634310@qq.com>
Date: Wed, 24 Feb 2021 18:30:59 +0800
Subject: [PATCH 2/2] Update index.js
---
index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.js b/index.js
index 8443ca6..fecf461 100644
--- a/index.js
+++ b/index.js
@@ -153,7 +153,7 @@ module.exports = function(options) {
if (line) contents.template.push(line.trim());
});
- contents.template = contents.template.join("").toString().replace(\(<\/template>)(?!.*\1)\, '').replace(/'/g, "\\'");
+ contents.template = contents.template.join("").toString().replace(/(<\/template>)(?!.*\1)/, '').replace(/'/g, "\\'");
}
if (type === "script") {