Differences From
Artifact [70cf5fbd0d]:
8 8 local startswith = ss.str.begins
9 9 local eachcode = ss.str.enc.utf8.each
10 10 local dump = ss.dump
11 11 local declare = ss.declare
12 12
13 13 -- make this module available to require() when linked into a lua bytecode program with luac
14 14 local ct = ss.namespace 'cortav'
15 +ct.info = {
16 + version = ss.version {0,1; 'devel'};
17 + package_name = 'cortav';
18 + contributors = {
19 + { name = 'lexi hale', handle = 'velartrill';
20 + mail = 'lexi@hale.su', homepage = 'https://hale.su' };
21 + };
22 + ident_string = function(i)
23 + return string.format('%s %s', i.package_name, i.version)
24 + end;
25 + credits = function(i)
26 + local all = ss.copy(i.contributors)
27 + for i,who in pairs(all) do
28 + who.role = who.role or 'core functionality'
29 + end
30 + for name,ext in pairs(ct.ext.loaded) do
31 + if ext.contributors then
32 + for _,c in pairs(ext.contributors) do
33 + local ofs, ref = ss.find(all, function(a)
34 + return a.handle == c.handle
35 + end)
36 + if ofs then
37 + ref.role = string.format('%s; %s extension', ref.role, name)
38 + else
39 + local c = ss.clone(ext.author)
40 + c.role = name .. ' extension'
41 + end
42 + end
43 + end
44 + end
45 + return all
46 + end;
47 + credits_ascii = function(contributors)
48 + local body = ''
49 + for _, c in pairs(contributors) do
50 + local str
51 + if c.handle then
52 + str = string.format('%s ā%sā <%s>', c.name, c.handle, c.mail)
53 + else
54 + str = string.format('%s <%s>', c.name, c.mail)
55 + end
56 + if c.homepage then
57 + str = string.format('%s (%s)', str, c.homepage)
58 + end
59 + if c.role then
60 + str = string.format('%s: %s', str, c.role)
61 + end
62 + body = body .. string.format(' ~ %s\n', str)
63 + end
64 + return body
65 + end;
66 + about = function(i)
67 + return i:ident_string() .. '\n' ..
68 + i.credits_ascii(i:credits())
69 + end;
70 +}
71 +
72 +
15 73 ct.render = {}
16 74
17 75 ct.exns = {
18 76 tx = ss.exnkind('translation error', function(msg,...)
19 77 return string.format("(%s:%u) "..msg, ...)
20 78 end);
21 79 io = ss.exnkind('IO error', function(msg, ...)