math-ren.lua /size: 2104 b    last modification: 2020-07-01 14:35
1
if
not
modules
then
modules
=
{
}
end
modules
[
'
math-ren
'
]
=
{
2
version
=
1
.
001
,
3
comment
=
"
companion to math-ren.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
next
=
next
10
local
gsub
=
string
.
gsub
11 12
local
settings_to_array
=
utilities
.
parsers
.
settings_to_array
13
local
allocate
=
storage
.
allocate
14 15
local
renderings
=
{
}
16
mathematics
.
renderings
=
renderings
17 18
local
mappings
=
allocate
(
)
19
renderings
.
mappings
=
mappings
20 21
local
numbers
=
allocate
(
)
22
renderings
.
numbers
=
numbers
23 24
local
sets
=
allocate
(
)
25
renderings
.
sets
=
sets
26 27
mappings
[
"
blackboard-to-bold
"
]
=
{
28
[
0x1D538
]
=
0x1D400
,
[
0x1D539
]
=
0x1D401
,
[
0x02102
]
=
0x1D402
,
[
0x1D53B
]
=
0x1D403
,
[
0x1D53C
]
=
0x1D404
,
29
[
0x1D53D
]
=
0x1D405
,
[
0x1D53E
]
=
0x1D406
,
[
0x0210D
]
=
0x1D407
,
[
0x1D540
]
=
0x1D408
,
[
0x1D541
]
=
0x1D409
,
30
[
0x1D542
]
=
0x1D40A
,
[
0x1D543
]
=
0x1D40B
,
[
0x1D544
]
=
0x1D40C
,
[
0x02115
]
=
0x1D40D
,
[
0x1D546
]
=
0x1D40E
,
31
[
0x02119
]
=
0x1D40F
,
[
0x0211A
]
=
0x1D410
,
[
0x0211D
]
=
0x1D411
,
[
0x1D54A
]
=
0x1D412
,
[
0x1D54B
]
=
0x1D413
,
32
[
0x1D54C
]
=
0x1D414
,
[
0x1D54D
]
=
0x1D415
,
[
0x1D54E
]
=
0x1D416
,
[
0x1D54F
]
=
0x1D417
,
[
0x1D550
]
=
0x1D418
,
33
[
0x02124
]
=
0x1D419
,
34
}
35 36
local
function
renderset
(
list
)
-- order matters
37
local
tag
=
gsub
(
list
,
"
"
,
"
"
)
38
local
n
=
sets
[
tag
]
39
if
not
n
then
40
local
list
=
settings_to_array
(
tag
)
41
local
mapping
=
{
}
42
for
i
=
1
,
#
list
do
43
local
m
=
mappings
[
list
[
i
]
]
44
if
m
then
45
for
k
,
v
in
next
,
m
do
46
mapping
[
k
]
=
v
47
end
48
end
49
end
50
if
next
(
mapping
)
then
51
n
=
#
numbers
+
1
52
numbers
[
n
]
=
mapping
53
else
54
n
=
attributes
.
unsetvalue
55
end
56
sets
[
tag
]
=
n
57
end
58
return
n
59
end
60 61
mathematics
.
renderset
=
renderset
62 63
interfaces
.
implement
{
64
name
=
"
mathrenderset
"
,
65
actions
=
{
renderset
,
context
}
,
66
arguments
=
"
string
"
,
67
}
68