mtx-context-setups.tex /size: 2392 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=mtx-context-setups,
3%D        version=2016.04.05,
4%D          title=\CONTEXT\ Command Overvews,
5%D       subtitle=Combine Files,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14% begin help
15%
16% usage: context --extra=setups [options] [categories]
17%
18% --interface              : user interface (en, nl, etc)
19% --overview [--save]      : use collection of files
20% --list                   : show know collections
21%
22% end help
23
24\input mtx-context-common.tex
25
26\starttext
27
28\startluacode
29    local report_setups = logs.reporter("setups")
30
31    context.starttext()
32
33    if document.arguments.list then
34        local okay = resolvers.findfile("context.mkiv") or "" -- will become an i file
35        if okay ~= "" then
36            okay = file.collapsepath(okay,true)
37            okay = string.gsub(okay,"/base/","/interface/")
38            okay = string.gsub(okay,"/sources/","/interface/")
39            local path    = file.pathpart(okay)
40            local pattern = file.join(path,"i-*.xml")
41            local files   = dir.glob(pattern)
42            local valid   = { }
43            table.sort(files)
44            for i=1,#files do
45                local name = file.nameonly(files[i])
46                local base = string.match(name,"^i%-([a-z]+)$")
47                if base then
48                    valid[#valid+1] = base
49                end
50            end
51            if #valid > 0 then
52                report_setups("% t",valid)
53            end
54            context.bold("available setup groups: ")
55            context("%, t.",valid)
56        end
57    elseif document.arguments.overview then
58        if document.arguments.save then
59            context.enablemode { "setups:save" }
60        end
61        context.input("x-setups-overview.mkiv")
62    elseif #document.files > 0 then
63        context.usemodule { "x-setups-basics" }
64        for i=1,#document.files do
65            local filename = "i-" .. document.files[i]
66            report_setups("processing %a",filename)
67            context.loadsetups { filename }
68        end
69        context.input("x-setups-proofing.mkiv")
70    else
71        context("no setups")
72    end
73
74    context.stoptext()
75\stopluacode
76
77\stoptext
78
79