Fixed a lot of bug when parsing .vmd files

This commit is contained in:
2026-07-11 13:03:48 +02:00
parent 01ddc0de19
commit a730723f21
2 changed files with 41 additions and 45 deletions
+4 -4
View File
@@ -37,12 +37,12 @@
if (!data.Content[ev.target.value]) return;
fileoutput.innerHTML = [
`<h1>${data.Content[ev.target.value].Title}</h1>`,
...Object.keys(data.Content[ev.target.value].INFO).map(type => {
...data.Content[ev.target.value].INFO ?
Object.keys(data.Content[ev.target.value].INFO).map(type => {
const content = data.Content[ev.target.value].INFO[type].split(/\r?\n/, 2);
if (content[1] == "") return `<p>${content.shift()}</p>`;
if (content.length === 1) return `<p>${content.shift()}</p>`;
return `<h2>${content.shift().replace("## ", "")}</h2><p>${content.shift()}</p>`;
}),
}) : [],
].join("");
};