From f919b44e5833dcdba8b2d0e8ff49623cfd82afcc Mon Sep 17 00:00:00 2001 From: xiangyu <3170102889@zju.edu.cn> Date: Tue, 2 Aug 2022 22:44:37 +0800 Subject: [PATCH] fix: line parse bugs --- src/parse.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parse.ts b/src/parse.ts index 94c783c..945c282 100644 --- a/src/parse.ts +++ b/src/parse.ts @@ -104,7 +104,7 @@ class AddonParse extends AddonBase { // For self inline tags, cache start as previous line and end as next line for (const tag of forceInline) { - const startReg = `<${tag}>`; + const startReg = `<${tag}`; const isStart = line.includes(startReg); const endReg = ``; const isEnd = line.includes(endReg); @@ -125,14 +125,14 @@ class AddonParse extends AddonBase { // For self inline tags, cache start as previous line and end as next line for (const tag of selfInline) { - const isStart = line.includes(`<${tag}>`); - if (isStart) { + const isStart = line.includes(`<${tag}`); + const isEnd = line.includes(``); + if (isStart && !isEnd) { selfInlineFlag = true; nextLineCache.push(line); break; } - const isEnd = line.includes(``); - if (isEnd) { + if (!isStart && isEnd) { selfInlineFlag = true; previousLineCache.push(line); break;