From 098fe27e2df8d3519117df48ec7b2a3308556672 Mon Sep 17 00:00:00 2001 From: bie Date: Thu, 29 Jun 2017 15:49:36 +0200 Subject: lupin lupin --- lupin.lua | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lupin.lua b/lupin.lua index 851830b..f629d04 100755 --- a/lupin.lua +++ b/lupin.lua @@ -108,6 +108,16 @@ function html.tag(tag, options) end printf("\n") end +function html.dl(facts) + if #facts < 1 then return end + printf("
") + 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("
") +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) -- cgit v1.0