diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/type-ini.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/type-ini.lua | 76 |
1 files changed, 59 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/context/base/type-ini.lua b/Master/texmf-dist/tex/context/base/type-ini.lua index fd1282474bc..4ce953168f5 100644 --- a/Master/texmf-dist/tex/context/base/type-ini.lua +++ b/Master/texmf-dist/tex/context/base/type-ini.lua @@ -8,24 +8,66 @@ if not modules then modules = { } end modules ['type-ini'] = { -- more code will move here -local format, gsub = string.format, string.gsub +local gsub = string.gsub -local patterns = { "type-imp-%s.mkiv", "type-imp-%s.tex", "type-%s.mkiv", "type-%s.tex" } +local report_typescripts = logs.reporter("fonts","typescripts") -function commands.doprocesstypescriptfile(name) - name = gsub(name,"^type%-","") - for i=1,#patterns do - local filename = format(patterns[i],name) - local foundname = resolvers.finders.doreadfile("any",".",filename) - if foundname ~= "" then - context.startreadingfile() - context.pushendofline() - context.unprotect() - context.input(foundname) - context.protect() - context.popendofline() - context.stopreadingfile() - return - end +local patterns = { "type-imp-%s.mkiv", "type-imp-%s.tex", "type-%s.mkiv", "type-%s.tex" } -- this will be imp only + +local function action(name,foundname) + context.startreadingfile() + context.pushendofline() + context.unprotect() + context.input(foundname) + context.protect() + context.popendofline() + context.stopreadingfile() +end + +local name_one, name_two + +local function failure_two(name) + report_typescripts("unknown: library '%s' or '%s'",name_one,name_two) +end + +local function failure_one(name) + name_two = gsub(name,"%-.*$","") + if name_two == name then + report_typescripts("unknown: library '%s'",name_one) + else + commands.uselibrary { + name = name_two, + patterns = patterns, + action = action, + failure = failure_two, + onlyonce = false, -- will become true + } end end + +function commands.doprocesstypescriptfile(name) + name_one = gsub(name,"^type%-","") + commands.uselibrary { + name = name_one, + patterns = patterns, + action = action, + failure = failure_one, + onlyonce = false, -- will become true + } +end + +local patterns = { "type-imp-%s.mkiv", "type-imp-%s.tex" } + +local function failure(name) + report_typescripts("unknown: library '%s'",name) +end + +function commands.loadtypescriptfile(name) -- a more specific name + commands.uselibrary { + name = gsub(name,"^type%-",""), + patterns = patterns, + action = action, + failure = failure, + onlyonce = false, -- will become true + } +end |