1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-- vim: ft=terra
local pstr = lib.mem.ptr(int8)
local terra
render_nym(who: &lib.store.actor, scope: uint64)
var n: lib.str.acc n:init(128)
if who.nym ~= nil and who.nym[0] ~= 0 then
n:compose('<span class="nym">',who.nym,'</span> [<span class="handle">',
who.xid,'</span>]')
else n:compose('<span class="handle">',who.xid,'</span>') end
if who.epithet ~= nil then
n:lpush(' <span class="epithet">'):push(who.epithet,0):lpush('</span>')
end
-- TODO: if scope == chat room then lookup titles in room member db
return n:finalize()
end
return render_nym
|
>
>
>
>
>
|
|
>
|
>
>
|
>
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
-- vim: ft=terra
local pstr = lib.mem.ptr(int8)
local terra cs(s: rawstring)
return pstr { ptr = s, ct = lib.str.sz(s) }
end
local terra
render_nym(who: &lib.store.actor, scope: uint64)
var n: lib.str.acc n:init(128)
var xidsan = lib.html.sanitize(cs(who.xid),false)
if who.nym ~= nil and who.nym[0] ~= 0 then
var nymsan = lib.html.sanitize(cs(who.nym),false)
n:compose('<span class="nym">',nymsan,'</span> [<span class="handle">',
xidsan,'</span>]')
nymsan:free()
else n:compose('<span class="handle">',xidsan,'</span>') end
xidsan:free()
if who.epithet ~= nil then
var episan = lib.html.sanitize(cs(who.epithet),false)
n:lpush(' <span class="epithet">'):ppush(episan):lpush('</span>')
episan:free()
end
-- TODO: if scope == chat room then lookup titles in room member db
return n:finalize()
end
return render_nym
|