summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmaker36
1 files changed, 35 insertions, 1 deletions
diff --git a/maker b/maker
index c0ae292..1109dfe 100755
--- a/maker
+++ b/maker
@@ -61,7 +61,7 @@ for n=1,8 do
local data = lupin.transform(files[n], "later", false, "full")
local slug = posix.basename(files[n]):gsub(".txt$", "")
data.path = posix.dirname(files[n]):gsub("^" .. config.src, "")
- data.url = config.base .. "/" .. data.path .. "/" .. slug
+ data.url = config.base .. data.path .. "/" .. slug
if config.extension then
data.url = data.url .. config.extension
end
@@ -82,3 +82,37 @@ for i, page in ipairs(config.static) do
build(path, page.template, data)
end
+local archive = "find %s -perm /o+r -readable -not -iname '*~' -not -path '%s' -type d | sort -n"
+local files = {}
+for raw in io.popen(archive:format(config.src, config.src)):read("*a"):gmatch("[^\n]+") do
+ local original = lfs.currentdir()
+ lfs.chdir(raw)
+
+ local page = {}
+ page.site = config
+ page.articles = {}
+
+ local finder = "find . -perm /o+r -readable -not -iname '*~' -type f | sort -rn"
+ local nposts = 0
+ for file in io.popen(finder:format(config.src)):read("*a"):gmatch("[^\n]+") do
+ local data = lupin.transform(file, "later", false, "full")
+ local slug = posix.basename(file):gsub(".txt$", "")
+
+ data.path = posix.dirname(file):gsub("^" .. config.src, "")
+ data.url = config.base .. data.path .. "/" .. slug
+ if config.extension then
+ data.url = data.url .. config.extension
+ end
+
+ nposts = nposts + 1
+ table.insert(page.articles, data)
+ end
+ lfs.chdir(original)
+ if nposts > 0 then
+ local apath = raw:gsub("^" .. config.src, "")
+ local path = config.www .. "/" .. apath .. "/index.html"
+ build(path, "index", page)
+ end
+end
+
+