summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/catc-xml.mkiv
blob: a23a2fe0a26f708f68d845aa430f0189b2cb5cf7 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
%D \module
%D   [       file=catc-xml,
%D        version=2006.09.18,
%D          title=\CONTEXT\ Catcode Macros,
%D       subtitle=\XML\ Catcode Tables,
%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.

\writestatus{loading}{ConTeXt Catcode Regimes / XML}

\ifdefined \xmlcatcodesn \else \newcatcodetable \xmlcatcodesn \fi % normal
\ifdefined \xmlcatcodese \else \newcatcodetable \xmlcatcodese \fi % entitle
\ifdefined \xmlcatcodesr \else \newcatcodetable \xmlcatcodesr \fi % reduce

\startcatcodetable \xmlcatcodesn
    \catcode\tabasciicode       \spacecatcode
    \catcode\endoflineasciicode \endoflinecatcode
    \catcode\formfeedasciicode  \endoflinecatcode
    \catcode\spaceasciicode     \spacecatcode
    \catcode\endoffileasciicode \ignorecatcode
    \catcode\ampersandasciicode \activecatcode
    \catcode`\<                 \activecatcode
    \catcode`\>                 \othercatcode
    \catcode`\"                 \othercatcode % probably not needed any more
    \catcode`\/                 \othercatcode % probably not needed any more
    \catcode`\'                 \othercatcode % probably not needed any more
    \catcode\tildeasciicode     \othercatcode % probably not needed any more
    \catcode\hashasciicode      \othercatcode % probably not needed any more
    \catcode\backslashasciicode \othercatcode % probably not needed any more
\stopcatcodetable

\startcatcodetable \xmlcatcodese
    \catcode\tabasciicode       \spacecatcode
    \catcode\endoflineasciicode \endoflinecatcode
    \catcode\formfeedasciicode  \endoflinecatcode
    \catcode\spaceasciicode     \spacecatcode
    \catcode\endoffileasciicode \ignorecatcode
    \catcode\ampersandasciicode \activecatcode
    \catcode`\<                 \activecatcode
    \catcode`\>                 \activecatcode
    \catcode\hashasciicode      \activecatcode
    \catcode\dollarasciicode    \activecatcode
    \catcode\commentasciicode   \activecatcode
    \catcode\backslashasciicode \activecatcode
    \catcode\circumflexasciicode\activecatcode
    \catcode\underscoreasciicode\activecatcode
    \catcode\leftbraceasciicode \activecatcode
    \catcode\rightbraceasciicode\activecatcode
    \catcode\barasciicode       \activecatcode
    \catcode\tildeasciicode     \activecatcode
\stopcatcodetable

\startcatcodetable \xmlcatcodesr
    \catcode\tabasciicode       \spacecatcode
    \catcode\endoflineasciicode \endoflinecatcode
    \catcode\formfeedasciicode  \endoflinecatcode
    \catcode\spaceasciicode     \spacecatcode
    \catcode\endoffileasciicode \ignorecatcode
    \catcode\ampersandasciicode \activecatcode
    \catcode`\<                 \activecatcode
    \catcode`\>                 \activecatcode
    \catcode\hashasciicode      \activecatcode
    \catcode\dollarasciicode    \activecatcode
    \catcode\commentasciicode   \activecatcode
    \catcode\backslashasciicode \activecatcode
    \catcode\circumflexasciicode\activecatcode
    \catcode\underscoreasciicode\activecatcode
    \catcode\leftbraceasciicode \activecatcode
    \catcode\rightbraceasciicode\activecatcode
    \catcode\barasciicode       \activecatcode
    \catcode\tildeasciicode     \activecatcode
\stopcatcodetable

%D Next we hook in some active character definitions.

\letcatcodecommand \xmlcatcodesn \ampersandasciicode  \relax
\letcatcodecommand \xmlcatcodesn `\<                  \relax

\letcatcodecommand \xmlcatcodese \ampersandasciicode  \relax
\letcatcodecommand \xmlcatcodese `\<                  \relax

\letcatcodecommand \xmlcatcodesr \ampersandasciicode  \relax
\letcatcodecommand \xmlcatcodesr `\<                  \relax

\letcatcodecommand \xmlcatcodese \hashasciicode       \relax
\letcatcodecommand \xmlcatcodese \dollarasciicode     \relax
\letcatcodecommand \xmlcatcodese \commentasciicode    \relax
\letcatcodecommand \xmlcatcodese \backslashasciicode  \relax
\letcatcodecommand \xmlcatcodese \circumflexasciicode \relax
\letcatcodecommand \xmlcatcodese \underscoreasciicode \relax
\letcatcodecommand \xmlcatcodese \leftbraceasciicode  \relax
\letcatcodecommand \xmlcatcodese \rightbraceasciicode \relax
\letcatcodecommand \xmlcatcodese \barasciicode        \relax
\letcatcodecommand \xmlcatcodese \tildeasciicode      \relax

\letcatcodecommand \xmlcatcodesr \hashasciicode       \relax
\letcatcodecommand \xmlcatcodesr \dollarasciicode     \relax
\letcatcodecommand \xmlcatcodesr \commentasciicode    \relax
\letcatcodecommand \xmlcatcodesr \backslashasciicode  \relax
\letcatcodecommand \xmlcatcodesr \circumflexasciicode \relax
\letcatcodecommand \xmlcatcodesr \underscoreasciicode \relax
\letcatcodecommand \xmlcatcodesr \leftbraceasciicode  \relax
\letcatcodecommand \xmlcatcodesr \rightbraceasciicode \relax
\letcatcodecommand \xmlcatcodesr \barasciicode        \relax
\letcatcodecommand \xmlcatcodesr \tildeasciicode      \relax

\let\xmlcatcodes   \xmlcatcodesn % beware, in mkiv we use \notcatcodes

%D We register the catcodetables at the \LUA\ end where some further
%D initializations take place.

\ctxcommand{definecatcodetable(
    {\number\xmlcatcodesn,\number\xmlcatcodese,\number\xmlcatcodesr},% letter catcodes
    {\number\xmlcatcodesn,\number\xmlcatcodese,\number\xmlcatcodesr} % activate catcodes
)}

\ctxcommand{registercatcodetable("xmlcatcodes",\number\xmlcatcodes)}

\endinput