scrn-ref.lua /size: 2228 b    last modification: 2020-07-01 14:35
1
if
not
modules
then
modules
=
{
}
end
modules
[
'
scrn-ref
'
]
=
{
2
version
=
1
.
001
,
3
comment
=
"
companion to scrn-int.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
interactions
=
interactions
or
{
}
10
interactions
.
references
=
interactions
.
references
or
{
}
11
local
references
=
interactions
.
references
12 13
local
codeinjections
=
backends
.
codeinjections
14 15
local
expandcurrent
=
structures
.
references
.
expandcurrent
16
local
identify
=
structures
.
references
.
identify
17 18
local
implement
=
interfaces
.
implement
19 20
local
function
check
(
what
)
21
if
what
and
what
~
=
"
"
then
22
local
set
,
bug
=
identify
(
"
"
,
what
)
23
return
not
bug
and
#
set
>
0
and
set
24
end
25
end
26 27
local
function
setopendocumentaction
(
open
)
28
local
opendocument
=
check
(
open
)
29
if
opendocument
then
30
codeinjections
.
registerdocumentopenaction
(
opendocument
)
31
expandcurrent
(
)
32
end
33
end
34 35
local
function
setclosedocumentaction
(
close
)
36
local
closedocument
=
check
(
close
)
37
if
closedocument
then
38
codeinjections
.
registerdocumentcloseaction
(
closedocument
)
39
expandcurrent
(
)
40
end
41
end
42 43
local
function
setopenpageaction
(
open
)
44
local
openpage
=
check
(
open
)
45
if
openpage
then
46
codeinjections
.
registerpageopenaction
(
openpage
)
47
expandcurrent
(
)
48
end
49
end
50 51
local
function
setclosepageaction
(
close
)
52
local
closepage
=
check
(
close
)
53
if
closepage
then
54
codeinjections
.
registerpagecloseaction
(
closepage
)
55
expandcurrent
(
)
56
end
57
end
58 59
references
.
setopendocument
=
setopendocumentaction
60
references
.
setclosedocument
=
setclosedocumentaction
61
references
.
setopenpage
=
setopenpageaction
62
references
.
setclosepage
=
setclosepageaction
63 64
implement
{
name
=
"
setopendocumentaction
"
,
arguments
=
"
string
"
,
actions
=
setopendocumentaction
}
65
implement
{
name
=
"
setclosedocumentaction
"
,
arguments
=
"
string
"
,
actions
=
setclosedocumentaction
}
66
implement
{
name
=
"
setopenpageaction
"
,
arguments
=
"
string
"
,
actions
=
setopenpageaction
}
67
implement
{
name
=
"
setclosepageaction
"
,
arguments
=
"
string
"
,
actions
=
setclosepageaction
}
68