attr-eff.mkxl /size: 1928 b    last modification: 2023-12-21 09:44
1%D \module
2%D   [       file=attr-eff,
3%D        version=2007.06.06,
4%D          title=\CONTEXT\ Attribute Macros,
5%D       subtitle=Effects,
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 Attribute Macros / Effects}
15
16\registerctxluafile{attr-eff}{autosuffix}
17
18\unprotect
19
20\installcorenamespace{effect}
21
22\installcommandhandler \??effect {effect} \??effect
23
24\setupeffect
25  [\c!method=\v!none, % should become command or define or so
26   \c!stretch=\zerocount,
27   \c!rulethickness=\zeropoint,
28   \c!alternative=\v!normal]
29
30\appendtoks
31    \ifcstok{\effectparameter\c!method}\v!command
32        \frozen\protected\xdefcsname\e!start\currenteffect\endcsname{\starteffect[#1]}%
33        \frozen\protected\xdefcsname\e!stop \currenteffect\endcsname{\stopeffect}%
34    \fi
35\to \everydefineeffect
36
37\permanent\protected\def\starteffect[#1]%
38  {\clf_seteffect
39     alternative   {\namedeffectparameter{#1}\c!alternative}
40     stretch       \numexpr\namedeffectparameter{#1}\c!stretch\relax
41     rulethickness \dimexpr\namedeffectparameter{#1}\c!rulethickness\relax
42   \relax}
43
44\permanent\protected\def\stopeffect % can be special
45  {\clf_reseteffect} % v!normal 0 0
46
47\permanent\protected\def\effect[#1]%
48  {\groupedcommand{\starteffect[#1]}{\stopeffect}}
49
50% yes or no grouped
51
52\defineeffect [\v!inner]   [\c!alternative=\v!inner,\c!rulethickness=.25pt]
53\defineeffect [\v!outer]   [\c!alternative=\v!outer,\c!rulethickness=.25pt]
54\defineeffect [\v!both]    [\c!alternative=\v!both, \c!rulethickness=.25pt]
55\defineeffect [\v!normal]  [\c!alternative=\v!normal]
56\defineeffect [\v!hidden]  [\c!alternative=\v!hidden]
57\defineeffect [\v!stretch] [\c!alternative=\v!stretch,\c!stretch=1]
58
59\protect \endinput
60