cortav  Diff

Differences From Artifact [70cf5fbd0d]:

To Artifact [7d896a453b]:


8
9
10
11
12
13
14


























































15
16
17
18
19
20
21
local startswith = ss.str.begins
local eachcode = ss.str.enc.utf8.each
local dump = ss.dump
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.render = {}

ct.exns = {
	tx = ss.exnkind('translation error', function(msg,...)
		return string.format("(%s:%u) "..msg, ...)
	end);
	io = ss.exnkind('IO error', function(msg, ...)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
local startswith = ss.str.begins
local eachcode = ss.str.enc.utf8.each
local dump = ss.dump
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,...)
		return string.format("(%s:%u) "..msg, ...)
	end);
	io = ss.exnkind('IO error', function(msg, ...)