attr-mkr.lua /size: 705 b    last modification: 2020-07-01 14:35
1
if
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 9
local
markers
=
nodes
.
markers
or
{
}
10
nodes
.
markers
=
markers
11 12
local
cache
=
{
}
13
local
numbers
=
attributes
.
numbers
14
local
a_unknown
=
attributes
.
private
(
"
marker:unknown
"
)
15 16
table
.
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
21
end
)
22 23
function
markers
.
get
(
n
,
name
)
24
local
a
=
cache
[
name
]
25
return
a
and
n
[
a
]
or
nil
26
end
27