blob: bf329482ed2fe82a1c992f7101420316439d3381 (
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
|
%D \module
%D [ file=typo-inj,
%D version=2014.10.13,
%D title=\CONTEXT\ Typesetting Macros,
%D subtitle=Triggering Actions,
%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 Typesetting Macros / Triggering Actions}
%D This is a sort of escape from too automatic typesetting of lists. I have
%D been thinking fo a more generic injector for instance based on tags (as we
%D already index each element) but thi sis sort of fuzzy because the number of a
%D tag is not always incremented before we check for it. Also, registers and lists
%D are among the few candidates that cannot be controlled directly by putting
%D something in the input. So,m for the moment I stick to this mechanism but
%D future versions of \CONTEXT\ might do it differently. Compatibility is not much
%D of an issue here as this mechanism is only to be used in final production runs.
\unprotect
\registerctxluafile{typo-inj}{}
% todo: no need in trialmode
%D \showinjector
%D
%D \setinjector[register][3][\column]
%D \setinjector[list] [2][{\blank[3*big]}]
%D
%D \starttext
%D \placelist[section][criterium=text]
%D \blank[3*big]
%D \placeregister[index][criterium=text]
%D \page
%D \startsection[title=Alpha] first \index{first} \stopsection
%D \startsection[title=Beta] second \index{second} \stopsection
%D \startsection[title=Gamma] third \index{third} \stopsection
%D \startsection[title=Delta] fourth \index{fourth} \stopsection
%D \stoptext
\permanent \protected\def\resetinjector [#1]{\clf_resetinjector{#1}}
\permanent \protected\def\markinjector [#1]{\dontleavehmode\clf_markinjector{#1}}
\permanent\tolerant\protected\def\checkinjector [#1]#*[#2]{\clf_checkinjector{#1}{#2}}
\permanent \protected\def\checknextinjector [#1]{\clf_checkinjector{#1}{\v!next}}
\permanent \protected\def\checkpreviousinjector [#1]{\clf_checkinjector{#1}{\v!previous}}
%permanent \protected\def\checknextinjector [#1]{\clf_checknextinjector{#1}}
%permanent \protected\def\checkpreviousinjector [#1]{\clf_checkpreviousinjector{#1}}
\permanent\tolerant\protected\def\setinjector [#1]#*[#2]#*[#3]{\clf_setinjector{#1}{#2}{#3}}
\permanent\tolerant\protected\def\showinjector [#1]{\clf_showinjector{#1}}
\permanent\protected\def\domarkinjector#1#2% called at the lua end
{\dontleavehmode\llap{\infofont\ifcase#1\else\red\fi<#2>\quad}}
% low level definers .. we could have \injectors_mark and \injectors_check and then
% use \v!list instead of \s!list
\permanent\protected\def\doinstallinjector#1%
{\gletcsname typo_injectors_mark_#1\endcsname\donothing
\gletcsname typo_injectors_check_#1\endcsname\donothing}
\permanent\protected\def\doactivateinjector#1% used at lua end
{\protected\xdefcsname typo_injectors_mark_#1\endcsname{\dontleavehmode\noexpand\clf_markinjector{#1}}%
\protected\xdefcsname typo_injectors_check_#1\endcsname{\noexpand\clf_checkinjector{#1}}}
\permanent\protected\def\dotestinjector#1% only for testing outside unprotect
{\begincsname typo_injectors_check_#1\endcsname
\begincsname typo_injectors_mark_#1\endcsname}
\protect \endinput
|