1if not modules then modules = { } end modules ['type-ini'] = {
2 version = 1.001,
3 comment = "companion to type-ini.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 lpegmatch, P, Cs = lpeg.match, lpeg.P, lpeg.Cs
10
11local context = context
12local implement = interfaces.implement
13local uselibrary = resolvers.uselibrary
14local p_strip = Cs((P("type-") * (P("imp-")^0))^0/"" * P(1)^0)
15local report = logs.reporter("fonts","typescripts")
16
17local function action(name,foundname)
18 context.loadfoundtypescriptfile(name,foundname)
19end
20
21local patterns = {
22 "type-imp-%s.mkxl",
23 "type-imp-%s.mkiv",
24 "type-imp-%s.tex"
25}
26
27local function failure(name)
28 if name ~= "loc" then
29 report("unknown library %a",name)
30 end
31end
32
33implement {
34 name = "loadtypescriptfile",
35 arguments = "string",
36 actions = function(name)
37 uselibrary {
38 name = lpegmatch(p_strip,name) or name,
39 patterns = patterns,
40 action = action,
41 failure = failure,
42 onlyonce = false,
43 }
44 end
45}
46 |