summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/attr-eff.mkiv
blob: bec8687ead5005c221b51e11b20f9047afb3f28e (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
%D \module
%D   [       file=attr-eff,
%D        version=2007.06.06,
%D          title=\CONTEXT\ Attribute Macros,
%D       subtitle=Effects,
%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 Attribute Macros / Effects}

\registerctxluafile{attr-eff}{1.001}

\unprotect

\installcorenamespace{effect}

\installcommandhandler \??effect {effect} \??effect

\setupeffect
  [\c!method=\v!none,
   \c!stretch=\zerocount,
   \c!rulethickness=\zeropoint,
   \c!alternative=\v!normal]

\appendtoks
    \edef\p_method{\effectparameter\c!method}%
    \ifx\p_method\v!method
        \setuxvalue{\e!start\currenteffect}{\starteffect[#1]}%
        \setuxvalue{\e!stop \currenteffect}{\stopeffect}%
    \fi
\to \everydefineeffect

\unexpanded\def\starteffect[#1]%
  {\clf_seteffect
     alternative   {\namedeffectparameter{#1}\c!alternative}
     stretch       \numexpr\namedeffectparameter{#1}\c!stretch\relax
     rulethickness \dimexpr\namedeffectparameter{#1}\c!rulethickness\relax
   \relax}

\unexpanded\def\stopeffect % can be special
  {\clf_reseteffect} % v!normal 0 0

\unexpanded\def\effect[#1]%
  {\groupedcommand{\starteffect[#1]}{\stopeffect}}

% yes or no grouped

\defineeffect [\v!inner]   [\c!alternative=\v!inner,\c!rulethickness=.25pt]
\defineeffect [\v!outer]   [\c!alternative=\v!outer,\c!rulethickness=.25pt]
\defineeffect [\v!both]    [\c!alternative=\v!both, \c!rulethickness=.25pt]
\defineeffect [\v!normal]  [\c!alternative=\v!normal]
\defineeffect [\v!hidden]  [\c!alternative=\v!hidden]
\defineeffect [\v!stretch] [\c!alternative=\v!stretch,\c!stretch=1]

\protect \endinput