diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-syn.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/strc-syn.mkiv | 103 |
1 files changed, 67 insertions, 36 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-syn.mkiv b/Master/texmf-dist/tex/context/base/strc-syn.mkiv index 9865305c75e..65f5174372a 100644 --- a/Master/texmf-dist/tex/context/base/strc-syn.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-syn.mkiv @@ -15,6 +15,9 @@ \registerctxluafile{strc-syn}{1.001} +% todo: add 'define only' option to descriptions, then add sorting (also based on key) +% and call to definition -> replaces this module + \unprotect % general help, can be shared @@ -64,7 +67,7 @@ \newtoks\everysetupsynonyms -\def\setupsynonyms +\unexpanded\def\setupsynonyms {\dodoubleargument\dosetupsynonyms} \def\dosetupsynonyms[#1][#2]% @@ -95,7 +98,7 @@ %\c!expansion=, \s!language=\currentmainlanguage] -\def\definesynonyms +\unexpanded\def\definesynonyms {\doquadrupleempty\dodefinesynonyms} \def\dodefinesynonyms[#1][#2][#3][#4]% name plural \meaning \use @@ -104,21 +107,21 @@ \ifthirdargument \unexpanded\def#3##1{\doinsertsynonymmeaning{#1}{##1}}% \meaning \fi - \unexpanded\setvalue{#1}{\definesynonym[\v!no][#1]}% \name + \setuvalue{#1}{\definesynonym[\v!no][#1]}% \name \else \ifthirdargument \unexpanded\def#3##1{\doinsertsynonymmeaning{#1}{##1}}% \meaning \fi - \unexpanded\setvalue{#1}{\definesynonym[\v!yes][#1]}% \name + \setuvalue{#1}{\definesynonym[\v!yes][#1]}% \name \fi - \getparameters[\??sm#1][\s!parent=\??sm]% + \getparameters[\??sm#1][\s!parent=\??sm,\s!multi={#2}]% \presetheadtext[#2=\Word{#2}]% changes the \if...argument %\ctxlua{joblists.define('#1')}% \setvalue{\e!setup #2\e!endsetup}{\dodoubleargument\getparameters[\??sm#1]}% to be obsolete - \setvalue{\e!place \e!listof#2}{\doplacelistofsynonyms{#1}{#2}}% - \setvalue{\e!complete\e!listof#2}{\docompletelistofsynonyms{#1}{#2}}} + \setvalue{\e!place \e!listof#2}{\placelistofsynonyms[#1]}% accepts extra argument + \setvalue{\e!complete\e!listof#2}{\completelistofsynonyms[#1]}} -\def\definesynonym +\unexpanded\def\definesynonym {\dotripleempty\dodefinesynonym} \def\dodefinesynonym[#1][#2][#3]#4#5% @@ -147,10 +150,16 @@ used = false, } })}% - \doif{#1}\v!yes{\unexpanded\setxvalue\currentsynonymtag{\noexpand\doinsertsynonym{\currentsynonym}{\currentsynonymtag}}}% + \doif{#1}\v!yes{\setuxvalue\currentsynonymtag{\noexpand\doinsertsynonym{\currentsynonym}{\currentsynonymtag}}}% \fi \endgroup} +\def\registersynonym + {\dodoubleargument\doregistersynonym} + +\def\registersynonym[#1][#2]% + {\ctxlua{joblists.registerused("#1","#2")}} + \unexpanded\def\doinsertsynonymmeaning#1#2% name tag {\begingroup \def\currentsynonym{#1}% @@ -163,9 +172,12 @@ \def\currentsynonym{#1}% \dosetsynonymattributes\c!synonymstyle\c!synonymcolor \synonymparameter\c!synonymcommand{\ctxlua{joblists.synonym("#1","#2")}}% - \endgroup} + \normalexpanded{\endgroup\synonymparameter\c!next}} + +\unexpanded\def\placelistofsynonyms + {\dodoubleempty\doplacelistofsynonyms} -\def\doplacelistofsynonyms#1#2% +\def\doplacelistofsynonyms[#1][#2]% {\begingroup \def\currentsynonym{#1}% \definedescription % todo, per class @@ -185,15 +197,19 @@ \c!headstyle=\synonymparameter\c!textstyle, \c!headcolor=\synonymparameter\c!textcolor, \c!style=, - \c!color=]% + \c!color=. + #2]% \startpacked \ctxlua{joblists.process('#1',{ criterium = "\synonymparameter\c!criterium" })}% \stoppacked \endgroup} -\def\docompletelistofsynonyms#1#2% expansion needed to avoid v! (due to french active !) - {\normalexpanded{\noexpand\systemsuppliedchapter[#1]{\noexpand\headtext{#2}}}% - \doplacelistofsynonyms{#1}{#2}% +\def\completelistofsynonyms + {\dodoubleempty\docompletelistofsynonyms} + +\def\docompletelistofsynonyms[#1][#2]% expansion needed to avoid v! (due to french active !) + {\normalexpanded{\systemsuppliedchapter[#1]{\noexpand\headtext{\synonymparameter\s!single}}}% + \doplacelistofsynonyms[#1][#2]% \page[\v!yes]} \let\startsynonymoutput \relax @@ -201,10 +217,10 @@ \let\startsynonymsection\gobbleoneargument \let\stopsynonymsection \relax -\unexpanded\def\synonymentry#1#2#3% +\unexpanded\def\synonymentry#1#2#3#4% % {\syndef{\dosetsynonymattributes\c!textstyle\c!textcolor#2}#3\par} % {\startsyndef{#2}#3\stopsyndef} - {\syndef{#2}#3\par} + {\syndef{#3}#4\par} \let\currentsorting\empty @@ -227,7 +243,7 @@ \newtoks\everysetupsorting -\def\setupsorting +\unexpanded\def\setupsorting {\dodoubleargument\dosetupsorting} \def\dosetupsorting[#1][#2]% @@ -248,7 +264,7 @@ %\c!expansion=, \s!language=\currentmainlanguage] -\def\definesorting +\unexpanded\def\definesorting {\dotripleempty\dodefinesorting} % if #3=\relax or \v!none, then no command but still protected @@ -259,19 +275,18 @@ {\ifx#3\relax \else \unexpanded\def#3##1{\doinsertsort{#1}{##1}}% \fi}% - \unexpanded\setvalue{#1}{\definesort[\v!no][#1]}% + \setuvalue{#1}{\definesort[\v!no][#1]}% \else - \unexpanded\setvalue{#1}{\definesort[\v!yes][#1]}% + \setuvalue{#1}{\definesort[\v!yes][#1]}% \fi - \getparameters[\??so#1][\s!parent=\??so]% + \getparameters[\??so#1][\s!parent=\??so,\s!multi={#2}]% \presetheadtext[#2=\Word{#2}]% after \ifthirdargument -) %\ctxlua{joblists.define('#1')}% \setvalue{\e!setup #2\e!endsetup}{\dodoubleargument\getparameters[\??so#1]}% to be obsolete - \setvalue{\e!place \e!listof#2}{\doplacelistofsortings{#1}{#2}}% - \setvalue{\e!complete\e!listof#2}{\docompletelistofsortings{#1}{#2}}} + \setvalue{\e!place \e!listof#2}{\placelistofsorts[#1]}% + \setvalue{\e!complete\e!listof#2}{\completelistofsorts[#1]}} - -\def\definesort +\unexpanded\def\definesort {\dotripleempty\dodefinesort} \def\dodefinesort[#1][#2][#3]#4% @@ -298,32 +313,46 @@ % used = false, } })}% - \doif{#1}\v!yes{\unexpanded\setxvalue\currentsortingtag{\noexpand\doinsertsort{\currentsorting}{\currentsortingtag}}}% + \doif{#1}\v!yes{\setuxvalue\currentsortingtag{\noexpand\doinsertsort{\currentsorting}{\currentsortingtag}}}% \fi \endgroup} -\def\doinsertsort#1#2% name tag +\unexpanded\def\doinsertsort#1#2% name tag {\begingroup % no kap currently, of .. we need to map cap onto WORD + \edef\currentsorting{#1}% \dosetsynonymattributes\c!style\c!color \ctxlua{joblists.synonym("#1","#2")}% - \endgroup} + \normalexpanded{\endgroup\sortingparameter\c!next}} + +\def\registersort + {\dodoubleargument\doregistersort} + +\def\registersort[#1][#2]% + {\ctxlua{joblists.registerused("#1","#2")}} % before after % % maybe just 'commandset' and then combine -\def\doplacelistofsorts#1% NOG EEN RUWE VERSIE MAKEN ZONDER WITRUIMTE ETC ETC +\unexpanded\def\placelistofsorts + {\dodoubleempty\placelistofsorts} + +\unexpanded\def\placelistofsorts[#1][#2]% NOG EEN RUWE VERSIE MAKEN ZONDER WITRUIMTE ETC ETC {\begingroup \def\currentsorting{#1}% + \getparameters[\??so#1][#2]% \startpacked - \ctxlua{joblists.process('#1',{})}% + \ctxlua{joblists.process('#1',{ criterium = "\sortingparameter\c!criterium" })}% \stoppacked \endgroup} -\def\docompletelistofsorts#1#2% - {\normalexpanded{\noexpand\systemsuppliedchapter[#1]{\noexpand\headtext{#2}}}% - \doplacelistofsorts{#1}% +\def\completelistofsorts + {\dodoubleemptydocompletelistofsorts} + +\def\docompletelistofsorts[#1][#2]% + {\normalexpanded{\systemsuppliedchapter[#1]{\noexpand\headtext{#2}}}% + \doplacelistofsorts[#1][#2]% \page[\v!yes]} \let\startsortingoutput \relax @@ -331,8 +360,10 @@ \let\startsortingsection\gobbleoneargument \let\stopsortingsection \relax -\def\sortingentry#1#2#3% - {\begingroup\dosetsortingattributes\c!style\c!color#2\endgroup\par} % todo +\def\sortingentry#1#2#3#4% #4 is meaning but empty here + {\doifelsenothing{\sortingparameter\c!command} + {\begingroup\dosetsortingattributes\c!style\c!color#3\endgroup\par} % todo + {\sortingparameter\c!command{#1}{#2}{#3}}} %D Here we define a support macro that can sort simple comma %D separated lists. It's a multi-list variant of a prototype |