strc-syn.mkxl /size: 21 Kb    last modification: 2021-10-28 13:51
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\permanent\protected\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\aliased\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    \ifempty\currentsimplelistparent
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\protected\defcsname\??constructioninitializer\v!simplelist\endcsname
188  {\let         \currentsimplelist               \currentconstruction
189   \enforced\let\constructionparameter           \simplelistparameter
190   \enforced\let\constructionnamespace           \??simplelist
191   \enforced\let\detokenizedconstructionparameter\detokenizedsimplelistparameter
192   \enforced\let\letconstructionparameter        \letsimplelistparameter
193   \enforced\let\useconstructionstyleandcolor    \usesimpleliststyleandcolor
194   \enforced\let\setupcurrentconstruction        \setupcurrentsimplelist}
195
196\protected\defcsname\??constructionfinalizer\v!simplelist\endcsname
197  {}
198
199\protected\defcsname\??constructiontexthandler\v!simplelist\endcsname
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 \aliased\let\dotagsynonym\relax \fi
211\ifdefined\dotagsorting \else \aliased\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\aliased\let\setupsynonyms\setupsimplelist
235
236% these  might become private
237
238\mutable\let\currentsynonymoption   \empty
239\mutable\let\currentsynonymcoding   \empty
240\mutable\let\currentsynonymexpansion\empty
241\mutable\let\currentsynonym         \empty
242\mutable\let\currentsynonymtag      \empty
243\mutable\let\currentsynonymtext     \empty
244
245\permanent\tolerant\protected\def\definesynonyms[#1]#*[#2]#*[#3]#*[#4]% name plural \meaning \use
246  {\ifnum\lastarguments=\plusfour
247     \protected\instance\def#4##1{\strc_synonyms_insert{#1}{##1}}% name tag
248     \frozen\instance\protected\defcsname#1\endcsname{\definesynonym[\v!no][#1]}% \name
249   \else
250     \frozen\instance\protected\defcsname#1\endcsname{\definesynonym[\v!yes][#1]}% \name
251   \fi
252   \ifparameter#3\or
253     \frozen\instance\protected\def#3##1{\strc_synonyms_insert_meaning{#1}{##1}}% \meaning
254   \fi
255   \edef\currentsynonym{#1}%
256   %
257  %\checksynonymparent
258  %\setupcurrentsynonym[\s!single={#1},\s!multi={#2}]%
259   \setfalse\c_strc_constructions_define_commands
260   \definesimplelist
261     [\currentsynonym]%
262     [\v!sorting]
263     [\s!single={#1},%
264      \s!multi={#2}]%
265   \settrue\c_strc_constructions_define_commands
266   \ifparameter#2\or
267     %
268     \presetheadtext[#2=\Word{#2}]% changes the \if...argument
269     %
270     % These will go away. Actually the overloads catched this empty case!
271     %
272     \frozen\instance\protected\defcsname\e!setup #2\e!endsetup\endcsname{\setupsynonyms[#1]}% obsolete definition
273     \frozen\instance\protected\defcsname\e!place   \e!listof#2\endcsname{\placelistofsynonyms[#1]}% accepts extra argument
274     \frozen\instance\protected\defcsname\e!complete\e!listof#2\endcsname{\completelistofsynonyms[#1]}%
275   \fi}
276
277% \abbreviation[XXX][321]{321}{Three, Two, One} : optional sort key
278
279\permanent\tolerant\protected\def\definesynonym[#1]#*[#2]#*[#3]#*[#4]% [yes][abbreviation][FOO]{foo}{foo me}
280  {\begingroup
281   \edef\currentsynonymoption{#1}%
282   \edef\currentsynonym{#2}%
283   \edef\currentsynonymtag{#3}%
284   \edef\currentsynonymsortkey{#4}%
285   \strc_synonyms_define_entry}
286
287% \installcorenamespace {synonymentry}
288%
289% \installsetuponlycommandhandler \??synonymentry {synonymentry}
290%
291% \permanent\tolerant\protected\def\setsynonym[#1]#*[#2]%
292%   {\begingroup
293%    \setupsynonymentry[#2]%
294%    \edef\currentsynonym       {#1}%
295%    \edef\currentsynonymoption {\synonymentryparameter\c!option}%
296%    \edef\currentsynonymtag    {\synonymentryparameter\c!tag}%
297%    \edef\currentsynonymsortkey{\synonymentryparameter\c!sortkey}%
298%    \strc_synonyms_define_entry{\synonymentryparameter\c!text}{\synonymentryparameter\c!meaning}}
299
300\def\strc_synonyms_define_entry#1#2%
301  {\let\currentsimplelist\currentsynonym
302   \ifempty\currentsynonymtag
303     \edef\currentsynonymtag{#1}%
304   \fi
305   \ifempty\currentsynonymtag \else
306     % this is not that efficient, esp when we load a big list
307     \edef\currentsynonymexpansion{\simplelistparameter\c!expansion}%
308     \preprocessexpansion\currentsynonymexpansion\m_synonyms_text   \currentsynonymcoding{#1}%
309     \preprocessexpansion\currentsynonymexpansion\m_synonyms_meaning\currentsynonymcoding{#2}%
310     % currently they all end up in the tuc file
311     \clf_registersynonym
312        {\currentsynonym}%
313        {synonym}%
314        {%
315            metadata {%
316                catcodes \catcodetable
317                coding   {\currentsynonymcoding}%
318            \ifx\currentsynonymcoding\s!xml
319                xmlroot  {\xmldocument}%
320            \fi
321            }%
322            definition {%
323                tag     {\currentsynonymtag}%
324                sortkey {\currentsynonymsortkey}%
325                synonym {\m_synonyms_text}%
326                meaning {\m_synonyms_meaning}%
327              % used    false
328            }%
329        }%
330     \relax
331     \ifx\currentsynonymoption\v!yes
332       \instance\setuxvalue\currentsynonymtag{\strc_synonyms_insert{\currentsynonym}{\currentsynonymtag}}%
333     \fi
334   \fi
335   \endgroup}
336
337\permanent\tolerant\protected\def\registersynonym  [#1]#*[#2]{\clf_registerusedsynonym{#1}{#2}}
338\permanent         \protected\def\currentsynonymname         {\clf_synonymname{\currentsimplelist}{\currentsynonymtag}}
339\permanent         \protected\def\currentsynonymmeaning      {\clf_synonymmeaning{\currentsimplelist}{\currentsynonymtag}}
340\permanent         \protected\def\doifelsecurrentsynonymused {\clf_doifelsesynonymused{\currentsimplelist}{\currentsynonymtag}}
341\permanent         \protected\def\doifelsecurrentsynonymshown{\clf_doifelsesynonymshown{\currentsimplelist}{\currentsynonymtag}}
342\permanent         \protected\def\resetusedsynonyms      [#1]{\clf_resetusedsynonyms{#1}}
343\permanent         \protected\def\resetshownsynonyms     [#1]{\clf_resetshownsynonyms{#1}}
344
345\aliased\let\rawsynonymname   \clf_synonymname
346\aliased\let\rawsynonymmeaning\clf_synonymmeaning
347
348\installcorenamespace{simplelistalternative} % specific ways of rendering a list
349\installcorenamespace{simplelistrenderings}  % a namespace for setups (rather local)
350
351\installcommandhandler \??simplelistalternative {simplelistalternative} \??simplelistalternative
352
353\setupsimplelist
354  [\v!synonym]
355  [\c!alternative=\v!normal]
356
357\protected\def\strc_synonyms_insert_meaning#1#2% name tag
358  {\dontleavehmode % otherwise we don't get it right at the beginning of a par
359   \begingroup
360   \def\currentsimplelist{#1}%
361   \def\currentsynonymtag{#2}%
362   \fastsetup{\??simplelistrenderings::\v!text}%
363   \endgroup}
364
365\protected\def\strc_synonyms_insert#1#2% name tag
366  {\dontleavehmode % otherwise we don't get it right at the beginning of a par
367   \begingroup
368   \edef\currentsimplelist{#1}%
369   \let\currentsynonym\currentsimplelist % for a while
370   \def\currentsynonymtag{#2}%
371   \edef\currentsimplelistalternative{\simplelistparameter\c!alternative}%
372   \doifnotcommandhandler\??simplelistalternative\currentsimplelistalternative
373     {\let\currentsimplelistalternative\v!normal}%
374   \fastsetup{\??simplelistrenderings:\v!synonym:\currentsimplelistalternative}%
375   \normalexpanded{\endgroup\simplelistparameter\c!next}}
376
377% \setupsimplelistalternative
378%   [\c!command=\directsimplelistparameter\c!command]
379
380\definesimplelistalternative
381  [\v!normal]
382  [\c!inbetween=\space,
383   \c!left=(,
384   \c!right=)]
385
386\definesimplelistalternative
387  [\v!first]
388  [\v!normal]
389
390\definesimplelistalternative
391  [\v!last]
392  [\v!normal]
393
394\startsetups[\??simplelistrenderings::\v!synonym]
395    \begingroup
396    \dostarttaggedchained\t!synonym\currentsynonym\??simplelist
397    \dotagsynonym
398    \usesimpleliststyleandcolor\c!synonymstyle\c!synonymcolor
399    \simplelistparameter\c!synonymcommand{\currentsynonymname}%
400    \dostoptagged
401    \endgroup
402\stopsetups
403
404\startsetups[\??simplelistrenderings::\v!text]
405    \begingroup
406    \usehyphensparameter\simplelistparameter
407    \usesimpleliststyleandcolor\c!textstyle\c!textcolor
408    \simplelistparameter\c!textcommand{\currentsynonymmeaning}%
409    \endgroup
410\stopsetups
411
412\startsetups[\??simplelistrenderings:\v!synonym:\v!normal]
413    \fastsetup{\??simplelistrenderings::\v!synonym}
414\stopsetups
415
416\startsetups[\??simplelistrenderings:\v!synonym:\v!first]
417    \fastsetup{\??simplelistrenderings::\v!synonym}
418    \doifelsecurrentsynonymshown \donothing {
419        \simplelistalternativeparameter\c!inbetween
420        \simplelistalternativeparameter\c!left
421        \fastsetup{\??simplelistrenderings::\v!text}
422        \simplelistalternativeparameter\c!right
423    }
424\stopsetups
425
426\startsetups[\??simplelistrenderings:\v!synonym:\v!last]
427    \doifelsecurrentsynonymshown {
428        \fastsetup{\??simplelistrenderings::\v!synonym}
429    } {
430        \fastsetup{\??simplelistrenderings::\v!text}
431        \simplelistalternativeparameter\c!inbetween
432        \simplelistalternativeparameter\c!left
433        \fastsetup{\??simplelistrenderings::\v!synonym}
434        \simplelistalternativeparameter\c!right
435    }
436\stopsetups
437
438\aliased\let\synonymentry\relax
439
440\permanent\tolerant\protected\def\placelistofsynonyms[#1]#*[#2]%
441  {\begingroup
442   \edef\currentsimplelist{#1}%
443   \doifelsecommandhandler\??simplelist\currentsimplelist
444     {\strc_constructions_initialize{#1}%
445      \setupcurrentsimplelist[#2]%
446      \enforced\let\synonymentry\strc_synonym_normal
447      % so we can hook tabulate into before and after
448      \normalexpanded{\simplelistparameter\c!before
449        \noexpand\clf_processsynonyms
450           {#1}%
451           {%
452               criterium {\simplelistparameter\c!criterium}%
453               language  {\simplelistparameter\s!language}%
454               method    {\simplelistparameter\c!method}%
455           }%
456        \relax
457      \simplelistparameter\c!after}%
458      \relax}%
459     {}% todo: message that invalid
460   \endgroup}
461
462\permanent\tolerant\protected\def\completelistofsynonyms[#1]#*[#2]%
463  {\begingroup
464   \edef\currentsimplelist{#1}%
465   \doifelsecommandhandler\??simplelist\currentsimplelist
466     {\normalexpanded{\startnamedsection[\v!chapter][\c!title={\headtext{\simplelistparameter\s!multi}},\c!reference=#1]}%
467        \placelistofsynonyms[#1][#2]%
468        \page
469      \stopnamedsection}%
470     {}% todo: message that invalid
471   \endgroup}
472
473\mutable\let\currentsimplelistentry\empty
474
475\protected\def\strc_synonym_normal#1#2#3#4%
476  {\begingroup
477   \def\currentsimplelistentry{#3}%
478   \csname\??constructionstarthandler\v!construction\endcsname
479   #4%
480   \csname\??constructionstophandler\v!construction\endcsname
481   \endgroup}
482
483%D Sorting (a simplified version of synonym).
484
485\definesimplelist
486  [\v!sorting]
487  [\c!state=\v!start,
488  %\c!command=, % we test for defined !
489  %\c!criterium=,
490  %\c!style=,
491   \c!before=\startpacked,
492   \c!after=\stoppacked,
493  %\c!expansion=,
494   \c!method=]
495
496\aliased\let\setupsorting\setupsimplelist
497
498% if #3=\relax or \v!none, then no command but still protected
499
500% these  might become private
501
502\mutable\let\currentsortingoption   \empty
503\mutable\let\currentsortingcoding   \empty
504\mutable\let\currentsortingexpansion\empty
505\mutable\let\currentsorting         \empty
506\mutable\let\currentsortingtag      \empty
507\mutable\let\currentsortingtext     \empty
508
509\permanent\tolerant\protected\def\definesorting[#1]#*[#2]#*[#3]%
510  {\ifnum\lastarguments=\plusthree
511     \doifnot{#3}\v!none
512       {\ifx#3\relax \else
513          \protected\instance\def#3##1{\strc_sorting_insert{#1}{##1}}%
514        \fi}%
515     \frozen\instance\protected\defcsname#1\endcsname{\definesort[\v!no][#1]}%
516   \else
517     \frozen\instance\protected\defcsname#1\endcsname{\definesort[\v!yes][#1]}%
518   \fi
519   \edef\currentsorting{#1}%
520   \setfalse\c_strc_constructions_define_commands
521   \definesimplelist
522     [\currentsorting]%
523     [\v!sorting]
524     [\s!single={#1},%
525      \s!multi={#2}]%
526   \settrue\c_strc_constructions_define_commands
527   \ifparameter#2\or
528     %
529     \presetheadtext[#2=\Word{#2}]% changes the \if...argument
530     %
531     % These will go away. Actually the overloads catched this empty case!
532     %
533     %
534     \presetheadtext[#2=\Word{#2}]%
535     %
536     \frozen\instance\protected\defcsname\e!setup #2\e!endsetup\endcsname{\setupsorting[#1]}% obsolete definition
537     \frozen\instance\protected\defcsname\e!place   \e!listof#2\endcsname{\placelistofsorts[#1]}%
538     \frozen\instance\protected\defcsname\e!complete\e!listof#2\endcsname{\completelistofsorts[#1]}%
539   \fi}
540
541\permanent\tolerant\protected\def\definesort[#1]#*[#2]#*[#3]%
542  {\begingroup
543   \edef\currentsortingoption{#1}%
544   \edef\currentsorting{#2}%
545   \edef\currentsortingtag{#3}%
546   \strc_sorting_define_entry}
547
548\def\strc_sorting_define_entry#1%
549  {\let\currentsimplelist\currentsimplelist
550   \ifempty\currentsortingtag
551     \edef\currentsortingtag{#1}%
552   \fi
553   \ifempty\currentsortingtag \else
554     \edef\currentsortingexpansion{\simplelistparameter\c!expansion}%
555     \preprocessexpansion\currentsortingexpansion\currentsortingtext\currentsortingcoding{#1}%
556     \clf_registersynonym
557        {\currentsorting}%
558        {sorting}%
559        {%
560            metadata {%
561                catcodes \catcodetable
562                coding   {\currentsortingcoding}%
563            \ifx\currentsortingcoding\s!xml
564                xmlroot  {\xmldocument}%
565            \fi
566            }%
567            definition {%
568                tag     {\currentsortingtag}%
569                synonym {\currentsortingtext}%
570              % used    false
571            }%
572        }%
573     \relax
574     \ifx\currentsortingoption\v!yes
575       \instance\setuxvalue\currentsortingtag{\strc_sorting_insert{\currentsorting}{\currentsortingtag}}%
576     \fi
577   \fi
578   \endgroup}
579
580\permanent\protected\def\currentsortingname         {\clf_synonymname         {\currentsimplelist}{\currentsortingtag}}
581\permanent\protected\def\doifelsecurrentsortingused {\clf_doifelsesynonymused {\currentsimplelist}{\currentsortingtag}}
582\permanent\protected\def\resetusedsortings      [#1]{\clf_resetusedsynonyms   {#1}}
583
584\setupsimplelist
585  [\v!sorting]
586  [\c!alternative=\v!normal]
587
588\protected\def\strc_sorting_insert#1#2% name tag
589  {\dontleavehmode % otherwise we don't get it right at the beginning of a par
590   \begingroup
591   % no kap currently, of .. we need to map cap onto WORD
592   \edef\currentsorting{#1}%
593   \edef\currentsortingtag{#2}%
594   \let\currentsimplelist\currentsorting
595   \edef\currentsimplelistalternative{\simplelistparameter\c!alternative}%
596   \doifnotcommandhandler\??simplelistalternative\currentsimplelistalternative
597     {\let\currentsimplelistalternative\v!normal}%
598   \fastsetup{\??simplelistrenderings:\v!sorting:\currentsimplelistalternative}%
599   \normalexpanded{\endgroup\simplelistparameter\c!next}}
600
601% or:
602%
603% \doifelsesetups{\??simplelistrenderings:\v!sorting:\currentsimplelistalternative}
604%    {\fastsetup{\??simplelistrenderings:\v!sorting:\currentsimplelistalternative}}
605%    {\fastsetup{\??simplelistrenderings:\v!sorting:\v!normal}}
606
607\startsetups [\??simplelistrenderings:\v!sorting:\v!normal]
608   \fastsetup{\??simplelistrenderings::\v!sorting}%
609\stopsetups
610
611\startsetups [\??simplelistrenderings::\v!sorting]
612    \begingroup
613    \dostarttaggedchained\t!sorting\currentsorting\??simplelist
614    \dotagsorting
615    \usesimpleliststyleandcolor\c!style\c!color
616    \currentsortingname
617    \dostoptagged
618    \endgroup
619\stopsetups
620
621\permanent\tolerant\protected\def\registersort[#1]#*[#2]%
622  {\clf_registerusedsynonym{#1}{#2}}
623
624% before after
625%
626% maybe just 'commandset' and then combine
627
628\permanent\tolerant\protected\def\placelistofsorts[#1]#*[#2]%
629  {\begingroup
630   \edef\currentsimplelist{#1}%
631   \strc_constructions_initialize{#1}%
632   \setupcurrentsimplelist[#2]%
633   \edef\p_simplelist_command{\simplelistparameter\c!command}%
634   \ifempty\p_simplelist_command
635     \enforced\let\synonymentry\strc_sorting_normal
636   \else
637     \enforced\let\synonymentry\strc_sorting_command
638   \fi
639   % so we can hook tabulate into before and after
640   \normalexpanded{\simplelistparameter\c!before
641     \noexpand\clf_processsynonyms
642        {#1}%
643        {%
644            criterium {\simplelistparameter\c!criterium}%
645            language  {\simplelistparameter\s!language}%
646            method    {\simplelistparameter\c!method}%
647        }%
648     \relax
649   \simplelistparameter\c!after}%
650   \endgroup}
651
652\permanent\tolerant\protected\def\completelistofsorts[#1]#*[#2]%
653  {\begingroup
654   \edef\currentsimplelist{#1}%
655   \normalexpanded{\startnamedsection[\v!chapter][\c!title={\headtext{\simplelistparameter\s!multi}},\c!reference=#1]}%
656   \placelistofsorts[#1][#2]%
657   \page
658   \stopnamedsection
659   \endgroup}
660
661\def\strc_sorting_command#1#2#3#4% #4 is meaning but empty here
662  {\p_simplelist_command{#1}{#2}{#3}}
663
664\def\strc_sorting_normal#1#2#3#4% #4 is meaning but empty here
665  {\begingroup
666   \usesimpleliststyleandcolor\c!style\c!color
667   #3%
668   \endgroup
669   \par}
670
671%D Presets.
672
673% To be considered:
674%
675% \setupsimplelist
676%   [\v!sorting]
677%   [\c!headstyle=\simplelistparameter\c!synonymstyle,
678%    \c!headcolor=\simplelistparameter\c!synonymcolor,
679%    \c!style=\simplelistparameter\c!textstyle,
680%    \c!color=\simplelistparameter\c!textcolor]
681
682\definesynonyms
683  [\v!abbreviation]
684  [\v!abbreviations]
685  [\infull]
686
687\setupsynonyms
688  [\v!abbreviation]
689  [\c!hyphens=\v!no, % new, not yet in setup definitions
690   \c!textstyle=\v!capital]
691
692\definesorting
693  [\v!logo]
694  [\v!logos]
695% [\logogram] % no
696
697\protect \endinput
698