fix bug: string escape

This commit is contained in:
monoid 2022-11-29 19:14:36 +09:00
parent 5ab8ec04a6
commit 1f3eab6593

View File

@ -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)}
---