main
Haoming 2025-11-04 12:03:46 +08:00
parent 33f75e9a39
commit abfd6f476c
1 changed files with 3 additions and 4 deletions

View File

@ -288,7 +288,7 @@ class LeFormatter {
/** @type {boolean} */ const commaStart = paste.match(/^\s*\,/); /** @type {boolean} */ const commaStart = paste.match(/^\s*\,/);
/** @type {boolean} */ const commaEnd = paste.match(/\,\s*$/); /** @type {boolean} */ const commaEnd = paste.match(/\,\s*$/);
/** @type {boolean} */ const multiline = !paste.includes(","); /** @type {boolean} */ const onlyTags = !paste.includes(",");
if (config.booru) { if (config.booru) {
paste = LeFormatter.toNetwork(paste); paste = LeFormatter.toNetwork(paste);
@ -303,12 +303,11 @@ class LeFormatter {
paste = LeFormatter.fromNetwork(paste); paste = LeFormatter.fromNetwork(paste);
} }
if (multiline) paste = LeFormatter.formatString(paste, config.dedupe, config.rmUnderscore); if (onlyTags) paste = LeFormatter.formatString(paste, config.dedupe, config.rmUnderscore);
else { else {
const lines = []; const lines = [];
for (const line of paste.split("\n")) lines.push(LeFormatter.formatString(line, config.dedupe, config.rmUnderscore)); for (const line of paste.split("\n")) lines.push(LeFormatter.formatString(line, config.dedupe, config.rmUnderscore));
paste = lines.filter((l) => l).join("\n"); paste = lines.join("\n");
if (!paste.includes(",")) paste = paste.replaceAll("\n", ", ");
} }
paste = `${commaStart ? ", " : ""}${paste}${commaEnd ? ", " : ""}`; paste = `${commaStart ? ", " : ""}${paste}${commaEnd ? ", " : ""}`;