', '
');
// get the food
let food;
food = foods[ +(day < actualDay) ][day]; // test this out more
if (food !== undefined)
{
res["food-header"] = food[0];
res["food"] = food[1];
}
else
{
res["food-header"] = weekdays[day];
res["food"] = "Päivälle ei löytynyt ruokaa";
}
res["food-header"] = `Päivän ${res["food-header"]} kouluruoka:`;
data_string = build_replace(data_string, res);
return data_string;
}
async function build404(path, attemptpath)
{
const data = await openFile(path);
const data_string = data.toString("utf-8");
return data_string.replace("\\(path\\)", attemptpath);
}
async function buildDefault(args)
{
const path = args["path"];
const data = await openFile(path);
return data.toString("utf-8");
}
function build_replace(s, dict)
{
for (const [key, val] of Object.entries(dict))
{
s = s.replaceAll(`\\(${key}\\)`, val);
}
return s;
}
init();