attr-eff.mkiv /size: 1826 b    last modification: 2020-07-01 14:35
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}{}
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 % can be special
46  {\clf_reseteffect} % v!normal 0 0
47
48\unexpanded\def\effect[#1]%
49  {\groupedcommand{\starteffect[#1]}{\stopeffect}}
50
51% yes or no grouped
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