Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 82ac8e0998 | |||
| 964e58456a | |||
| df50db67fe |
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"workspace": {
|
||||
"library": [
|
||||
"types"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
lua /home/murat/Projects/luago/luago.lua
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user