1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Attribute Macros Effects}
15
16\registerctxluafile{attreff}{}
17
18\unprotect
19
20\installcorenamespace{effect}
21
22\installcommandhandler \??effect {effect} \??effect
23
24\setupeffect
25 [\c!method=\v!none,
26 \c!stretch=\zerocount,
27 \c!rulethickness=\zeropoint,
28 \c!alternative=\v!normal]
29
30\appendtoks
31 \edef\p_method{\effectparameter\c!method}
32 \ifx\p_method\v!command
33 \setuxvalue{\e!start\currenteffect}{\starteffect[#1]}
34 \setuxvalue{\e!stop \currenteffect}{\stopeffect}
35 \fi
36\to \everydefineeffect
37
38\unexpanded\def\starteffect[#1]
39 {\clf_seteffect
40 alternative {\namedeffectparameter{#1}\c!alternative}
41 stretch \numexpr\namedeffectparameter{#1}\c!stretch\relax
42 rulethickness \dimexpr\namedeffectparameter{#1}\c!rulethickness\relax
43 \relax}
44
45\unexpanded\def\stopeffect
46 {\clf_reseteffect}
47
48\unexpanded\def\effect[#1]
49 {\groupedcommand{\starteffect[#1]}{\stopeffect}}
50
51
52
53\defineeffect [\v!inner] [\c!alternative=\v!inner,\c!rulethickness=.25pt]
54\defineeffect [\v!outer] [\c!alternative=\v!outer,\c!rulethickness=.25pt]
55\defineeffect [\v!both] [\c!alternative=\v!both, \c!rulethickness=.25pt]
56\defineeffect [\v!normal] [\c!alternative=\v!normal]
57\defineeffect [\v!hidden] [\c!alternative=\v!hidden]
58\defineeffect [\v!stretch] [\c!alternative=\v!stretch,\c!stretch=1]
59
60\protect \endinput
61 |