summaryrefslogtreecommitdiff
path: root/tex/context/base/type-ini.lua
blob: fd1282474bc73100de3d926733698477884cf171 (plain)
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
if not modules then modules = { } end modules ['type-ini'] = {
    version   = 1.001,
    comment   = "companion to type-ini.mkiv",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

-- more code will move here

local format, gsub = string.format, string.gsub

local patterns = { "type-imp-%s.mkiv", "type-imp-%s.tex", "type-%s.mkiv", "type-%s.tex" }

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
    end
end