summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/workflows/workflows-injectors.tex
blob: d2f837d823665e95ba30a8d30bf35d8a36127d3b (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
% language=uk

\environment workflows-style

\startcomponent workflows-injectors

\startchapter[title={Injectors}]

When you have no control over the source but need to manually tweak some aspects
of the typesetting, like an occasional page break of column switch, you can use
the injector mechanism. This mechanism is part of list and register building but
can also be used elsewhere.

\startbuffer[one]
\startmixedcolumns[balance=yes]
  \dotestinjector{test}line 1 \par
  \dotestinjector{test}line 2 \par
  \dotestinjector{test}line 3 \par
  \dotestinjector{test}line 4 \par
  \dotestinjector{test}line 5
\stopmixedcolumns
\stopbuffer

\startbuffer[two]
\startmixedcolumns[balance=yes]
  \dotestinjector{test}line 1 \par
  \dotestinjector{test}line 2 \par
  \dotestinjector{test}line 3 \par
  \dotestinjector{test}line 4 \par
  \dotestinjector{test}line 5
\stopmixedcolumns
\stopbuffer

We have two buffers:

\typebuffer[one]

and

\typebuffer[two]

When typeset these come out as:

\blank \startpacked \bf \getbuffer[one] \stoppacked \blank

and

\blank \startpacked \bf \getbuffer[two] \stoppacked \blank

We can enable (and show) the injectors with:

\startbuffer
\doactivateinjector{test} \showinjector
\stopbuffer

\typebuffer \getbuffer

Now we get:

\blank \startpacked \bf \getbuffer[one] \stoppacked \blank

and

\blank \startpacked \bf \getbuffer[two] \stoppacked \blank

The small numbers are injector points. These will of course change when we add
more in|-|between. Let's add actions to some of the injection points:

\startbuffer
\setinjector[test][13][{\column}]
\setinjector[test][17][{\column}]
\stopbuffer

\typebuffer \getbuffer

As expected we now get column breaks:

\blank \startpacked \bf \getbuffer[one] \stoppacked \blank

and

\blank \startpacked \bf \getbuffer[two] \stoppacked \blank

\stopchapter

\stopcomponent