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