page-str.mkxl /size: 3987 b    last modification: 2025-02-21 11:03
1%D \module
2%D   [       file=page-str,
3%D        version=2010.03.13, % 2006.03.21,
4%D          title=\CONTEXT\ Page Macros,
5%D       subtitle=Page Streams,
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\writestatus{loading}{ConTeXt Page Macros / Page Streams}
15
16%D The first version of this component of \CONTEXT\ was written for Thomas Schmitz
17%D who asked for parallel page streams. While playing with the code, I decided to
18%D make it into a component that can be used to construct all kind of stream related
19%D mechanisms. Because I could apply this feature in a project, there is some
20%D additional code here (related to graphics).
21%D
22%D These macros were written while listening to and watching the DVD \quotation
23%D {Rush In Rio}.
24%D
25%D The reimplementation (or rather experimenting with the complete rewrite) was done
26%D while looping over \quotation {Wende Snijders No.9}.
27%D
28%D This mechanism is sort of obsolete. Take a look at columnsets with sub streams
29%D and such.
30
31\registerctxluafile{page-str}{autosuffix}
32
33\unprotect
34
35\mutable\lettonothing\currentoutputstream
36
37\newif   \ifinoutputstream        % will become a conditional or mode
38\newtoks \everyenableoutputstream
39
40\appendtoks
41    \page_otr_command_flush_side_floats
42\to \everyenableoutputstream
43
44\permanent\protected\def\initializeoutputstreams
45  {\clf_initializestream
46   \enforced\glet\initializeoutputstreams\relax}
47
48\permanent\protected\def\enableoutputstream[#1]% could be \startoutputsubstream
49  {\initializeoutputstreams
50   \expand\everyenableoutputstream
51   \inoutputstreamtrue
52   \xdef\currentoutputstream{#1}%
53   \clf_enablestream{#1}
54   \prevdepth\zeropoint} % maybe more is needed i.e. we need to get rid of leading glue
55
56\permanent\protected\def\disableoutputstream
57  {\inoutputstreamfalse
58   \glet\currentoutputstream\s!default
59   \clf_disablestream}
60
61\permanent\protected\def\startoutputstream[#1]%
62  {\begingroup
63   \initializeoutputstreams
64   \expand\everyenableoutputstream
65   \inoutputstreamtrue
66   \xdef\currentoutputstream{#1}%
67   \clf_startstream{#1}}
68
69\permanent\protected\def\stopoutputstream
70  {\clf_stopstream
71   \endgroup}
72
73\permanent\protected\def\startoutputsubstream[#1]% just push/pop instead
74  {\globalpushmacro\currentoutputstream
75   \enableoutputstream[#1]}
76
77\permanent\protected\def\stopoutputsubstream
78  {\globalpopmacro\currentoutputstream
79   \enableoutputstream[\currentoutputstream]}
80
81\permanent         \protected\def\flushoutputstream  [#1]{\clf_flushstream{#1}}
82\permanent         \protected\def\outputstreambox    [#1]{\vbox{\clf_flushstream{#1}}}
83\permanent         \protected\def\outputstreamcopy   [#1]{\vbox{\clf_flushstreamcopy{#1}}}
84\permanent         \protected\def\outputstreamunvbox [#1]{\clf_flushstream{#1}}
85\permanent         \protected\def\outputstreamunvcopy[#1]{\clf_flushstreamcopy{#1}}
86\permanent         \protected\def\synchronizestreams [#1]{\clf_synchronizestream{#1}}
87\permanent\tolerant\protected\def\pushoutputstream   [#1]{\clf_pushstream{#1}}
88
89\protect \endinput
90
91% \enabletrackers[streams.flushing]
92%
93% \setuplayout[grid=yes] \showgrid
94%
95% \starttext
96%
97% \input tufte
98%
99% \startoutputstream[nl]
100%
101% Wat doen we hier?
102%
103% \enableoutputstream[en]
104%
105% Are you sleeping, brother John?\footnote{xxx}
106%
107% \dorecurse{4}{x \footnote{note \recurselevel}\input tufte \par \pushoutputstream}
108%
109% \enableoutputstream[de]
110%
111% Bruder Jakob, schläfst du noch?\footnote{yyy}
112%
113% \dorecurse{4}{x \footnote{note \recurselevel}\input ward \par \pushoutputstream}
114%
115% \disableoutputstream
116%
117% \stopoutputstream
118%
119% Vader Jacob, slaap je nog?\footnote{zzz}
120%
121% \input tufte
122%
123% \synchronizestreams[en,de,nl]
124%
125% \page \flushoutputstream[en] \input knuth
126% \page \flushoutputstream[de] \input knuth
127% \page \flushoutputstream[nl] \input knuth
128%
129% \stoptext
130