diff --git a/src/build.js b/src/build.js index 489a141..6ace44c 100644 --- a/src/build.js +++ b/src/build.js @@ -4,7 +4,12 @@ const buildFolder = "build" const articleFolder = "src/article" -const languages = ["German", "English"] +const flags = { + German: '🇩🇪', + English: '🇬🇧', +} + +const languages = Object.keys(flags) console.log("clearing the build folder..."); @@ -117,9 +122,20 @@ console.log("loading template..."); const template = fs.readFileSync('src/template.html', 'utf8'); +function generateLanguageSwitch(name) { + var result = "" + for (const [language, flag] of Object.entries(flags)) { + result += `${flag}` + } + return result +} + console.log("writing articles..."); 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) => {}); + fs.writeFile(`${buildFolder}/${name}_${language}.html`, + template.replace("", text) + .replace("", generateLanguageSwitch(name)), + (error) => {}); } } diff --git a/src/build.js b/src/build.js index 489a141..6ace44c 100644 --- a/src/build.js +++ b/src/build.js @@ -4,7 +4,12 @@ const buildFolder = "build" const articleFolder = "src/article" -const languages = ["German", "English"] +const flags = { + German: '🇩🇪', + English: '🇬🇧', +} + +const languages = Object.keys(flags) console.log("clearing the build folder..."); @@ -117,9 +122,20 @@ console.log("loading template..."); const template = fs.readFileSync('src/template.html', 'utf8'); +function generateLanguageSwitch(name) { + var result = "" + for (const [language, flag] of Object.entries(flags)) { + result += `${flag}` + } + return result +} + console.log("writing articles..."); 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) => {}); + fs.writeFile(`${buildFolder}/${name}_${language}.html`, + template.replace("", text) + .replace("", generateLanguageSwitch(name)), + (error) => {}); } } diff --git a/src/static/css/style.css b/src/static/css/style.css index 170afc3..91eef28 100644 --- a/src/static/css/style.css +++ b/src/static/css/style.css @@ -49,3 +49,12 @@ text-decoration: none; color: var(--green0); } + +.right { + text-align: right; +} + +.right a { + font-size: 150%; + padding: 1ch; +} diff --git a/src/build.js b/src/build.js index 489a141..6ace44c 100644 --- a/src/build.js +++ b/src/build.js @@ -4,7 +4,12 @@ const buildFolder = "build" const articleFolder = "src/article" -const languages = ["German", "English"] +const flags = { + German: '🇩🇪', + English: '🇬🇧', +} + +const languages = Object.keys(flags) console.log("clearing the build folder..."); @@ -117,9 +122,20 @@ console.log("loading template..."); const template = fs.readFileSync('src/template.html', 'utf8'); +function generateLanguageSwitch(name) { + var result = "" + for (const [language, flag] of Object.entries(flags)) { + result += `${flag}` + } + return result +} + console.log("writing articles..."); 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) => {}); + fs.writeFile(`${buildFolder}/${name}_${language}.html`, + template.replace("", text) + .replace("", generateLanguageSwitch(name)), + (error) => {}); } } diff --git a/src/static/css/style.css b/src/static/css/style.css index 170afc3..91eef28 100644 --- a/src/static/css/style.css +++ b/src/static/css/style.css @@ -49,3 +49,12 @@ text-decoration: none; color: var(--green0); } + +.right { + text-align: right; +} + +.right a { + font-size: 150%; + padding: 1ch; +} diff --git a/src/template.html b/src/template.html index 0f82d1b..3ad976d 100644 --- a/src/template.html +++ b/src/template.html @@ -18,6 +18,9 @@ +

+ +