summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/core-ini.mkiv
blob: 1682bed1b232356893bb59b691621c329086fbf0 (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
%D \module
%D   [       file=core-ini,
%D        version=2003.12.01,
%D          title=\CONTEXT\ Core Macros,
%D       subtitle=Additional Initialization,
%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 Core Macros / Additional Initialization}

\unprotect

%D We introduce a couple of variables that are used all over \CONTEXT. Alternatively
%D we could define them in each module but as they are part of the bigger picture we
%D prefer to do it here. Ideally we should hav ea proper dependency tree but it might
%D be that we want to make versions with a smaller footprints in which case one would
%D still need to define the token list registers (unless we could do that runtime).

%D \macros
%D   {every...}
%D
%D A few every's.

%D Output routine:

\newtoks \everybeforeoutput
\newtoks \everyafteroutput

%D Shipout:

\newtoks \everyshipout
\newtoks \everybeforeshipout
\newtoks \everyaftershipout
\newtoks \everyfirstshipout
\newtoks \everylastshipout

%D End of run:

\newtoks \everybye
\newtoks \everygoodbye
\newtoks \everynotabene

%D Document:

\newtoks \everysetupdocument
\newtoks \everyendoftextbody

\newtoks \everystarttext
\newtoks \everystoptext

%D Purity:

\newtoks \everyforgetall
\newtoks \everycleanupfeatures
\newtoks \everysimplifycommands

\let\simplifiedcommands\everysimplifycommands % backward compatible, will stay as it's used in styles

\unexpanded\def\forgetall       {\the\everyforgetall}
\unexpanded\def\cleanupfeatures {\the\everycleanupfeatures}
\unexpanded\def\simplifycommands{\the\everysimplifycommands}

\appendtoks
    \everypar\emptytoks % pretty important
\to \everyforgetall

%D Page building:

\newtoks \everybeforepagebody
\newtoks \everyafterpagebody

\let\everypagebody\everybeforepagebody % backward compatible, will become obsolete

%D Floats:

\newtoks \everyinsidefloat

%D Sectioning:

%newtoks \everyheadstart

%D Par building (experimental, used in xml <p> .. </p>)

\newtoks \everybeginofpar
\newtoks \everyendofpar
%newtoks \everyparflush

\unexpanded\def\bpar{\the\everybeginofpar\ignorespaces}                  % may interfere with \everypar
\unexpanded\def\epar{\ifhmode\removeunwantedspaces\the\everyendofpar\fi} % test prevents problems with \bpar\epar

%D Lists:

\newtoks \everylistentry
\newtoks \everysavesortkeys

%D Marks:

%newtoks \everymarking

%D Fonts:

\newtoks \everyfont
\newtoks \everyglobalbodyfont
\newtoks \everydefinedfont

\newevery \everybodyfont   \EveryBodyFont
\newevery \everyfontswitch \EveryFontSwitch

\newtoks \everysetupbodyfont
\newtoks \everyswitchtobodyfont

%D Math:

\newtoks \everybeforedisplayformula
\newtoks \everymathematics

\prependtoks \the\everymathematics \to \everymath
\prependtoks \the\everymathematics \to \everydisplay

%D Tables:

%newtoks \everytable % we need to disstinguish kinds

%D State mess:

\newtoks \everypushsomestate
\newtoks \everypopsomestate

\unexpanded\def\pushsomestates{\the\everypushsomestate}
\unexpanded\def\popsomestates {\the\everypopsomestate }

%D More generic (used to be pushcolor etc)

\newtoks\everystarttextproperties
\newtoks\everystoptextproperties

\unexpanded\def\starttextproperties{\the\everystarttextproperties}
\unexpanded\def\stoptextproperties {\the\everystoptextproperties}

%D \macros
%D   {trialtypesetting}
%D
%D We disable trial typesetting in the output routine,
%D just to be sure.

\prependtoks
    \resettrialtypesetting
\to \everybeforepagebody

%D \macros
%D   {ifinpagebody,ifinsidecolumns,ifdoublesided,ifsinglesided}
%D
%D These will become system modes and conditionals

\newif \ifinpagebody
\newif \ifinsidecolumns
\newif \ifdoublesided   \doublesidedfalse
\newif \ifsinglesided   \singlesidedtrue
\newif \ifinsidefloat
\newif \ifdoingblocks
\newif \ifgridsnapping

%D \macros
%D   {ifproductionrun}
%D
%D This boolean can be used to bypass certain initializations.

\newif\ifproductionrun

\appendtoks
    \productionruntrue
\to \everydump

%D \macros
%D   {everyboxedcontent, ifboxedcontent,
%D    startboxedcontent, stopboxedcontent}
%D
%D This one is relatively new and will be used as a more robust test for inner
%D situations.

\newif  \ifboxedcontent
\newtoks\everyboxedcontent

\appendtoks
    \boxedcontenttrue
\to \everyboxedcontent

\unexpanded\def\startboxedcontent{\bgroup\the\everyboxedcontent}

\let\stopboxedcontent\egroup

%D We store some original meanings, maybe in \type {math-ini}.

\let\normalat   \at
\let\normalin   \in
\let\normalfrom \from
%let\normalover \over
\let\normalabout\about

%D This will be implemented way later:

\let\setlayoutcomponentattribute  \gobbleoneargument
\let\resetlayoutcomponentattribute\relax
\let\layoutcomponentboxattribute  \empty

\protect \endinput