summaryrefslogtreecommitdiff
path: root/tex/context/base/type-ini.lua
blob: c2b274fb92798063cda2ddf001d5617aec22a60a (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
32
33
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 gsub = string.gsub

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

local function action(name,foundname)
    context.startreadingfile()
    context.pushendofline()
    context.unprotect()
    context.input(foundname)
    context.protect()
    context.popendofline()
    context.stopreadingfile()
end

function commands.doprocesstypescriptfile(name)
    commands.uselibrary {
        name     = gsub(name,"^type%-",""),
        patterns = patterns,
        action   = action,
    }
end