typo-inj.mkiv /size: 3435 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=typo-inj,
3%D        version=2014.10.13,
4%D          title=\CONTEXT\ Typesetting Macros,
5%D       subtitle=Triggering Actions,
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 Typesetting Macros / Triggering Actions}
15
16%D This is a sort of escape from too automatic typesetting of lists. I have
17%D been thinking fo a more generic injector for instance based on tags (as we
18%D already index each element) but thi sis sort of fuzzy because the number of a
19%D tag is not always incremented before we check for it. Also, registers and lists
20%D are among the few candidates that cannot be controlled directly by putting
21%D something in the input. So,m for the moment I stick to this mechanism but
22%D future versions of \CONTEXT\ might do it differently. Compatibility is not much
23%D of an issue here as this mechanism is only to be used in final production runs.
24
25\unprotect
26
27\registerctxluafile{typo-inj}{}
28
29% todo: no need in trialmode
30
31%D \showinjector
32%D
33%D \setinjector[register][3][\column]
34%D \setinjector[list]    [2][{\blank[3*big]}]
35%D
36%D \starttext
37%D     \placelist[section][criterium=text]
38%D     \blank[3*big]
39%D     \placeregister[index][criterium=text]
40%D     \page
41%D     \startsection[title=Alpha] first  \index{first}  \stopsection
42%D     \startsection[title=Beta]  second \index{second} \stopsection
43%D     \startsection[title=Gamma] third  \index{third}  \stopsection
44%D     \startsection[title=Delta] fourth \index{fourth} \stopsection
45%D \stoptext
46
47\unexpanded\def\resetinjector                [#1]{\clf_resetinjector{#1}}
48\unexpanded\def\markinjector                 [#1]{\dontleavehmode\clf_markinjector{#1}}
49\unexpanded\def\docheckinjector          [#1][#2]{\clf_checkinjector{#1}{#2}}
50\unexpanded\def\checknextinjector            [#1]{\clf_checkinjector{#1}{\v!next}}
51\unexpanded\def\checkpreviousinjector        [#1]{\clf_checkinjector{#1}{\v!previous}}
52%unexpanded\def\checknextinjector            [#1]{\clf_checknextinjector{#1}}
53%unexpanded\def\checkpreviousinjector        [#1]{\clf_checkpreviousinjector{#1}}
54\unexpanded\def\dosetinjector        [#1][#2][#3]{\clf_setinjector{#1}{#2}{#3}}
55\unexpanded\def\doshowinjector               [#1]{\clf_showinjector{#1}}
56
57\unexpanded\def\checkinjector{\dodoubleempty   \docheckinjector}
58\unexpanded\def\setinjector  {\dotripleargument\dosetinjector}
59\unexpanded\def\showinjector {\dosingleempty   \doshowinjector}
60
61\unexpanded\def\domarkinjector#1#2% called at the lua end
62  {\dontleavehmode\llap{\infofont\ifcase#1\else\red\fi<#2>\quad}}
63
64% low level definers .. we could have \injectors_mark and \injectors_check and then
65% use \v!list instead of \s!list
66
67\unexpanded\def\doinstallinjector#1%
68  {\letvalue{typo_injectors_mark_#1}\donothing
69   \letvalue{typo_injectors_check_#1}\donothing}
70
71\unexpanded\def\doactivateinjector#1% used at lua end
72  {\setuxvalue{typo_injectors_mark_#1}{\dontleavehmode\noexpand\clf_markinjector{#1}}%
73   \setuxvalue{typo_injectors_check_#1}{\noexpand\clf_checkinjector{#1}}}
74
75\unexpanded\def\dotestinjector#1%  only for testing outside unprotect
76  {\begincsname typo_injectors_check_#1\endcsname
77   \begincsname typo_injectors_mark_#1\endcsname}
78
79\protect \endinput
80
81