1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
if not modules then modules = { } end modules ['scrn-ini'] = {
version = 1.001,
comment = "companion to scrn-int.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
local next = next
-- We delay preroll because it needs a font and don't want to force a font load (at
-- startup) because we preset a field so some are tokenlists as we need to preserve
-- catcodes.
interactions = { }
interactions.general = interactions.general or { }
local general = interactions.general
local expand_macro = token.expand_macro
local prerolled = { }
local identitydata = { }
local function setidentityvariable(key,value)
prerolled[key] = value
end
table.setmetatableindex(identitydata, function(t,k)
if k == "keywords" then
k = "keyword"
end
-- fetch and process at the tex end (catcode etc)
expand_macro("scrn_identity_get",true,k)
-- return the registered return value
local v = prerolled[k] or ""
if k == "title" and v == "" then
v = tex.jobname
end
return v
end)
function general.getidentityvariable(name)
return identitydata[name]
end
function general.getidentity()
return identitydata
end
interfaces.implement {
name = "setidentityvariable",
actions = setidentityvariable,
arguments = "2 strings",
}
|