From 88154bd95e5fbc8e3c8ec82e7a7a78b2be558f04 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Fri, 7 Jun 2024 19:37:04 +0900 Subject: [PATCH] refactor: Improve automark.ts code readability and remove unnecessary spaces --- src/ts/plugins/automark.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ts/plugins/automark.ts b/src/ts/plugins/automark.ts index 6f31e0f0..60782ac5 100644 --- a/src/ts/plugins/automark.ts +++ b/src/ts/plugins/automark.ts @@ -165,18 +165,20 @@ export function risuFormater(dat:string){ } } + let lineResult = '' + while(depthChunk.length > 0){ - result += depthChunk.pop() + lineResult = depthChunk.pop() + lineResult } - if(result.startsWith(' ')){ - result = result.substring(1) + if(lineResult.startsWith(' ')){ + lineResult = lineResult.substring(1) } - if(result.endsWith(' ')){ - result = result.substring(0,result.length-1) + if(lineResult.endsWith(' ')){ + lineResult = lineResult.substring(0,result.length-1) } - result += '\n' + result += lineResult + '\n' } return result.trim()