summaryrefslogtreecommitdiff
path: root/tex/context/base/attr-eff.mkiv
blob: f4b05a14ec9e7f16949408c35fa72edf1e2db6e4 (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
%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]
%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

\def\registereffect#1#2#3% #2=stretch #3=rulethickness
  {\setxvalue{(es:#1:#2:\number\dimexpr#3\relax)}%
     {\attribute\effectattribute\ctxlua{tex.write(attributes.effects.register('#1',#2,\number\dimexpr#3\relax))}\relax}}

\def\dotriggereffect
  {\ctxlua{attributes.effects.enable()}%
   \gdef\dotriggereffect##1##2##3%
     {\ifcsname(es:##1:##2:\number\dimexpr##3\relax)\endcsname\else\registereffect{##1}{##2}{##3}\fi
      \csname(es:##1:##2:\number\dimexpr##3\relax)\endcsname}%
   \dotriggereffect}

% \registereffect{normal}
% \registereffect{inner}
% \registereffect{outer}
% \registereffect{both}
% \registereffect{hidden}

\protect \endinput