Update converter.js

This commit is contained in:
MeowcaTheoRange 2022-05-29 20:18:57 -05:00 committed by GitHub
parent 9161c3d6a6
commit 3299d39772
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,9 @@ var path = process.argv[2]
console.log(path); console.log(path);
var json = JSON.parse(fs.readFileSync(path + "/story/database.json", { encoding: "utf8" })); var json = JSON.parse(fs.readFileSync(path + "/story/database.json", { encoding: "utf8" }));
var artjson = JSON.parse(fs.readFileSync(path + "/art/data.json", { encoding: "utf8" }));
var fullMd = ""; var fullMd = "";
var artMd = "# Art Of The Dizzy AU\n\n";
json.forEach((v, i) => { json.forEach((v, i) => {
var mdTemp = `# ${v.scene}\n`; var mdTemp = `# ${v.scene}\n`;
@ -30,5 +32,9 @@ json.forEach((v, i) => {
fullMd += mdTemp + "\n\n"; fullMd += mdTemp + "\n\n";
fs.writeFileSync(`${path}/story/human-readable/${v.id}.md`, mdTemp, {encoding: "utf8"}); fs.writeFileSync(`${path}/story/human-readable/${v.id}.md`, mdTemp, {encoding: "utf8"});
}) })
artjson.forEach((v, i) => {
artMd += `# ${v.title}\n${v.description}\n\n![](${v.image})\n\nCredit: \`${v.credit}\`\n\n`;
})
fs.writeFileSync(`${path}/story/human-readable.md`, fullMd, {encoding: "utf8"}); fs.writeFileSync(`${path}/story/human-readable.md`, fullMd, {encoding: "utf8"});
fs.writeFileSync(`${path}/art.md`, artMd, {encoding: "utf8"});
fs.writeFileSync(`${path}/index.md`, "# The full, unbroken story of the Dizzy AU.\n[See it on GitHub Pages.](https://meowcatheorange.github.io/Dizzy-AU/index)\n\n" + fullMd, {encoding: "utf8"}); fs.writeFileSync(`${path}/index.md`, "# The full, unbroken story of the Dizzy AU.\n[See it on GitHub Pages.](https://meowcatheorange.github.io/Dizzy-AU/index)\n\n" + fullMd, {encoding: "utf8"});