Skip to content

Commit

Permalink
修复\n不删除的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gui-ying233 committed Oct 23, 2023
1 parent 9811808 commit 5845333
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions 清理者.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ async function cleaner(gcmtitle, regex, replace = "", skipTitle = /^$/) {
continue;
}
let symbolCounter = 0;
for (const word of result1.query.pages[
const obj = result1.query.pages[
i
].revisions[0].content
.slice(
result1.query.pages[
i
].revisions[0].content.search(regex)
)
.split("")) {
.split("");
for (let j = 0; j < obj.length; j++) {
const word = obj[j];
replaceText += word;
switch (word) {
case "{":
Expand All @@ -71,7 +73,10 @@ async function cleaner(gcmtitle, regex, replace = "", skipTitle = /^$/) {
symbolCounter++;
break;
}
if (!symbolCounter) break;
if (!symbolCounter && obj[j + 1] === "\n") {
replaceText += "\n";
break;
} else if (!symbolCounter) break;
}
} else {
replaceText = regex;
Expand Down

0 comments on commit 5845333

Please sign in to comment.