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}{autosuffix} 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\permanent \protected\def\resetinjector [#1]{{#1}} 48\permanent \protected\def\markinjector [#1]{\dontleavehmode{#1}} 49\permanent\tolerant\protected\def\checkinjector [#1]#*[#2]{{#1}{#2}} 50\permanent \protected\def\checknextinjector [#1]{{#1}{\v!next}} 51\permanent \protected\def\checkpreviousinjector [#1]{{#1}{\v!previous}} 52%permanent \protected\def\checknextinjector [#1]{\clf_checknextinjector{#1}} 53%permanent \protected\def\checkpreviousinjector [#1]{\clf_checkpreviousinjector{#1}} 54\permanent\tolerant\protected\def\setinjector [#1]#*[#2]#*[#S#3]{{#1}{#2}{#3}} 55\permanent\tolerant\protected\def\showinjector [#1]{{#1}} 56 57\permanent\protected\def\domarkinjector#1#2% called at the lua end 58 {\dontleavehmode\llap{\infofont\ifcase#1\else\red\fi<#2>\quad}} 59 60% low level definers .. we could have \injectors_mark and \injectors_check and then 61% use \v!list instead of \s!list 62 63\permanent\protected\def\doinstallinjector#1% 64 {\gletcsname typo_injectors_mark_#1\endcsname\donothing 65 \gletcsname typo_injectors_check_#1\endcsname\donothing} 66 67\permanent\protected\def\doactivateinjector#1% used at lua end 68 {\protected\xdefcsname typo_injectors_mark_#1\endcsname{\dontleavehmode\noexpand{#1}}% 69 \protected\xdefcsname typo_injectors_check_#1\endcsname{\noexpand{#1}}} 70 71\permanent\protected\def\dotestinjector#1% only for testing outside unprotect 72 {\begincsname typo_injectors_check_#1\endcsname 73 \begincsname typo_injectors_mark_#1\endcsname} 74 75\protect \endinput 76 |