diff options
Diffstat (limited to 'lupin.lua')
-rwxr-xr-x | lupin.lua | 27 |
1 files changed, 25 insertions, 2 deletions
@@ -108,6 +108,16 @@ function html.tag(tag, options) end printf("\n") end +function html.dl(facts) + if #facts < 1 then return end + printf("<dl>") + for i,v in ipairs(facts) do + local term, fact = v:match("^(.-)%s*:%s*(.-)$") + html.tag("dt", { text=term }) + html.tag("dd", { text=fact }) + end + printf("</dl>") +end function html.label(options) options.text = options.text or error("no text") html.tag("label", options) @@ -311,8 +321,15 @@ function lupin.transform(path, format, env, mode) local pwd = posix.getpasswd(stat.uid) data.author = pwd.name data.group = posix.getgroup(stat.gid).name - - if posix.stat(pwd.dir .. "/portrait.jpg") then + -- if data.published then + -- data.date = os.date("%A %d. %B %Y, kl. %H.%M", data.published) + -- else + -- local root = "/srv/www/happiest.place/tears/artikler" + -- y, m, d = file:match(root .. "/(.*)/(.*)/(.*)/(.*)") + -- data.date = ("%s/%s/%s"):format(y, m, d) + -- end + -- if posix.stat(pwd.dir .. "/portrait.jpg") then + if posix.stat(("/srv/www/users/%s.jpg"):format(data.author)) then data.portrait = ("/users/%s.jpg"):format(data.author) end @@ -323,6 +340,12 @@ function lupin.transform(path, format, env, mode) if format == "later" then data.raw = raw + local info = data.info + data.info = {} + for i,v in ipairs(info) do + local term, fact = v:match("^(.-)%s*:%s*(.-)$") + table.insert(data.info, { term = term, fact = fact }) + end data.text = function() local f = io.tmpfile() corz.marxup(data.raw, f) |