strc-syn.mkiv /size: 19 Kb    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=strc-syn,
3
%D version=2008.10.20,
4
%D title=\CONTEXT\ Structure Macros,
5
%D subtitle=Synonyms and Sorting,
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
Structure
Macros
/
Synonyms
and
Sorting
}
15 16
\registerctxluafile
{
strc
-
syn
}{}
17 18
%D Although we could nowadays build this on top of regular lists we keep this
19
%D more efficient variant around. Eventually we can add some options to lists
20
%D that also provide such functionality but at the cost of much more overhead.
21
%D
22
%D We show a usage of both synonyms and sorts, which are deep down variants of
23
%D so called simple lists. A definition looks like this:
24
%D
25
%D \startbuffer
26
%D \definesynonyms
27
%D [myabbreviation]
28
%D
29
%D \setupsynonyms
30
%D [myabbreviation]
31
%D [headstyle=bold,
32
%D headcolor=darkred,
33
%D synonymstyle=boldslanted,
34
%D synonymcolor=darkblue,
35
%D textstyle=slanted,
36
%D textcolor=darkgreen,
37
%D style=normal,
38
%D color=darkyellow]
39
%D
40
%D \definesorting
41
%D [mylogo]
42
%D
43
%D \setupsorting
44
%D [mylogo]
45
%D [style=bold,
46
%D color=darkmagenta]
47
%D \stopbuffer
48
%D
49
%D \typebuffer \getbuffer
50
%D
51
%D More complex definitions involves commands to call up meanings and such. The
52
%D use of the defined commands is as follows: \
53
%D
54
%D \startbuffer
55
%D \myabbreviation [FIRST] {TheFirst} {The First Words}
56
%D \myabbreviation [SECOND] {TheSecond} {The Second Words}
57
%D \myabbreviation [THIRD] {TheThird} {The Third Words}
58
%D
59
%D \mylogo [FOURTH] {TheFourth}
60
%D \stopbuffer
61
%D
62
%D \typebuffer \getbuffer
63
%D
64
%D By default a synonym is just typeset and flagges as being used, so that in
65
%D a list it wil be shows with its meaning. You can however also expand the
66
%D meaning automatically at first use:
67
%D
68
%D \startbuffer
69
%D \setupsynonyms[myabbreviation][alternative=first]
70
%D
71
%D We have \FIRST, \SECOND\ and also \THIRD\ but no \FOURTH.
72
%D
73
%D We have \FIRST, \SECOND\ and also \THIRD\ but no \FOURTH.
74
%D \stopbuffer
75
%D
76
%D \typebuffer \getbuffer
77
%D
78
%D We can change the order, as demonstrated in:
79
%D
80
%D \startbuffer
81
%D \resetshownsynonyms[myabbreviation]
82
%D
83
%D \setupsynonyms[myabbreviation][alternative=last]
84
%D
85
%D We have \FIRST\ and \THIRD\ or \FOURTH.
86
%D
87
%D We have \FIRST\ and \THIRD\ or \FOURTH.
88
%D \stopbuffer
89
%D
90
%D \typebuffer \getbuffer
91
%D
92
%D A list is called up with:
93
%D
94
%D \startbuffer
95
%D \placelistofsynonyms[myabbreviation]
96
%D
97
%D \placelistofsorts[mylogo]
98
%D \stopbuffer
99
%D
100
%D \typebuffer \getbuffer
101
%D
102
%D The lists are constructions (like descriptions are) and can be set up
103
%D likewise.
104 105
% todo: add 'define only' option to descriptions, then add sorting (also based on key)
106
% and call to definition -> replaces this module
107 108
\unprotect
109 110
% split but common in lua
111 112
\def
\preprocessexpansion
#
1
#
2
#
3
#
4
% do this at the lua end if still needed
113
{
\ifx
#
1
\s!xml
114
\xmlstartraw
115
\xdef
#
2
{
#
4
}
%
116
\xmlstopraw
117
\glet
#
3
\s!xml
118
\else
119
\ifx
#
1
\v!yes
120
\xdef
#
2
{
#
4
}
%
121
\else
122
\xdef
#
2
{
\detokenize
{
#
4
}}
%
123
\fi
124
\glet
#
3
\s!tex
125
\fi
}
126 127
%D We now use a simple list variant:
128 129
\installcorenamespace
{
simplelist
}
130 131
\installcommandhandler
\??simplelist
{
simplelist
}
\??simplelist
132 133
\let
\setupsimplelists
\setupsimplelist
134 135
\setupsimplelists
[
%
136
%c!title=,
137
%c!text=,
138
%
139
%c!style=,
140
%c!color=,
141
%c!command=,
142
%c!align=,
143
%
144
%c!headstyle=,
145
%c!headcolor=,
146
%c!headalign=,
147
%
148
%c!titlestyle=,
149
%c!titlecolor=,
150
%c!titlecommand=,
151
%c!titleleft=,
152
%c!titleright=,
153
%
154
%c!closesymbol=,
155
%c!closecommand=,
156
%
157
\c!alternative
=
\v!left
,
158
\c!display
=
\v!yes
,
159
\c!width
=
7
\emwidth
,
160
\c!distance
=
\emwidth
,
161
\c!titledistance
=
.
5
\emwidth
,
162
%c!hang=,
163
%c!sample=,
164
\c!margin
=
\v!no
,
165
\c!before
=
\startpacked
,
166
\c!inbetween
=
\blank
,
167
\c!after
=
\stoppacked
,
168
%c!indentnext=,
169
%c!indenting=,
170
%
171
\c!expansion
=
\v!no
,
172
%c!xmlsetup=,
173
%s!catcodes=,
174
\s!language
=
\currentmainlanguage
,
175
]
176 177
\appendtoks
178
\setfalse
\c_strc_constructions_define_commands
179
\ifx
\currentsimplelistparent
\empty
180
\defineconstruction
[
\currentsimplelist
][
\s!handler
=
\v!simplelist
,
\c!level
=
1
]
%
181
\else
182
\defineconstruction
[
\currentsimplelist
][
\currentsimplelistparent
][
\s!handler
=
\v!simplelist
,
\c!level
=
1
]
%
183
\fi
184
\settrue
\c_strc_constructions_define_commands
185
\to
\everydefinesimplelist
186 187
\setuvalue
{
\??constructioninitializer\v!simplelist
}
%
188
{
\let
\currentsimplelist
\currentconstruction
189
\let
\constructionparameter
\simplelistparameter
190
\let
\constructionnamespace
\??simplelist
191
\let
\detokenizedconstructionparameter
\detokenizedsimplelistparameter
192
\let
\letconstructionparameter
\letsimplelistparameter
193
\let
\useconstructionstyleandcolor
\usesimpleliststyleandcolor
194
\let
\setupcurrentconstruction
\setupcurrentsimplelist
}
195 196
\setuvalue
{
\??constructionfinalizer\v!simplelist
}
%
197
{}
198 199
\setuvalue
{
\??constructiontexthandler\v!simplelist
}
%
200
{
\begingroup
201
\useconstructionstyleandcolor
\c!headstyle\c!headcolor
202
\the
\everyconstruction
203
\constructionparameter
\c!headcommand
204
{
\strut
205
\currentsimplelistentry
}
%
206
\endgroup
}
207 208
% And we build on top of this.
209 210
\ifdefined
\dotagsynonym
\else
\let
\dotagsynonym
\relax
\fi
211
\ifdefined
\dotagsorting
\else
\let
\dotagsorting
\relax
\fi
212 213
\definesimplelist
214
[
\v!synonym
]
215
[
\c!state
=
\v!start
,
216
%\c!synonymstyle=,
217
%\c!textstyle=,
218
%\c!headstyle=,
219
%\c!headcolor=,
220
%\c!criterium=,
221
\c!location
=
\v!left
,
222
\c!width
=
5
\emwidth
,
223
\c!distance
=
\zeropoint
,
224
%\c!sample=,
225
%\c!hang=,
226
%\c!align=,
227
%\c!before=,
228
%\c!inbetween=,
229
%\c!after=,
230
\c!indentnext
=
\v!no
,
231
%\c!expansion=,
232
\c!method
=]
233 234
\let
\setupsynonyms
\setupsimplelist
235 236
\unexpanded
\def
\definesynonyms
237
{
\doquadrupleempty
\strc_synonyms_define
}
238 239
\def
\strc_synonyms_define
[#
1
][#
2
][#
3
][#
4
]
% name plural \meaning \use
240
{
\edef
\currentsynonym
{
#
1
}
%
241
\iffourthargument
242
\unexpanded
\def
#
4
##
1
{
\strc_synonyms_insert
{
#
1
}{
##
1
}}
% name tag
243
\ifthirdargument
244
\unexpanded
\def
#
3
##
1
{
\strc_synonyms_insert_meaning
{
#
1
}{
##
1
}}
% \meaning
245
\fi
246
\setuvalue
{
#
1
}{
\definesynonym
[
\v!no
][#
1
]
}
% \name
247
\else
248
\ifthirdargument
249
\unexpanded
\def
#
3
##
1
{
\strc_synonyms_insert_meaning
{
#
1
}{
##
1
}}
% \meaning
250
\fi
251
\setuvalue
{
#
1
}{
\definesynonym
[
\v!yes
][#
1
]
}
% \name
252
\fi
253
%
254
% \checksynonymparent
255
% \setupcurrentsynonym[\s!single={#1},\s!multi={#2}]%
256
\setfalse
\c_strc_constructions_define_commands
257
\definesimplelist
258
[
\currentsynonym
]
%
259
[
\v!sorting
]
260
[
\s!single
=
{
#
1
}
,
%
261
\s!multi
=
{
#
2
}
]
%
262
\settrue
\c_strc_constructions_define_commands
263
%
264
\presetheadtext
[#
2
=
\Word
{
#
2
}
]
% changes the \if...argument
265
%
266
\setvalue
{
\e!setup
#
2
\e!endsetup
}{
\setupsynonyms
[#
1
]
}
% obsolete definition
267
\setvalue
{
\e!place
\e!listof
#
2
}{
\placelistofsynonyms
[#
1
]
}
% accepts extra argument
268
\setvalue
{
\e!complete\e!listof
#
2
}{
\completelistofsynonyms
[#
1
]
}}
269 270
\unexpanded
\def
\definesynonym
271
{
\dotripleempty
\strc_synonyms_define_entry
}
272 273
\def
\strc_synonyms_define_entry
[#
1
][#
2
][#
3
]#
4
#
5
%
274
{
\begingroup
275
\edef
\currentsynonym
{
#
2
}
%
276
\edef
\currentsynonymtag
{
#
3
}
%
277
\let
\currentsimplelist
\currentsynonym
278
\ifx
\currentsynonymtag
\empty
279
\edef
\currentsynonymtag
{
#
4
}
%
280
\fi
281
\ifx
\currentsynonymtag
\empty
282
% todo: error message
283
\else
284
% this is not that efficient, esp when we load a big list
285
\edef
\currentsynonymexpansion
{
\simplelistparameter
\c!expansion
}
%
286
\preprocessexpansion
\currentsynonymexpansion
\m_synonyms_text
\currentsynonymcoding
{
#
4
}
%
287
\preprocessexpansion
\currentsynonymexpansion
\m_synonyms_meaning
\currentsynonymcoding
{
#
5
}
%
288
%
289
\clf_registersynonym
290
{
\currentsynonym
}
%
291
{
synonym
}
%
292
{
%
293
metadata
{
%
294
catcodes
\catcodetable
295
coding
{
\currentsynonymcoding
}
%
296
\ifx
\currentsynonymcoding
\s!xml
297
xmlroot
{
\xmldocument
}
%
298
\fi
299
}
%
300
definition
{
%
301
tag
{
\currentsynonymtag
}
%
302
synonym
{
\m_synonyms_text
}
%
303
meaning
{
\m_synonyms_meaning
}
%
304
% used false
305
}
%
306
}
%
307
\relax
308
\doif
{
#
1
}
\v!yes
{
\setuxvalue
\currentsynonymtag
{
\strc_synonyms_insert
{
\currentsynonym
}{
\currentsynonymtag
}}}
%
309
\fi
310
\endgroup
}
311 312
\unexpanded
\def
\registersynonym
313
{
\dodoubleargument
\strc_synonyms_register
}
314 315
\def
\strc_synonyms_register
[#
1
][#
2
]
%
316
{
\clf_registerusedsynonym
{
#
1
}{
#
2
}}
317 318
\unexpanded
\def
\currentsynonymname
{
\clf_synonymname
{
\currentsimplelist
}{
\currentsynonymtag
}}
319
\unexpanded
\def
\currentsynonymmeaning
{
\clf_synonymmeaning
{
\currentsimplelist
}{
\currentsynonymtag
}}
320
\unexpanded
\def
\doifelsecurrentsynonymused
{
\clf_doifelsesynonymused
{
\currentsimplelist
}{
\currentsynonymtag
}}
321
\unexpanded
\def
\doifelsecurrentsynonymshown
{
\clf_doifelsesynonymshown
{
\currentsimplelist
}{
\currentsynonymtag
}}
322
\unexpanded
\def
\resetusedsynonyms
[#
1
]
{
\clf_resetusedsynonyms
{
#
1
}}
323
\unexpanded
\def
\resetshownsynonyms
[#
1
]
{
\clf_resetshownsynonyms
{
#
1
}}
324 325
\let
\rawsynonymname
\clf_synonymname
326
\let
\rawsynonymmeaning
\clf_synonymmeaning
327 328
\installcorenamespace
{
simplelistalternative
}
% specific ways of rendering a list
329
\installcorenamespace
{
simplelistrenderings
}
% a namespace for setups (rather local)
330 331
\installcommandhandler
\??simplelistalternative
{
simplelistalternative
}
\??simplelistalternative
332 333
\setupsimplelist
334
[
\v!synonym
]
335
[
\c!alternative
=
\v!normal
]
336 337
\unexpanded
\def
\strc_synonyms_insert_meaning
#
1
#
2
% name tag
338
{
\dontleavehmode
% otherwise we don't get it right at the beginning of a par
339
\begingroup
340
\def
\currentsimplelist
{
#
1
}
%
341
\def
\currentsynonymtag
{
#
2
}
%
342
\fastsetup
{
\??simplelistrenderings
:
:
\v!text
}
%
343
\endgroup
}
344 345
\unexpanded
\def
\strc_synonyms_insert
#
1
#
2
% name tag
346
{
\dontleavehmode
% otherwise we don't get it right at the beginning of a par
347
\begingroup
348
\edef
\currentsimplelist
{
#
1
}
%
349
\let
\currentsynonym
\currentsimplelist
% for a while
350
\def
\currentsynonymtag
{
#
2
}
%
351
\edef
\currentsimplelistalternative
{
\simplelistparameter
\c!alternative
}
%
352
\doifnotcommandhandler
\??simplelistalternative
\currentsimplelistalternative
353
{
\let
\currentsimplelistalternative
\v!normal
}
%
354
\fastsetup
{
\??simplelistrenderings
:
\v!synonym
:
\currentsimplelistalternative
}
%
355
\normalexpanded
{
\endgroup
\simplelistparameter
\c!next
}}
356 357
% \setupsimplelistalternative
358
% [\c!command=\directsimplelistparameter\c!command]
359 360
\definesimplelistalternative
361
[
\v!normal
]
362
[
\c!inbetween
=
\space
,
363
\c!left
=(
,
364
\c!right
=)]
365 366
\definesimplelistalternative
367
[
\v!first
]
368
[
\v!normal
]
369 370
\definesimplelistalternative
371
[
\v!last
]
372
[
\v!normal
]
373 374
\startsetups
[
\??simplelistrenderings
:
:
\v!synonym
]
375
\begingroup
376
\dostarttaggedchained
\t!synonym
\currentsynonym
\??simplelist
377
\dotagsynonym
378
\usesimpleliststyleandcolor
\c!synonymstyle\c!synonymcolor
379
\simplelistparameter
\c!synonymcommand
{
\currentsynonymname
}
%
380
\dostoptagged
381
\endgroup
382
\stopsetups
383 384
\startsetups
[
\??simplelistrenderings
:
:
\v!text
]
385
\begingroup
386
\usesimpleliststyleandcolor
\c!textstyle\c!textcolor
387
\simplelistparameter
\c!textcommand
{
\currentsynonymmeaning
}
%
388
\endgroup
389
\stopsetups
390 391
\startsetups
[
\??simplelistrenderings
:
\v!synonym
:
\v!normal
]
392
\fastsetup
{
\??simplelistrenderings
:
:
\v!synonym
}
393
\stopsetups
394 395
\startsetups
[
\??simplelistrenderings
:
\v!synonym
:
\v!first
]
396
\fastsetup
{
\??simplelistrenderings
:
:
\v!synonym
}
397
\doifelsecurrentsynonymshown
\donothing
{
398
\simplelistalternativeparameter
\c!inbetween
399
\simplelistalternativeparameter
\c!left
400
\fastsetup
{
\??simplelistrenderings
:
:
\v!text
}
401
\simplelistalternativeparameter
\c!right
402
}
403
\stopsetups
404 405
\startsetups
[
\??simplelistrenderings
:
\v!synonym
:
\v!last
]
406
\doifelsecurrentsynonymshown
{
407
\fastsetup
{
\??simplelistrenderings
:
:
\v!synonym
}
408
}
{
409
\fastsetup
{
\??simplelistrenderings
:
:
\v!text
}
410
\simplelistalternativeparameter
\c!inbetween
411
\simplelistalternativeparameter
\c!left
412
\fastsetup
{
\??simplelistrenderings
:
:
\v!synonym
}
413
\simplelistalternativeparameter
\c!right
414
}
415
\stopsetups
416 417
\unexpanded
\def
\placelistofsynonyms
418
{
\dodoubleempty
\strc_synonyms_place_list
}
419 420
\def
\strc_synonyms_place_list
[#
1
][#
2
]
%
421
{
\begingroup
422
\edef
\currentsimplelist
{
#
1
}
%
423
\doifelsecommandhandler
\??simplelist
\currentsimplelist
424
{
\strc_constructions_initialize
{
#
1
}
%
425
\setupcurrentsimplelist
[#
2
]
%
426
\let
\synonymentry
\strc_synonym_normal
427
% so we can hook tabulate into before and after
428
\normalexpanded
{
\simplelistparameter
\c!before
429
\noexpand
\clf_processsynonyms
430
{
#
1
}
%
431
{
%
432
criterium
{
\simplelistparameter
\c!criterium
}
%
433
language
{
\simplelistparameter
\s!language
}
%
434
method
{
\simplelistparameter
\c!method
}
%
435
}
%
436
\relax
437
\simplelistparameter
\c!after
}
%
438
\relax
}
%
439
{}
% todo: message that invalid
440
\endgroup
}
441 442
\def
\completelistofsynonyms
443
{
\dodoubleempty
\strc_synonyms_complete_list
}
444 445
\def
\strc_synonyms_complete_list
[#
1
][#
2
]
%
446
{
\begingroup
447
\edef
\currentsimplelist
{
#
1
}
%
448
\doifelsecommandhandler
\??simplelist
\currentsimplelist
449
{
\normalexpanded
{
\startnamedsection
[
\v!chapter
][
\c!title
=
{
\headtext
{
\simplelistparameter
\s!multi
}}
,
\c!reference
=#
1
]
}
%
450
\strc_synonyms_place_list
[#
1
][#
2
]
%
451
\page
452
\stopnamedsection
}
%
453
{}
% todo: message that invalid
454
\endgroup
}
455 456
\unexpanded
\def
\strc_synonym_normal
#
1
#
2
#
3
#
4
%
457
{
\begingroup
458
\def
\currentsimplelistentry
{
#
3
}
%
459
\csname
\??constructionstarthandler\v!construction
\endcsname
460
#
4
%
461
\csname
\??constructionstophandler\v!construction
\endcsname
462
\endgroup
}
463 464
%D Sorting (a simplified version of synonym).
465 466
\definesimplelist
467
[
\v!sorting
]
468
[
\c!state
=
\v!start
,
469
%\c!command=, % we test for defined !
470
%\c!criterium=,
471
%\c!style=,
472
\c!before
=
\startpacked
,
473
\c!after
=
\stoppacked
,
474
%\c!expansion=,
475
\c!method
=]
476 477
\let
\setupsorting
\setupsimplelist
478 479
\unexpanded
\def
\definesorting
480
{
\dotripleempty
\strc_sorting_define
}
481 482
% if #3=\relax or \v!none, then no command but still protected
483 484
\def
\strc_sorting_define
[#
1
][#
2
][#
3
]
%
485
{
\edef
\currentsorting
{
#
1
}
%
486
\ifthirdargument
487
\doifnot
{
#
3
}
\v!none
488
{
\ifx
#
3
\relax
\else
489
\unexpanded
\def
#
3
##
1
{
\strc_sorting_insert
{
#
1
}{
##
1
}}
%
490
\fi
}
%
491
\setuvalue
{
#
1
}{
\definesort
[
\v!no
][#
1
]
}
%
492
\else
493
\setuvalue
{
#
1
}{
\definesort
[
\v!yes
][#
1
]
}
%
494
\fi
495
\setfalse
\c_strc_constructions_define_commands
496
\definesimplelist
497
[
\currentsorting
]
%
498
[
\v!sorting
]
499
[
\s!single
=
{
#
1
}
,
%
500
\s!multi
=
{
#
2
}
]
%
501
\settrue
\c_strc_constructions_define_commands
502
%
503
\presetheadtext
[#
2
=
\Word
{
#
2
}
]
% after \ifthirdargument -)
504
%
505
\setvalue
{
\e!setup
#
2
\e!endsetup
}{
\setupsorting
[#
1
]
}
% obsolete definition
506
\setvalue
{
\e!place
\e!listof
#
2
}{
\placelistofsorts
[#
1
]
}
%
507
\setvalue
{
\e!complete\e!listof
#
2
}{
\completelistofsorts
[#
1
]
}}
508 509
\unexpanded
\def
\definesort
510
{
\dotripleempty
\strc_sorting_define_entry
}
511 512
\def
\strc_sorting_define_entry
[#
1
][#
2
][#
3
]#
4
%
513
{
\begingroup
514
\edef
\currentsorting
{
#
2
}
%
515
\edef
\currentsortingtag
{
#
3
}
%
516
\let
\currentsimplelist
\currentsimplelist
517
\ifx
\currentsortingtag
\empty
518
\edef
\currentsortingtag
{
#
4
}
%
519
\fi
520
\ifx
\currentsortingtag
\empty
521
% todo: error message
522
\else
523
\edef
\currentsortingexpansion
{
\simplelistparameter
\c!expansion
}
%
524
\preprocessexpansion
\currentsortingexpansion
\currentsortingtext
\currentsortingcoding
{
#
4
}
%
525
\clf_registersynonym
526
{
\currentsorting
}
%
527
{
sorting
}
%
528
{
%
529
metadata
{
%
530
catcodes
\catcodetable
531
coding
{
\currentsortingcoding
}
%
532
\ifx
\currentsortingcoding
\s!xml
533
xmlroot
{
\xmldocument
}
%
534
\fi
535
}
%
536
definition
{
%
537
tag
{
\currentsortingtag
}
%
538
synonym
{
\currentsortingtext
}
%
539
% used false
540
}
%
541
}
%
542
\relax
543
\doif
{
#
1
}
\v!yes
{
\setuxvalue
\currentsortingtag
{
\strc_sorting_insert
{
\currentsorting
}{
\currentsortingtag
}}}
%
544
\fi
545
\endgroup
}
546 547
\unexpanded
\def
\currentsortingname
{
\clf_synonymname
{
\currentsimplelist
}{
\currentsortingtag
}}
548
\unexpanded
\def
\doifelsecurrentsortingused
{
\clf_doifelsesynonymused
{
\currentsimplelist
}{
\currentsortingtag
}}
549
\unexpanded
\def
\resetusedsortings
[#
1
]
{
\clf_resetusedsynonyms
{
#
1
}}
550 551
\setupsimplelist
552
[
\v!sorting
]
553
[
\c!alternative
=
\v!normal
]
554 555
\unexpanded
\def
\strc_sorting_insert
#
1
#
2
% name tag
556
{
\dontleavehmode
% otherwise we don't get it right at the beginning of a par
557
\begingroup
558
% no kap currently, of .. we need to map cap onto WORD
559
\edef
\currentsorting
{
#
1
}
%
560
\def
\currentsortingtag
{
#
2
}
%
561
\let
\currentsimplelist
\currentsorting
562
\edef
\currentsimplelistalternative
{
\simplelistparameter
\c!alternative
}
%
563
\doifnotcommandhandler
\??simplelistalternative
\currentsimplelistalternative
564
{
\let
\currentsimplelistalternative
\v!normal
}
%
565
\fastsetup
{
\??simplelistrenderings
:
\v!sorting
:
\currentsimplelistalternative
}
%
566
\normalexpanded
{
\endgroup
\simplelistparameter
\c!next
}}
567 568
% or:
569
%
570
% \doifelsesetups{\??simplelistrenderings:\v!sorting:\currentsimplelistalternative}
571
% {\fastsetup{\??simplelistrenderings:\v!sorting:\currentsimplelistalternative}}
572
% {\fastsetup{\??simplelistrenderings:\v!sorting:\v!normal}}
573 574
\startsetups
[
\??simplelistrenderings
:
\v!sorting
:
\v!normal
]
575
\fastsetup
{
\??simplelistrenderings
:
:
\v!sorting
}
%
576
\stopsetups
577 578
\startsetups
[
\??simplelistrenderings
:
:
\v!sorting
]
579
\begingroup
580
\dostarttaggedchained
\t!sorting
\currentsorting
\??simplelist
581
\dotagsorting
582
\usesimpleliststyleandcolor
\c!style\c!color
583
\currentsortingname
584
\dostoptagged
585
\endgroup
586
\stopsetups
587 588
\unexpanded
\def
\registersort
589
{
\dodoubleargument
\strc_sorting_register
}
590 591
\def
\strc_sorting_register
[#
1
][#
2
]
%
592
{
\clf_registerusedsynonym
{
#
1
}{
#
2
}}
593 594
% before after
595
%
596
% maybe just 'commandset' and then combine
597 598
\unexpanded
\def
\placelistofsorts
599
{
\dodoubleempty
\strc_sorting_place_list
}
600 601 602
\def
\strc_sorting_place_list
[#
1
][#
2
]
%
603
{
\begingroup
604
\edef
\currentsimplelist
{
#
1
}
%
605
\strc_constructions_initialize
{
#
1
}
%
606
\setupcurrentsimplelist
[#
2
]
%
607
\edef
\p_simplelist_command
{
\simplelistparameter
\c!command
}
%
608
\ifx
\p_simplelist_command
\empty
609
\let
\synonymentry
\strc_sorting_normal
610
\else
611
\let
\synonymentry
\strc_sorting_command
612
\fi
613
% so we can hook tabulate into before and after
614
\normalexpanded
{
\simplelistparameter
\c!before
615
\noexpand
\clf_processsynonyms
616
{
#
1
}
%
617
{
%
618
criterium
{
\simplelistparameter
\c!criterium
}
%
619
language
{
\simplelistparameter
\s!language
}
%
620
method
{
\simplelistparameter
\c!method
}
%
621
}
%
622
\relax
623
\simplelistparameter
\c!after
}
%
624
\endgroup
}
625 626
\unexpanded
\def
\completelistofsorts
627
{
\dodoubleempty
\strc_sorting_complete_list
}
628 629
\def
\strc_sorting_complete_list
[#
1
][#
2
]
%
630
{
\begingroup
631
\edef
\currentsimplelist
{
#
1
}
%
632
\normalexpanded
{
\startnamedsection
[
\v!chapter
][
\c!title
=
{
\headtext
{
\simplelistparameter
\s!multi
}}
,
\c!reference
=#
1
]
}
%
633
\strc_sorting_place_list
[#
1
][#
2
]
%
634
\page
635
\stopnamedsection
636
\endgroup
}
637 638
\def
\strc_sorting_command
#
1
#
2
#
3
#
4
% #4 is meaning but empty here
639
{
\p_simplelist_command
{
#
1
}{
#
2
}{
#
3
}}
640 641
\def
\strc_sorting_normal
#
1
#
2
#
3
#
4
% #4 is meaning but empty here
642
{
\begingroup
643
\usesimpleliststyleandcolor
\c!style\c!color
644
#
3
%
645
\endgroup
646
\par
}
647 648
%D Presets.
649 650
% To be considered:
651
%
652
% \setupsimplelist
653
% [\v!sorting]
654
% [\c!headstyle=\simplelistparameter\c!synonymstyle,
655
% \c!headcolor=\simplelistparameter\c!synonymcolor,
656
% \c!style=\simplelistparameter\c!textstyle,
657
% \c!color=\simplelistparameter\c!textcolor]
658 659
\definesynonyms
660
[
\v!abbreviation
]
661
[
\v!abbreviations
]
662
[
\infull
]
663 664
\setupsynonyms
665
[
\v!abbreviation
]
666
[
\c!textstyle
=
\v!capital
]
667 668
\definesorting
669
[
\v!logo
]
670
[
\v!logos
]
671
% [\logogram] % no
672 673
\protect
\endinput
674