1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Structure Macros Markings}
15
16\registerctxluafile{strcmar}{}
17
18\unprotect
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42\definesystemattribute [marks] [global]
43
44\installcorenamespace{marking}
45
46\installcommandhandler \??marking {marking} \??marking
47
48\newconditional\inhibitgetmarking
49\newconditional\inhibitsetmarking
50
51\newtoks \everymarking
52
53\unexpanded\def\relatemarking {\dodoubleempty \strc_markings_relate }
54\unexpanded\def\setmarking {\dosingleargument\strc_markings_set } \let\marking\setmarking
55\unexpanded\def\resetmarking {\dosingleargument\strc_markings_reset }
56\unexpanded\def\synchronizemarking{\dotripleargument\strc_markings_synchronize}
57
58\appendtoks
59 \clf_definemarking{\currentmarking}{\currentmarkingparent}
60\to \everydefinemarking
61
62\def\strc_markings_relate[#1][#2]
63 {\clf_relatemarking{#1}{#2}}
64
65\def\strc_markings_set[#1]#2
66 {\ifconditional\inhibitsetmarking
67
68 \else
69 \doifelse{\namedmarkingparameter{#1}\c!expansion}\v!yes
70 {\clf_setmarking{#1}{#2}}
71 {\clf_setmarking{#1}{\detokenize{#2}}}
72 \fi}
73
74\def\strc_markings_reset[#1]
75 {\clf_resetmarking{#1}}
76
77\def\strc_markings_synchronize[#1][#2][#3]
78 {\ifvoid#2\else\clf_synchronizemarking{#1}#2{#3}\fi}
79
80\def\doifelsemarking#1
81 {\clf_doifelsemarking{#1}}
82
83\let\doifmarkingelse \doifelsemarking
84
85
86
87
88
89
90
91\setupmarking
92 [\c!expansion=\v!no,
93 \c!separator=\space\emdash\space,
94 \c!filtercommand=\firstofoneargument,
95 \c!state=\v!start]
96
97
98
99\unexpanded\def\getmarking
100 {\ifconditional\inhibitgetmarking
101 \expandafter\dotripleargument\expandafter\strc_markings_get_nop
102 \else
103 \expandafter\dotripleargument\expandafter\strc_markings_get_yes
104 \fi}
105
106\def\strc_markings_get_nop[#1][#2][#3]
107 {}
108
109\def\strc_markings_get_yes[#1][#2][#3]
110 {\doif{\namedmarkingparameter{#1}\c!state}\v!start
111 {\begingroup
112 \setsystemmode\v!marking
113 \the\everymarking
114 \ifthirdargument
115 \clf_getmarking{#1}{#2}{#3}
116 \else
117 \clf_getmarking{#1}{\v!page}{#2}
118 \fi
119 \endgroup}}
120
121
122
123\def\fetchonemark[#1]#2[#3]{\ifconditional\inhibitgetmarking\else\clf_fetchonemark {#1}{\v!page}{#3}\fi}
124\def\fetchtwomarks [#1]{\ifconditional\inhibitgetmarking\else\clf_fetchtwomarks{#1}{\v!page}\fi}
125\def\fetchallmarks [#1]{\ifconditional\inhibitgetmarking\else\clf_fetchallmarks{#1}{\v!page}\fi}
126
127\let\fetchmark\fetchonemark
128
129
130
131\def\fetchonemarking[#1]#2[#3]#4[#5]{\ifconditional\inhibitgetmarking\else\clf_fetchonemark {#1}{#3}{#5}\fi}
132\def\fetchtwomarkings [#1]#2[#3]{\ifconditional\inhibitgetmarking\else\clf_fetchtwomarks{#1}{#3}\fi}
133\def\fetchallmarkings [#1]#2[#3]{\ifconditional\inhibitgetmarking\else\clf_fetchallmarks{#1}{#3}\fi}
134
135\let\fetchmarking\fetchonemarking
136
137\def\markingseparator#1{\namedmarkingparameter{#1}\c!separator}
138\def\markingcommand #1{\namedmarkingparameter{#1}\c!filtercommand}
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155\protect \endinput
156 |