Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 33540f028f | |||
| 80a8119f6a | |||
| 8b43950cce |
@@ -50,11 +50,19 @@ for index, file in ipairs(markdownFiles) do
|
|||||||
fileOptions = fileOptions:sub(fileOptions:find("\n")+1, fileOptions:len())
|
fileOptions = fileOptions:sub(fileOptions:find("\n")+1, fileOptions:len())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- fill options table
|
||||||
for i, value in ipairs(lines) do
|
for i, value in ipairs(lines) do
|
||||||
if value:sub(value:len(), value:len()) == "\n" then
|
if value:sub(value:len(), value:len()) == "\n" then
|
||||||
value = value:sub(1, value:find("\n")-1)
|
value = value:sub(1, value:find("\n")-1)
|
||||||
end
|
end
|
||||||
markdownFiles[index].options[i] = value
|
local colonPos = value:find(":")
|
||||||
|
if colonPos then
|
||||||
|
local key = value:sub(1, colonPos - 1):match("^%s*(.-)%s*$")
|
||||||
|
local val = value:sub(colonPos + 1):match("^%s*(.-)%s*$")
|
||||||
|
if key and key ~= "" then
|
||||||
|
markdownFiles[index].options[key] = val
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return print(file.filePath .. " file doesn't have a options section!")
|
return print(file.filePath .. " file doesn't have a options section!")
|
||||||
@@ -90,8 +98,8 @@ for index, value in ipairs(markdownFiles) do
|
|||||||
print(markdownFiles[index].content)
|
print(markdownFiles[index].content)
|
||||||
-- print file options
|
-- print file options
|
||||||
print("--- OPTIONS ---")
|
print("--- OPTIONS ---")
|
||||||
for i, value in ipairs(markdownFiles[index].options) do
|
for key, val in pairs(markdownFiles[index].options) do
|
||||||
print(markdownFiles[index].options[i])
|
print(key .. ": " .. val)
|
||||||
end
|
end
|
||||||
print("---------------")
|
print("---------------")
|
||||||
else
|
else
|
||||||
@@ -104,12 +112,6 @@ local indexFile = io.open("index.html"):read("*all")
|
|||||||
local siteName
|
local siteName
|
||||||
local siteTitle
|
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
|
-- remove and create "public/" directory
|
||||||
lfs.rmdir("public")
|
lfs.rmdir("public")
|
||||||
lfs.mkdir("public")
|
lfs.mkdir("public")
|
||||||
@@ -127,6 +129,14 @@ for index, value in ipairs(markdownFiles) do
|
|||||||
local second = content:sub(end_idx + 1)
|
local second = content:sub(end_idx + 1)
|
||||||
content = first .. markdownFiles[index].content .. second
|
content = first .. markdownFiles[index].content .. second
|
||||||
end
|
end
|
||||||
|
while content:find("<!-- title -->", 1, true) do
|
||||||
|
start_idx, end_idx = content:find("<!-- title -->", 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].options["title"] .. second
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
htmlFile:write(content)
|
htmlFile:write(content)
|
||||||
htmlFile:close()
|
htmlFile:close()
|
||||||
|
|||||||
Reference in New Issue
Block a user