From 21fcf6702c23253973a5dd1be0c5364a13aa559a Mon Sep 17 00:00:00 2001 From: murat Date: Thu, 4 Jun 2026 02:06:28 +0300 Subject: [PATCH] add md contents to the html files --- luago.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/luago.lua b/luago.lua index 468fa26..9671d7b 100644 --- a/luago.lua +++ b/luago.lua @@ -80,6 +80,7 @@ for index, value in ipairs(markdownFiles) do end for index, value in ipairs(markdownFiles) do + print("---------------") -- print file path with index print(index .. ': ' .. markdownFiles[index].filePath) local f = io.open(markdownFiles[index].filePath, 'r') @@ -100,6 +101,14 @@ end -- get index.html content local indexFile = io.open("index.html"):read("*all") +local siteName +local siteTitle + +for i, v in ipairs(markdownFiles) do + if v.fileName == "index" then + -- get siteName and siteTitle + end +end -- remove and create "public/" directory lfs.rmdir("public") @@ -112,6 +121,12 @@ for index, value in ipairs(markdownFiles) do if htmlFile then local content = indexFile -- replace with markdown file content + local start_idx, end_idx = content:find("", 1, true) + if start_idx and end_idx then + local first = content:sub(1, start_idx - 1) + local second = content:sub(end_idx + 1) + content = first .. markdownFiles[index].content .. second + end htmlFile:write(content) htmlFile:close()