From 9c2b3d10e69832c5761545aff2ebe1dedfea03e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Tue, 9 Apr 2024 17:56:15 +0200 Subject: [PATCH] README.html -> index.html --- lib/pages.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/pages.js b/lib/pages.js index 68cd0052..880fb5b7 100644 --- a/lib/pages.js +++ b/lib/pages.js @@ -3,12 +3,14 @@ const fs = require("fs"); const VOCAB = require("../package.json").name; -function file(dir, source, target) { - console.log(`${dir}/${source}`); +function file(dir, filename) { + console.log(`${dir}/${filename}`); pandoc( { - stdin: fs.createReadStream(`${__dirname}/../${dir}/${source}`), - stdout: fs.createWriteStream(`${__dirname}/../_site/${dir}/${target}`), + stdin: fs.createReadStream(`${__dirname}/../${dir}/${filename}`), + stdout: fs.createWriteStream( + `${__dirname}/../_site/${dir}/${filename === "README.md" ? "index.html" : filename.replace(/\.md$/, ".html")}`, + ), }, { "-c": `/${VOCAB}/styles/style.css`, @@ -26,7 +28,7 @@ function directory(dir) { fs.readdirSync(`${__dirname}/../${dir}`) .filter((fn) => fn.endsWith(".md")) .forEach(function (filename) { - file(dir, filename, filename.replace(/\.md$/, ".html")); + file(dir, filename); }); } }