summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbie <bie@blekksprut.net>2017-06-29 15:49:36 +0200
committerbie <bie@blekksprut.net>2017-06-29 15:49:36 +0200
commit098fe27e2df8d3519117df48ec7b2a3308556672 (patch)
treeedb87fd4ec06ff3506aa53fcf240572dbfd8a741
parent360c0b89a07080150a34a3d186b61b95838e068a (diff)
downloadlupin-098fe27e2df8d3519117df48ec7b2a3308556672.tar.xz
lupin lupin
-rwxr-xr-xlupin.lua27
1 files 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("<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)