1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Page Macros Text Flows}
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\unprotect
58
59\installcorenamespace{textflow}
60\installcorenamespace{textflowbox}
61
62\installcommandhandler \??textflow {textflow} \??textflow
63
64\setuptextflow
65 [
66
67 \c!width=\availablehsize]
68
69\appendtoks
70 \ifcsname\??textflowbox\currenttextflow\endcsname
71 \setbox\csname\??textflowbox\currenttextflow\endcsname\emptybox
72 \else
73 \expandafter\newbox\csname\??textflowbox\currenttextflow\endcsname
74 \fi
75\to \everydefinetextflow
76
77\newinteger\b_page_textflow_box
78
79\permanent\def\textflowcollector#1
80 {\begincsname\??textflowbox#1\endcsname}
81
82\permanent\protected\def\doifelsetextflowcollector#1
83 {\ifcsname\??textflowbox#1\endcsname
84 \expandafter\firstoftwoarguments
85 \else
86 \expandafter\secondoftwoarguments
87 \fi}
88
89\permanent\protected\def\doifelsetextflow#1
90 {\unless\ifcsname\??textflowbox#1\endcsname
91 \expandafter\secondoftwoarguments
92 \orelse\ifvoid\csname\??textflowbox#1\endcsname
93 \expandafter\secondoftwoarguments
94 \else
95 \expandafter\firstoftwoarguments
96 \fi}
97
98\aliased\let\doiftextflowcollectorelse\doifelsetextflowcollector
99\aliased\let\doiftextflowelse \doifelsetextflow
100
101\permanent\protected\def\starttextflow[#1]
102 {\begingroup
103 \cdef\currenttextflow{#1}
104 \ifcsname\??textflowbox\currenttextflow\endcsname
105 \b_page_textflow_box\csname\??textflowbox\currenttextflow\endcsname
106 \global\setbox\b_page_textflow_box\vbox
107 \bgroup
108 \dontcomplain
109 \ifvoid\b_page_textflow_box\else
110 \unvbox\b_page_textflow_box
111 \fi
112 \hsize\textflowparameter\c!width\relax
113 \usetextflowstyleandcolor\c!style\c!color
114 \enforced\permanent\protected\def\stoptextflow{\endgraf\egroup\endgroup}
115 \else
116 \enforced\aliased\let\stoptextflow\endgroup
117 \fi}
118
119\aliased\let\stoptextflow\relax
120
121\permanent\protected\def\flushtextflow#1
122 {\begingroup
123 \cdef\currenttextflow{#1}
124 \ifcsname\??textflowbox\currenttextflow\endcsname
125 \b_page_textflow_box\csname\??textflowbox\currenttextflow\endcsname
126 \ifvoid\b_page_textflow_box
127
128 \orelse\ifdim\ht\b_page_textflow_box>\vsize
129 \setbox\scratchbox\vsplit\b_page_textflow_box to \vsize
130 \ifvoid\scratchbox\else
131 \unvbox\scratchbox
132 \fi
133 \else
134 \unvbox\b_page_textflow_box
135 \fi
136 \fi
137 \endgroup}
138
139\protect \endinput
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 |