attr-mkr.lua /size: 705 b    last modification: 2020-07-01 14:35
1if not modules then modules = { } end modules ['attr-mkr'] = {
2    version   = 1.001,
3    comment   = "companion to attr-mkr.mkiv",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files"
7}
8
9local markers = nodes.markers or { }
10nodes.markers = markers
11
12local cache     = { }
13local numbers   = attributes.numbers
14local a_unknown = attributes.private("marker:unknown")
15
16table.setmetatableindex(cache,function(t,k)
17    local k = "marker:" .. k
18    local v = numbers[k] or a_unknown
19    t[k] = v
20    return v
21end)
22
23function markers.get(n,name)
24    local a = cache[name]
25    return a and n[a] or nil
26end
27