summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/s-reg-01.mkiv
blob: 36434c30c194e9913fe89308ab644fdc54256d6b (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
%D \module
%D   [       file=s-reg-01,
%D        version=2005.04.25,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Extra Regime Support,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D \macros
%D   {showregime}
%D
%D This code is moved from the kernel to here. (We could make it
%D auto-loadable).

\startluacode
--[[ldx--
<p>The following code is rather <l n='context'/> specific.</p>
--ldx]]--

function regimes.show(regime)
    regime = regimes.synonyms[regime] or regime
    local r = regimes.data[regime]
    if r then
        local chardata = characters.data
        context.starttabulate { "|rT|T|rT|lT|lT|lT|" }
        for k, v in ipairs(r) do
            local chr = chardata[v]
            if chr then
                context.NC() context(k)
                context.NC() context.getvalue(chr.contextname])
                context.NC() context("%U+05X",v)
                context.NC() context(chr.contextname)
                context.NC() context(chr.category)
                context.NC() context(chr.description)
                context.NC() context.NR()
            else
                -- can't happen
            end
        end
        context.stoptabulate()
    else
        context("unknown regime %s",regime)
    end
end
\stopluacode

\unprotect

\def\showregime
  {\dosingleempty\doshowregime}

\def\doshowregime[#1]%
  {\ctxlua{regimes.show("#1")}}

\protect \endinput