diff --git a/src/article/main.md b/src/article/main.md index 9220e22..9adba72 100644 --- a/src/article/main.md +++ b/src/article/main.md @@ -1,5 +1,9 @@ +%English # The schrodinger equation +%German +# Die Schrödinger Gleichung +%English ## Preface This article will cover the schrodinger equation, which represents a non-relativistic differential equation governing @@ -16,12 +20,16 @@ [Louis-de-Broglie](https://de.wikipedia.org/wiki/Louis_de_Broglie) postulated that matter waves should have the same wavelength as photons, whose wavelength depends on their respective impulse: +%common $$\lambda = \frac{h}{p} = \frac{h}{m*v} $$ +%English A basic wave function for a travelling monochromatic wave can be written as: +%common $$ \Psi = \cos(k*x - \omega * t) = e^{i*(k*x - \omega * t)} $$ +%English Schrodinger assumed that a matter wave should have the same wave form. From this, we can derive $k = \frac{2*\pi}{\lambda} = \frac{2 * \pi * p}{h} $, using the de-Broglie-wavelength as mentioned above. With $ v = f * \lambda $ for each wave, one can also conclude that $\omega = 2 * \pi * f = 2 * \pi * \frac{v}{\lambda} = \frac{2 * \pi diff --git a/src/article/main.md b/src/article/main.md index 9220e22..9adba72 100644 --- a/src/article/main.md +++ b/src/article/main.md @@ -1,5 +1,9 @@ +%English # The schrodinger equation +%German +# Die Schrödinger Gleichung +%English ## Preface This article will cover the schrodinger equation, which represents a non-relativistic differential equation governing @@ -16,12 +20,16 @@ [Louis-de-Broglie](https://de.wikipedia.org/wiki/Louis_de_Broglie) postulated that matter waves should have the same wavelength as photons, whose wavelength depends on their respective impulse: +%common $$\lambda = \frac{h}{p} = \frac{h}{m*v} $$ +%English A basic wave function for a travelling monochromatic wave can be written as: +%common $$ \Psi = \cos(k*x - \omega * t) = e^{i*(k*x - \omega * t)} $$ +%English Schrodinger assumed that a matter wave should have the same wave form. From this, we can derive $k = \frac{2*\pi}{\lambda} = \frac{2 * \pi * p}{h} $, using the de-Broglie-wavelength as mentioned above. With $ v = f * \lambda $ for each wave, one can also conclude that $\omega = 2 * \pi * f = 2 * \pi * \frac{v}{\lambda} = \frac{2 * \pi diff --git a/src/build.js b/src/build.js index 7fb52b0..e1bf5da 100644 --- a/src/build.js +++ b/src/build.js @@ -4,6 +4,8 @@ const buildFolder = "build" const articleFolder = "src/article" +const languages = ["German", "English"] + console.log("clearing the build folder..."); fs.rmSync(`${buildFolder}`, { recursive: true, force: true }, (error) => {if (error) {console.error(error);}}); @@ -55,13 +57,26 @@ return line; } +var result = Object.keys(articleEntries).reduce((o, name) => ({ + ...o, + [name]: languages.reduce((o, language) => ({ + ...o, + [language]: "" + }), {}) +}), {}) + for (const [name, data] of Object.entries(articleEntries)) { - var mathMode = false; - var bigMathMode = false; + var mathMode = false + var bigMathMode = false + var language = "common" data.forEach((line, index) => { - const noSpaces = line.replace(" ", ""); + const noSpaces = line.replace(" ", "") if (noSpaces == "") { - line = "
"; + line = "
" + } + if (noSpaces.startsWith("%")) { + language = noSpaces.substring(1) + return } for (var i = 1; i < 5; i++) { const headerStart = `${"#".repeat(i)} ` @@ -71,19 +86,22 @@ } line = processLinks(line); line = processMathModes(line); - data[index] = line; + if (language == "common") { + languages.forEach(language => { + result[name][language] += `${line} ` + }) + } else { + result[name][language] += `${line} ` + } }); } -for (const [name, data] of Object.entries(articleEntries)) { - articleEntries[name] = data.join(" "); -} - - console.log("loading template..."); const template = fs.readFileSync('src/template.html', 'utf8'); console.log("writing articles..."); -for (const [name, data] of Object.entries(articleEntries)) { - fs.writeFile(`${buildFolder}/${name}.html`, template.replace("", data), (error) => {}); +for (const [name, data] of Object.entries(result)) { + for (const [language, text] of Object.entries(data)) { + fs.writeFile(`${buildFolder}/${name}_${language}.html`, template.replace("", text), (error) => {}); + } }