1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus
{
loading
}{
ConTeXt
Structure
Macros
Descriptions
}
15
16\unprotect
17
18\installcorenamespace
{
description
}
19
20\installcommandhandler
\??description
{
description
}
\??description
21
22\let
\setupdescriptions\setupdescription
23
24
25
26
27
28\setupdescription
29 [
\c!alternative
=
\v!left
,
30 \c!headstyle
=
\v!bold
,
31 \c!titlestyle
=
\v!bold
,
32
33
34
35
36 \c!width
=
7
\emwidth
,
37 \c!distance
=
\emwidth
,
38 \c!titledistance
=
.
5
\emwidth
,
39
40
41
42
43 \c!margin
=
\v!no
,
44 \c!before
=
\blank
,
45 \c!inbetween
=
\blank
,
46 \c!after
=
\blank
,
47 \c!indentnext
=
\v!yes
,
48 \c!indenting
=
\v!never
,
49 \c!titleleft
=(
,
50 \c!titleright
=)
,
51
52 \c!closecommand
=
\wordright
,
53 \c!display
=
\v!yes
,
54
55 \c!titlecommand
=
,
56 \c!expansion
=
\v!no
,
57
58
59 \c!title
=
\v!yes
,
60
61 ]
62
63\appendtoks
64 \ifx
\currentdescriptionparent
\empty
65 \defineconstruction
[
\currentdescription
][
\currentdescriptionparent
][
\s!handler
=
\v!description
,
\c!level
=
1
]
66 \else
67 \defineconstruction
[
\currentdescription
][
\s!handler
=
\v!description
,
\c!level
=
1
]
68 \fi
69 \setuevalue
{
\currentdescription
}{
\strc_descriptions_command
{
\currentdescription
}}
70 \setuevalue
{
\e!start
\currentdescription
}{
\strc_descriptions_start
{
\currentdescription
}}
71 \setuevalue
{
\e!stop
\currentdescription
}{
\strc_descriptions_stop
}
72\to
\everydefinedescription
73
74\let
\p_strc_constructions_title
\empty
75
76\unexpanded\setvalue
{
\??constructioninitializer\v!description
}
77 {
\let
\currentdescription
\currentconstruction
78 \let
\constructionparameter
\descriptionparameter
79 \let
\constructionnamespace
\??description
80 \let
\detokenizedconstructionparameter
\detokenizeddescriptionparameter
81 \let
\letconstructionparameter
\letdescriptionparameter
82 \let
\useconstructionstyleandcolor
\usedescriptionstyleandcolor
83 \let
\setupcurrentconstruction
\setupcurrentdescription
84 \edef
\p_strc_constructions_title
{
\constructionparameter
\c!title
}
85 \ifx
\p_strc_constructions_title
\v!yes
86 \settrue
\c_strc_constructions_title_state
87 \else
88 \setfalse
\c_strc_constructions_title_state
89 \fi
}
90
91
92
93
94
95
96
97
98
99
100
101\unexpanded
\def
\strc_descriptions_start
#
1
102 {
\begingroup
103 \strc_constructions_initialize
{
#
1
}
104 \doifelsenextoptionalcs
\strc_descriptions_start_yes
\strc_descriptions_start_nop
}
105
106\unexpanded
\def
\strc_descriptions_start_yes
[#
1
]
107 {
\doifelseassignment
{
#
1
}
\strc_descriptions_start_yes_assignment
\strc_descriptions_start_yes_reference
[#
1
]
}
108
109\unexpanded
\def
\strc_descriptions_start_yes_assignment
[#
1
]
110 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
,
\c!title
=
,
\c!bookmark
=
,
\c!list
=
,
#
1
]
111 \csname
\??constructionstarthandler
\currentconstructionhandler
\endcsname
}
112
113\unexpanded
\def
\strc_descriptions_start_yes_reference
114 {
\ifconditional
\c_strc_constructions_title_state
115 \expandafter
\strc_descriptions_start_yes_titled
116 \else
117 \expandafter
\strc_descriptions_start_yes_normal
118 \fi
}
119
120\unexpanded
\def
\strc_descriptions_start_yes_titled
[#
1
]
121 {
\doifelsenextbgroup
122 {
\strc_descriptions_start_yes_titled_indeed
[#
1
]
}
123 {
\setfalse
\c_strc_constructions_title_state
124 \strc_descriptions_start_yes_normal
[#
1
]
}}
125
126\unexpanded
\def
\strc_descriptions_start_yes_titled_indeed
[#
1
]#
2
127 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
{
#
1
}
,
\c!title
=
{
#
2
}
,
\c!bookmark
=
,
\c!list
=]
128 \csname
\??constructionstarthandler
\currentconstructionhandler
\endcsname
}
129
130\unexpanded
\def
\strc_descriptions_start_yes_normal
[#
1
]
131 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
{
#
1
}
,
\c!title
=
,
\c!bookmark
=
,
\c!list
=]
132 \csname
\??constructionstarthandler
\currentconstructionhandler
\endcsname
}
133
134\unexpanded
\def
\strc_descriptions_start_nop
135 {
\ifconditional
\c_strc_constructions_title_state
136 \expandafter
\strc_descriptions_start_nop_titled
137 \else
138 \expandafter
\strc_descriptions_start_nop_normal
139 \fi
}
140
141\unexpanded
\def
\strc_descriptions_start_nop_titled
142 {
\doifelsenextbgroup
143 {
\strc_descriptions_start_nop_titled_indeed
}
144 {
\setfalse
\c_strc_constructions_title_state
145 \strc_descriptions_start_nop_normal
}}
146
147\unexpanded
\def
\strc_descriptions_start_nop_titled_indeed
#
1
148 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
,
\c!title
=
{
#
1
}
,
\c!bookmark
=
,
\c!list
=]
149 \csname
\??constructionstarthandler
\currentconstructionhandler
\endcsname
}
150
151\unexpanded
\def
\strc_descriptions_start_nop_normal
152 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
,
\c!title
=
,
\c!bookmark
=
,
\c!list
=]
153 \csname
\??constructionstarthandler
\currentconstructionhandler
\endcsname
}
154
155\unexpanded
\def
\strc_descriptions_stop
156 {
\csname
\??constructionstophandler
\currentconstructionhandler
\endcsname
}
157
158
159
160
161\unexpanded
\def
\strc_descriptions_command
#
1
162 {
\begingroup
163 \strc_constructions_initialize
{
#
1
}
164 \doifelsenextoptionalcs
\strc_descriptions_yes
\strc_descriptions_nop
}
165
166\unexpanded
\def
\strc_descriptions_yes
167 {
\ifconditional
\c_strc_constructions_title_state
168 \expandafter
\strc_descriptions_yes_titled
169 \else
170 \expandafter
\strc_descriptions_yes_normal
171 \fi
}
172
173\unexpanded
\def
\strc_descriptions_yes_titled
[#
1
]#
2
174 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
{
#
1
}
,
\c!title
=
{
#
2
}
,
\c!bookmark
=
,
\c!list
=]
175 \csname
\??constructioncommandhandler
\currentconstructionhandler
\endcsname
}
176
177\unexpanded
\def
\strc_descriptions_yes_titled
[#
1
]
178 {
\doifelsenextbgroup
179 {
\strc_descriptions_yes_titled_indeed
[#
1
]
}
180 {
\setfalse
\c_strc_constructions_title_state
181 \strc_descriptions_yes_normal
[#
1
]
}}
182
183\unexpanded
\def
\strc_descriptions_yes_titled_indeed
[#
1
]#
2
184 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
{
#
1
}
,
\c!title
=
{
#
2
}
,
\c!bookmark
=
,
\c!list
=]
185 \csname
\??constructioncommandhandler
\currentconstructionhandler
\endcsname
}
186
187\unexpanded
\def
\strc_descriptions_yes_normal
[#
1
]
188 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
{
#
1
}
,
\c!title
=
,
\c!bookmark
=
,
\c!list
=]
189 \csname
\??constructioncommandhandler
\currentconstructionhandler
\endcsname
}
190
191\unexpanded
\def
\strc_descriptions_nop
192 {
\ifconditional
\c_strc_constructions_title_state
193 \expandafter
\strc_descriptions_nop_titled
194 \else
195 \expandafter
\strc_descriptions_nop_normal
196 \fi
}
197
198\unexpanded
\def
\strc_descriptions_nop_titled
199 {
\doifelsenextbgroup
200 {
\strc_descriptions_nop_titled_indeed
}
201 {
\setfalse
\c_strc_constructions_title_state
202 \strc_descriptions_nop_normal
}}
203
204\unexpanded
\def
\strc_descriptions_nop_titled_indeed
#
1
205 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
,
\c!title
=
{
#
1
}
,
\c!bookmark
=
,
\c!list
=]
206 \csname
\??constructioncommandhandler
\currentconstructionhandler
\endcsname
}
207
208\unexpanded
\def
\strc_descriptions_nop_normal
209 {
\strc_constructions_register
[][
\c!label
=
{
\descriptionparameter
\c!text
}
,
\c!reference
=
,
\c!title
=
,
\c!bookmark
=
,
\c!list
=]
210 \csname
\??constructioncommandhandler
\currentconstructionhandler
\endcsname
}
211
212
213
214\expandafter\let\csname
\??constructionmainhandler
\v!description
\expandafter\endcsname\csname
\??constructionmainhandler
\v!construction
\endcsname
215\expandafter\let\csname
\??constructioncommandhandler\v!description
\expandafter\endcsname\csname
\??constructioncommandhandler\v!construction
\endcsname
216\expandafter\let\csname
\??constructiontexthandler
\v!description
\expandafter\endcsname\csname
\??constructiontexthandler
\v!construction
\endcsname
217
218\unexpanded\setvalue
{
\??constructioncommandhandler\v!description
}
219 {
\dowithpar
220 {
\csname
\??constructionstarthandler\v!construction
\endcsname
}
221 {
\csname
\??constructionstophandler
\v!construction
\endcsname\endgroup
}}
222
223\unexpanded\setvalue
{
\??constructionstarthandler\v!description
}
224 {
\dogotopar
225 {
\csname
\??constructionstarthandler\v!construction
\endcsname
}}
226
227\unexpanded\setvalue
{
\??constructionstophandler\v!description
}
228 {
\csname
\??constructionstophandler\v!construction
\endcsname
229 \endgroup
}
230
231
232
233\definedescription
234 [
tab
]
235 [
\c!alternative
=
\v!left
,
236 \c!headstyle
=
\v!normal
,
237 \c!headcolor
=
,
238 \c!style
=
\v!normal
,
239 \c!color
=
,
240 \c!width
=
\v!broad
,
241 \c!sample
=
\kern
4
\emwidth
,
242 \c!before
=
,
243 \c!after
=]
244
245\unexpanded
\def
\setuptab
246 {
\setupdescription
[
tab
]
}
247
248
249
250\protect
\endinput
251