2022-05-28 17:22:38 +00:00
|
|
|
const fs = require("fs");
|
2022-05-28 17:30:22 +00:00
|
|
|
var path = process.argv[2]
|
|
|
|
console.log(path);
|
2022-05-28 17:22:38 +00:00
|
|
|
|
2022-05-28 17:30:22 +00:00
|
|
|
var json = JSON.parse(fs.readFileSync(path + "/story/database.json", { encoding: "utf8" }));
|
2022-05-30 01:18:57 +00:00
|
|
|
var artjson = JSON.parse(fs.readFileSync(path + "/art/data.json", { encoding: "utf8" }));
|
2022-05-28 19:02:19 +00:00
|
|
|
var fullMd = "";
|
2022-05-30 01:57:02 +00:00
|
|
|
var indexmd = "# Table Of Contents\n\n";
|
2022-05-30 01:24:54 +00:00
|
|
|
var artMd = "# Art Of The Dizzy AU\n\nSome art, either by MeowcaTheoRange or other people who like the Dizzy AU. Check it out below!\n\n";
|
2022-05-28 17:22:38 +00:00
|
|
|
|
|
|
|
json.forEach((v, i) => {
|
|
|
|
var mdTemp = `# ${v.scene}\n`;
|
2022-05-30 01:57:02 +00:00
|
|
|
var chlist = ``;
|
2022-05-28 17:22:38 +00:00
|
|
|
var chars = {
|
|
|
|
"---": "---"
|
|
|
|
};
|
|
|
|
v.appearing_characters.forEach((vv, vi) => {
|
|
|
|
chars[vv[0]] = vv[1];
|
|
|
|
mdTemp += `- ${vv[1]}\n`;
|
2022-05-30 02:11:56 +00:00
|
|
|
chlist += `- ${vv[1]}\n\n`;
|
2022-05-28 17:22:38 +00:00
|
|
|
});
|
|
|
|
v.content.forEach((vv, vi) => {
|
|
|
|
switch (vv.type) {
|
|
|
|
case "message":
|
|
|
|
mdTemp += `\n### ${chars[vv.person]}\n`;
|
|
|
|
vv.content.forEach((vvv, vvi) => {
|
|
|
|
mdTemp += `\n> ${vvv}\n`;
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case "break":
|
|
|
|
mdTemp += `\n -- ${vv.content} --\n`;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
2022-05-28 19:02:19 +00:00
|
|
|
fullMd += mdTemp + "\n\n";
|
2022-05-30 02:16:17 +00:00
|
|
|
fs.writeFileSync(`${path}/story/human-readable/${v.id}.md`, mdTemp, {encoding: "utf8"});
|
2022-05-30 02:13:45 +00:00
|
|
|
indexmd += "### [" + v.id + "](https://meowcatheorange.github.io/Dizzy-AU/story/human-readable/" + v.id + ")\n\n" + chlist
|
2022-05-28 17:22:38 +00:00
|
|
|
})
|
2022-05-30 01:18:57 +00:00
|
|
|
artjson.forEach((v, i) => {
|
2022-05-30 01:24:54 +00:00
|
|
|
artMd += `## ${v.title}\n${v.description}\n\n![](${v.image})\n\nCredit: \`${v.credit}\`${v.link != undefined ? ` \([${v.linkName}](${v.link})\)` : ""}\n\n`;
|
2022-05-30 01:18:57 +00:00
|
|
|
})
|
2022-05-30 01:55:28 +00:00
|
|
|
fs.writeFileSync(`${path}/story/toc.md`, indexmd, {encoding: "utf8"});
|
2022-05-28 19:02:19 +00:00
|
|
|
fs.writeFileSync(`${path}/story/human-readable.md`, fullMd, {encoding: "utf8"});
|
2022-05-30 01:18:57 +00:00
|
|
|
fs.writeFileSync(`${path}/art.md`, artMd, {encoding: "utf8"});
|