import { exec } from 'child_process';
const nodemailer = require('nodemailer');
exec('iching divine', (error, stdout, stderr) => {
console.log(`Begin`);
if (error) {
console.error(`Error: ${error.message}`);
return;
}
if (stderr) {
console.error(`Stderr: ${stderr}`);
return;
}
console.log(`Send E-Mail`);
sendEmail(stdout);
sleep();
});
// Create Transporter
const transporter = nodemailer.createTransport({
host: "mailhog.mailhog.svc.cluster.local", // MailHog ClusterIP
port: 1025, // Standard-MailHog SMTP-Port
secure: false // MailHog needs no encryption
});
// Send E-Mail
async function sendEmail(content: string) {
try {
const info = await transporter.sendMail({
from: '"The Oracle" " + line + "
";
} else if (line.startsWith("Judgement")) {
const judgement: Node = { type: "Judgement"};
currentNode.child = judgement;
currentNode = judgement;
currentNode.value = "" + line + "
";
} else if (line.startsWith("Images")) {
const images: Node = { type: "Images"};
currentNode.child = images;
currentNode = images;
currentNode.value = "" + line + "
";
} else if (line.startsWith("~") && currentNode.type != "ChangingLines") {
const changingLines: Node = { type: "ChangingLines"};
currentNode.child = changingLines;
currentNode = changingLines;
currentNode.value = line + "
";
} else {
currentNode.value = currentNode.value + line + "
";
}
}
return root;
}
//generate HTML from Parse Tree
function render(node: Node): string {
if (node == undefined) {
console.log("...finished...")
return "";
}
console.log("Render node" + node.type);
var outputHTML: string = "";
switch (node.type) {
case "Root":
return render(node.child!);
case "Hexagram":
//node.value = node.value?.replace("", "");
node.value = node.value?.replace("", "
" + node.value + "
"; outputHTML = outputHTML + render(node.child!); return outputHTML; default: outputHTML = "" + node.value + "
"; outputHTML = outputHTML + render(node.child!); return outputHTML; } }