From 1f3eab6593fc142d223c3fc4163fcc53e53f4277 Mon Sep 17 00:00:00 2001 From: monoid Date: Tue, 29 Nov 2022 19:14:36 +0900 Subject: [PATCH] fix bug: string escape --- doc_load/load.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc_load/load.ts b/doc_load/load.ts index 919dd67..5d4503f 100644 --- a/doc_load/load.ts +++ b/doc_load/load.ts @@ -57,8 +57,7 @@ export class DocParser { let [key, value] = splitTwo(line, ':'); value = value.trimStart(); if (value.startsWith('"') && value.endsWith('"')) { - value = value.substring(1, value.length - 1); - value = value.replace('\\"', '"'); + value = JSON.parse( value ); } key = key.trimEnd(); switch(key){ @@ -110,7 +109,7 @@ ${doc.from_url ? `from_url: ${doc.from_url}\n` : ''}name: "${doc.name}" author: "${doc.author}" star: ${doc.star} fork: ${doc.fork} -desc: "${doc.desc.replaceAll("\"", "\\\"")}" +desc: ${JSON.stringify(doc.desc)} url: ${doc.url} tags: ${JSON.stringify(doc.tags)} ---