Compare commits

...

3 Commits

Author SHA1 Message Date
murat 82ac8e0998 create bash script for easily running the lua code 2026-06-04 01:04:20 +03:00
murat 964e58456a create html files for md files inside the public/ directory 2026-06-04 01:03:07 +03:00
murat df50db67fe required for lua lsp 2026-06-04 01:02:17 +03:00
4 changed files with 74 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
{
"workspace": {
"library": [
"types"
]
}
}
Executable
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
lua /home/murat/Projects/luago/luago.lua
+23
View File
@@ -20,6 +20,7 @@ for file in lfs.dir(currentDir) do
markdownFiles[markdownFileCount] = {
options = {},
filePath = filePath,
fileName = file:sub(1, file:len()-3),
content = ""
}
end
@@ -83,3 +84,25 @@ for index, value in ipairs(markdownFiles) do
end
end
-- get index.html content
local indexFile = io.open("index.html"):read("*all")
-- remove and create "public/" directory
lfs.rmdir("public")
lfs.mkdir("public")
for index, value in ipairs(markdownFiles) do
local workDir = lfs.currentdir()
-- create html file for that md file
local htmlFile = io.open(workDir .. "/public/" .. markdownFiles[index].fileName .. ".html", 'w')
if htmlFile then
local content = indexFile
-- replace <!-- sitecontents --> with markdown file content
htmlFile:write(content)
htmlFile:close()
else
print("Error: Cannot create html file for " .. markdownFiles[index].filePath)
end
end
+41
View File
@@ -0,0 +1,41 @@
---@meta
---@class lfs
local lfs = {}
---@param filepath string
---@param aname? string|table
---@return table|string|nil result
---@return string? error_msg
function lfs.attributes(filepath, aname) end
---@param path string
---@return boolean success
---@return string? error_msg
function lfs.chdir(path) end
---@return string path
function lfs.currentdir() end
---@param path string
---@return fun():string iter
---@return table dir_obj
function lfs.dir(path) end
---@param dirname string
---@return boolean success
---@return string? error_msg
function lfs.mkdir(dirname) end
---@param dirname string
---@return boolean success
---@return string? error_msg
function lfs.rmdir(dirname) end
---@param filepath string
---@param atime? number
---@param mtime? number
---@return boolean success
---@return string? error_msg
function lfs.touch(filepath, atime, mtime) end
return lfs