@@ -11,8 +11,66 @@ local declare = ss.declare -- make this module available to require() when linked into a lua bytecode program with luac local ct = ss.namespace 'cortav' +ct.info = { + version = ss.version {0,1; 'devel'}; + package_name = 'cortav'; + contributors = { + { name = 'lexi hale', handle = 'velartrill'; + mail = 'lexi@hale.su', homepage = 'https://hale.su' }; + }; + ident_string = function(i) + return string.format('%s %s', i.package_name, i.version) + end; + credits = function(i) + local all = ss.copy(i.contributors) + for i,who in pairs(all) do + who.role = who.role or 'core functionality' + end + for name,ext in pairs(ct.ext.loaded) do + if ext.contributors then + for _,c in pairs(ext.contributors) do + local ofs, ref = ss.find(all, function(a) + return a.handle == c.handle + end) + if ofs then + ref.role = string.format('%s; %s extension', ref.role, name) + else + local c = ss.clone(ext.author) + c.role = name .. ' extension' + end + end + end + end + return all + end; + credits_ascii = function(contributors) + local body = '' + for _, c in pairs(contributors) do + local str + if c.handle then + str = string.format('%s ā€œ%sā€ <%s>', c.name, c.handle, c.mail) + else + str = string.format('%s <%s>', c.name, c.mail) + end + if c.homepage then + str = string.format('%s (%s)', str, c.homepage) + end + if c.role then + str = string.format('%s: %s', str, c.role) + end + body = body .. string.format(' ~ %s\n', str) + end + return body + end; + about = function(i) + return i:ident_string() .. '\n' .. + i.credits_ascii(i:credits()) + end; +} + + ct.render = {} ct.exns = { tx = ss.exnkind('translation error', function(msg,...)