diff options
author | bie <bie@blekksprut.net> | 2017-08-04 06:53:05 +0000 |
---|---|---|
committer | bie <bie@blekksprut.net> | 2017-08-04 06:53:05 +0000 |
commit | 5d2f6c6b3a02b25d1ec81fc6fcfe23fa3236fc02 (patch) | |
tree | 74a967cd8fbd2b1cf883772c91df94083558a1f5 | |
parent | 749c1789ee6d8537cd9645be0d39415291677182 (diff) | |
download | maker-5d2f6c6b3a02b25d1ec81fc6fcfe23fa3236fc02.tar.xz |
uhm
-rwxr-xr-x | maker | 36 |
1 files changed, 35 insertions, 1 deletions
@@ -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 + + |