diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-des.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/strc-des.mkiv | 390 |
1 files changed, 246 insertions, 144 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-des.mkiv b/Master/texmf-dist/tex/context/base/strc-des.mkiv index 2c3a0d6416c..29e4ea36c80 100644 --- a/Master/texmf-dist/tex/context/base/strc-des.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-des.mkiv @@ -1,5 +1,5 @@ %D \module -%D [ file=strc-blk, +%D [ file=strc-des, %D version=2008.10.20, %D title=\CONTEXT\ Structure Macros, %D subtitle=Descriptions, @@ -21,19 +21,30 @@ %D %D \startbuffer %D \defineenumeration[one] -%D \defineenumeration[two] [one] -%D \defineenumeration[three] [number=one,style=slanted] -%D \defineenumeration[four] [three] -%D \defineenumeration[five] [three] [number=five] +%D \defineenumeration[two] [one] % clone one +%D \defineenumeration[three] [counter=one,style=slanted] % only use counter of one +%D \defineenumeration[four] [three] % clone three +%D \defineenumeration[five] [three] [counter=five] % clone three and use own counter +%D \defineenumeration[six] [three] [counter=four] % clone tree and use counter four (undefined) %D -%D \startone test test 1 \stopone -%D \starttwo test test 2 \stoptwo -%D \startthree test test 3 \stopthree -%D \startfour test test 4 \stopfour -%D \startfive test test 1 \stopfive +%D \startone test test 6 \stopone +%D \starttwo test test 7 \stoptwo +%D \startthree test test 8 \stopthree +%D \startfour test test 9 \stopfour +%D \startfive test test 2 \stopfive +%D \startsix test test 10 \stopsix %D \stopbuffer %D %D \typebuffer \start \getbuffer \stop +%D +%D \starttyping +%D \setupenumerations[one] [prefix=yes,prefixsegments=section] +%D \setupenumerations[two] [prefix=yes,prefixsegments=section] +%D \setupenumerations[three][prefix=yes,prefixsegments=section] +%D \setupenumerations[four] [prefix=yes,prefixsegments=chapter:section] +%D \setupenumerations[five] [prefix=yes,prefixsegments=chapter:section] +%D \setupenumerations[six] [prefix=yes,prefixsegments=chapter:section] +%D \stoptyping % list and titles are experimental % @@ -67,6 +78,17 @@ \def\dodescriptionparentparameter#1#2% {\ifx#1\relax\s!empty\else\dodescriptionparameter#1#2\fi} +\def\descriptionlocationparameter#1{\csname\dodescriptionlocationparameter{\??dd\currentdescription}#1\endcsname} + +\def\dodescriptionlocationparameter#1#2% + {\ifcsname#1#2:\descriptionparameter\c!location\endcsname + #1#2:\descriptionparameter\c!location + \else\ifcsname#1\s!parent\endcsname + \expandafter\dodescriptionlocationparameter\csname#1\s!parent\endcsname#2% + \else + \dodescriptionparameter{\??dd\currentdescription}#2% + \fi\fi} + % description hashes (needed for style/color) \def\descriptionparameterhash #1{\dodescriptionparameterhash{\??dd\currentdescription }#1} @@ -136,17 +158,17 @@ \noindent \llap {\@@makedescriptionpurebox\raggedright - \hbox to \descriptionparameter\c!width{\copy\descriptionheadbox\hss}% - \hskip\descriptionparameter\c!distance}% + \hbox to \descriptionsheadwidth{\copy\descriptionheadbox\hss}% + \hskip\descriptionsheaddistance}% \@@dodescription} \def\@@descriptionrightmargin % whatever this means {\def\\{\crlf}% \noindent \rlap - {\hskip\descriptionparameter\c!distance + {\hskip\descriptionsheaddistance \@@makedescriptionpurebox\raggedright - \hbox to \descriptionparameter\c!width{\copy\descriptionheadbox\hss}}% + \hbox to \descriptionsheadwidth{\copy\descriptionheadbox\hss}}% \@@dodescription} \def\@@makedescriptionpurebox#1% @@ -155,7 +177,7 @@ \hsize\descriptionsheadwidth \leftskip\zeropoint \rightskip\zeropoint - #1\setupalign[\descriptionparameter\c!align]% + #1\setupalign[\descriptionparameter\c!headalign]% \ifhbox\descriptionheadbox\unhcopy\else\copy\fi\descriptionheadbox}% \ht\descriptionheadbox\strutht \dp\descriptionheadbox\strutdp} @@ -191,7 +213,7 @@ {\forgetall \dontcomplain \hsize\descriptionsheadwidth - #1\setupalign[\descriptionparameter\c!align]#2% + #1\setupalign[\descriptionparameter\c!headalign]#2% \ifhbox\descriptionheadbox\unhcopy\else\copy\fi\descriptionheadbox}% \ht\descriptionheadbox\strutht \dp\descriptionheadbox\strutdp @@ -256,7 +278,7 @@ \setvalue{@@description\v!serried}% {\processaction - [\descriptionparameter\c!width] + [\descriptionlocationparameter\c!width] [ \v!fit=>\let\next\v!fit, \v!broad=>\let\next\v!broad, \s!unknown=>\let\next\v!wide, @@ -309,35 +331,31 @@ \begingroup \doadaptleftskip{\descriptionparameter\c!margin}% \showcomposition - \descriptionsheaddistance\descriptionparameter\c!distance\relax + \setlocalhsize % so we can use \localhsize in width assignments + \descriptionsheaddistance\descriptionlocationparameter\c!distance\relax \ifdim\descriptionsheaddistance=\zeropoint\relax - \doif{\descriptionparameter\c!width}\v!broad{\descriptionsheaddistance=1em}% + \doif{\descriptionlocationparameter\c!width}\v!broad{\descriptionsheaddistance=1em}% \fi \setbox\descriptionheadbox\hbox {\forgetall\dontcomplain \trialtypesettingtrue \doifelsenothing{\descriptionparameter\c!sample} - {\dodescriptionhandler - {\begstrut\descriptionparameter\c!text\ignorespaces\currentdescriptiontext\endstrut}}% - {\dodescriptionhandler - {\begstrut\descriptionparameter\c!text\descriptionparameter\c!sample\endstrut}}}% + {\dodescriptionhandler\currentdescriptiontext}% + {\dodescriptionhandler\currentdescriptionsample}}% \assignwidth \descriptionsheadwidth - {\descriptionparameter\c!width} + {\descriptionlocationparameter\c!width} {\unhcopy\descriptionheadbox} \descriptionsheaddistance \setbox\descriptionheadbox\hbox {\forgetall\dontcomplain \doifelse{\descriptionparameter\c!location}\v!serried % brrr, hack - {\dodescriptionhandler - {\begstrut\descriptionparameter\c!text\currentdescriptiontext\endstrut}} - {\dodescriptionhandler - {\vtop - {\hsize\dimexpr\descriptionsheadwidth-\descriptionsheaddistance\relax - \begstrut\descriptionparameter\c!text\ignorespaces\currentdescriptiontext\endstrut}}}}% + {\dodescriptionhandler\currentdescriptiontext} + {\dodescriptionhandler{\boxeddescriptionhead\currentdescriptiontext}}}% \doifelse{\descriptionparameter\c!aligntitle}\v!no {\leftdescriptionskip\leftskip\rightdescriptionskip\rightskip} {\ifcase\nesteddescriptionstate\leftdescriptionskip\leftskip\rightdescriptionskip\rightskip\fi}% + \doifsomething{\descriptionparameter\c!align}{\setupalign[\descriptionparameter\c!align]}% \normalexpanded{\noexpand\indenting[\descriptionparameter\c!indenting]}% % better a system mode \ifcase\nesteddescriptionstate @@ -347,6 +365,13 @@ \fi % now happens elsewhere : \noindent\ignorespaces \@@resetdescriptionclosesymbol} +\def\boxeddescriptionhead#1% + {\vtop + %{\hsize\dimexpr\descriptionsheadwidth-\descriptionsheaddistance\relax + {\hsize\descriptionsheadwidth + \doifsomething{\descriptionparameter\c!headalign}{\setupalign[\descriptionparameter\c!headalign]}% + #1}} + \def\@@stopdescription {\@@placedescriptionclosesymbol \par % else we loose @@ -399,10 +424,11 @@ \csname @@description\currentdescriptionlocation\endcsname} % args not needed \def\@@makedescription[#1]#2% - {\postponenotes % new, assumes grouping - \doenumerationcheckconditions - \dodescriptioncomponent[\c!reference=#1,\c!label={\descriptionparameter\c!text},\c!title={#2},\c!bookmark=,][]% - \@@dostartdescriptionindeed} + {\postponenotes % new, assumes grouping + \edef\currentdescriptionreference{#1}% + \doenumerationcheckconditions + \dodescriptioncomponent[\c!reference=#1,\c!label={\descriptionparameter\c!text},\c!title={#2},\c!bookmark=,\c!list=][]% + \@@dostartdescriptionindeed} \def\dostartstoreddescription {\@@dostartdescriptionindeed} @@ -418,7 +444,7 @@ % setup descriptions -\def\setupdescriptions +\unexpanded\def\setupdescriptions {\dodoubleempty\dosetupdescriptions} \def\dosetupdescriptions[#1][#2]% % beter: \iffirstargument @@ -433,7 +459,7 @@ % define descriptions -\def\definedescription +\unexpanded\def\definedescription {\dotripleemptywithset\dodefinedescription} \def\dodefinedescription[#1][#2][#3]% to be simplified cf enumeration @@ -449,9 +475,9 @@ \fi} \def\dodefinedescriptioncommands#1#2% - {\unexpanded\setevalue {#1}{\noexpand\dodescriptioncommand{#1}}% - \unexpanded\setevalue{\e!start#1}{\noexpand\dodescriptionstart {#1}}% - \unexpanded\setevalue{\e!stop #1}{\noexpand\dodescriptionstop {#1}}} + {\setuevalue {#1}{\noexpand\dodescriptioncommand{#1}}% + \setuevalue{\e!start#1}{\noexpand\dodescriptionstart {#1}}% + \setuevalue{\e!stop #1}{\noexpand\dodescriptionstop {#1}}} % handle descriptions @@ -465,9 +491,14 @@ \def\dodescriptionstart #1{\dodescriptioninit{#1}\dosingleempty\@@startdescription} \def\dodescriptionstop #1{\dodescriptioninit{#1}\@@stopdescription} -\def\dodescriptionhandler {\csname\??dd:\descriptionparameter\s!handler:\s!handler \endcsname} -\def\dohandledescriptiondo {\csname\??dd:\descriptionparameter\s!handler:\s!handler:\s!do \endcsname} -\def\dohandledescriptionstart{\csname\??dd:\descriptionparameter\s!handler:\s!handler:\s!start\endcsname} +\def\dodescriptiontext {\csname\??dd:\descriptionparameter\s!handler:\s!handler:\s!text \endcsname} +\def\dodescriptionnumber {\csname\??dd:\descriptionparameter\s!handler:\s!handler:\s!number\endcsname} +\def\dodescriptionhandler {\csname\??dd:\descriptionparameter\s!handler:\s!handler \endcsname} +\def\dohandledescriptiondo {\csname\??dd:\descriptionparameter\s!handler:\s!handler:\s!do \endcsname} +\def\dohandledescriptionstart{\csname\??dd:\descriptionparameter\s!handler:\s!handler:\s!start \endcsname} + +\def\currentdescriptiontext {\begstrut\dodescriptiontext\endstrut} +\def\currentdescriptionsample{\begstrut\descriptionparameter\c!text\descriptionparameter\c!sample\endstrut} % implementation @@ -476,28 +507,33 @@ \newtoks \everydescription +\setvalue{\??dd:\v!description:\s!handler:\s!text }{\@@dodescriptiontext} \setvalue{\??dd:\v!description:\s!handler }{\@@dodescriptionhandler} \setvalue{\??dd:\v!description:\s!handler:\s!do }{\@@somedescription} \setvalue{\??dd:\v!description:\s!handler:\s!start}{\@@startsomedescription} \def\@@dodescriptionhandler#1% - {\strut - \dodescriptionheadtext{#1}% - \iftrialtypesetting \else + {\iftrialtypesetting \else + \begingroup \currentdescriptionsynchronize - \dosetattribute{destination}\currentdescriptionattribute % todo - \fi} + \attribute\destinationattribute\currentdescriptionattribute\relax % todo, whole text + \forcecolorhack + \endgroup + \fi#1} + +\def\@@dododescriptiontext + {\ctxlua{structure.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} -\def\dodescriptionheadtext#1% title +\def\@@dodescriptiontext {\begingroup \dosetdescriptionattributes\c!headstyle\c!headcolor \the\everydescription - \descriptionparameter\c!command{\strut#1}% probably incomplete + \descriptionparameter\c!command{\strut\descriptionparameter\c!text\ignorespaces\@@dododescriptiontext}% probably incomplete \endgroup} % setup enumerations -\def\setupenumerations +\unexpanded\def\setupenumerations {\dodoubleempty\dosetupenumerations} \def\dodosetupenumerations[#1][#2]% @@ -514,7 +550,7 @@ % define enumerations -\def\defineenumeration +\unexpanded\def\defineenumeration {\dotripleemptywithset\dodefineenumeration} \def\dodefineenumeration[#1][#2][#3]% #2 or #3 assignment @@ -529,13 +565,13 @@ {\normalexpanded{\noexpand\dodefineenumerationcommands{#1}{\recurselevel}{\@@subslevel\v!sub}{\??dd\@@subslevel#1}}% \edef\@@subslevel{\@@subslevel\v!sub}}% \else % clone - \getparameters[\??dd#1][\s!counter=#2,#3]% + \getparameters[\??dd#1][\s!parent=\??dd#2,#3]% \let\@@subslevel\empty \dorecurse{\descriptionparameter\c!levels} {\normalexpanded{\noexpand\dodefineenumerationcommands{#1}{\recurselevel}{\@@subslevel}{\??dd\@@subslevel#2}}% \edef\@@subslevel{\@@subslevel\v!sub}}% \fi - \edef\currentdescriptioncounter{\descriptionparameter\c!number}% + \edef\currentdescriptioncounter{\descriptionparameter\s!counter}% \ifx\currentdescriptioncounter\empty \ifdone\dodefineenumerationcounter{#1}\fi \else\ifx\currentdescriptioncounter\v!yes @@ -544,8 +580,10 @@ \ifdone\dodefineenumerationcounter{#1}\fi \else \letvalue{\??dd#1\s!counter}\currentdescriptioncounter % ? + %[[#1:\currentdescriptioncounter]] \doifstructurecounterelse{\currentdescriptioncounter}{}{\dodefineenumerationcounter\currentdescriptioncounter}% - \fi\fi\fi} + \fi\fi\fi + \dosetupenumerationcounter{#1}} % new \newtoks\everysetupenumerationcounter \let\currentenumerationcountername\empty @@ -565,9 +603,9 @@ \def\dodefineenumerationcommands#1#2#3#4% since we use \currentdescription, we need an edef {\setevalue{\??dd#3#1\s!parent}{#4}% - \unexpanded\setevalue {#3#1}{\noexpand\doenumerationcommand{#1}{#2}{#3}}% - \unexpanded\setevalue{\e!start#3#1}{\noexpand\doenumerationstart {#1}{#2}{#3}}% - \unexpanded\setevalue{\e!stop #3#1}{\noexpand\doenumerationstop {#1}{#2}{#3}}} + \setuevalue {#3#1}{\noexpand\doenumerationcommand{#1}{#2}{#3}}% + \setuevalue{\e!start#3#1}{\noexpand\doenumerationstart {#1}{#2}{#3}}% + \setuevalue{\e!stop #3#1}{\noexpand\doenumerationstop {#1}{#2}{#3}}} % handle enumeration @@ -592,98 +630,96 @@ \newtoks \everyenumeration \newconditional\enumerationnumberenabled -\chardef \enumerationcouplingmode \zerocount \def \enumerationdisablenumbersignal {-} \appendtoks \disablepseudocaps \to \everyenumeration % sorry, uppercase causes troubles -\letvalue{\??dd:\c!couplingway:\v!local }\plusone -\letvalue{\??dd:\c!couplingway:\v!global}\plustwo +\setvalue{\??dd:\v!enumeration:\s!handler:\s!number}{\@@doenumerationnumber} +\setvalue{\??dd:\v!enumeration:\s!handler:\s!text }{\@@doenumerationtext} +\setvalue{\??dd:\v!enumeration:\s!handler }{\@@doenumerationhandler} +\setvalue{\??dd:\v!enumeration:\s!handler:\s!do }{\@@somedescription} +\setvalue{\??dd:\v!enumeration:\s!handler:\s!start }{\@@startsomedescription} -\setvalue{\??dd:\v!enumeration:\s!handler }{\@@doenumerationhandler} -\setvalue{\??dd:\v!enumeration:\s!handler:\s!do }{\@@somedescription} -\setvalue{\??dd:\v!enumeration:\s!handler:\s!start}{\@@startsomedescription} +\let\@@doenumerationhandler\@@dodescriptionhandler -\def\@@doenumerationhandler#1% - {\strut - \ifconditional\enumerationnumberenabled +% \def\currentenumerationfullnumber +% {\ctxlua{structure.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} + +\def\@@doenumerationnumber + {\ctxlua{structure.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} + +\def\@@dodoenumerationtext + {\ctxlua{structure.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} + +\def\doenumerationnumber + {\descriptionparameter\c!left + \descriptionparameter\c!starter + \dodescriptionnumber + \descriptionparameter\c!stopper + \descriptionparameter\c!right} + +\def\@@doenumerationtext + {\ifconditional\enumerationnumberenabled \iftrialtypesetting - \doenumerationfullnumber\showdntext{#1}% + \doenumerationfullnumber\showdntext \doenumerationcouplingsymbol \else \doenumerationregistercoupling - \doenumerationfullnumber\showdntext{#1}% + \doenumerationfullnumber\showdntext \doenumerationcouplingsymbol \fi \else - \doenumerationfullnumber\showdnpuretext{#1}% - \fi - \iftrialtypesetting \else - \currentdescriptionsynchronize - \dosetattribute{destination}\currentdescriptionattribute % todo + \doenumerationfullnumber\showdnpuretext \fi} +\def\doenumerationfullnumber#1% text, title + {\begingroup + \dosetdescriptionattributes\c!headstyle\c!headcolor + \the\everyenumeration + \descriptionparameter\c!command{\strut#1\doenumerationnumber\doenumerationextratext}% + \endgroup} + +\def\doenumerationextratext + {\doif{\descriptionparameter\c!title}\v!yes + {\begingroup + \dosetdescriptionattributes\c!titlestyle\c!titlecolor + \hskip\descriptionparameter\c!titledistance + \descriptionparameter\c!titlecommand + {\descriptionparameter\c!titleleft + \begstrut\@@dodoenumerationtext\endstrut + \descriptionparameter\c!titleright}% + \endgroup}} + \def\doenumerationsavecounter {\savestructurecounter[\currentdescriptionnumber]} \def\doenumerationrestorecounter {\restorestructurecounter[\currentdescriptionnumber]} \def\doenumerationincrementcounter{\doincrementsubstructurecounter[\currentdescriptionnumber][\currentdescriptionlevel]} +% to be used in for instance: +% +% coupling=questions .... coupling=answers +% +% we will provide some more control, like skipping etc or reference relates + \def\doenumerationcheckconditions {\doifelse{\descriptionparameter\c!number}\v!yes {\ifx\currentdescriptionreference\enumerationdisablenumbersignal \setfalse\enumerationnumberenabled \else \settrue\enumerationnumberenabled \fi}% {\setfalse\enumerationnumberenabled}% - \chardef\enumerationcouplingmode \iflocation - \executeifdefined{\??dd:\c!couplingway:\descriptionparameter\c!coupling}\zerocount - \else - \zerocount - \fi} + \edef\currentenumerationcoupling{\descriptionparameter\c!coupling}} \def\doenumerationregistercoupling {\iflocation - \ifcase\enumerationcouplingmode - \or - % todo - \or - % todo - \fi + % no area yet, we will provide variants some day \fi} \def\doenumerationcouplingsymbol - {\iflocation\ifcase\enumerationcouplingmode \else - % todo - \fi\fi} - -\def\currentdescriptiontext - {\ctxlua{structure.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} + {\iflocation \ifx\currentenumerationcoupling\empty\else + \symbolreference[order(description:\currentenumerationcoupling:\nextinternalorderreference)]% + \fi \fi} -\def\currentenumerationfullnumber - {\ctxlua{structure.lists.savednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} - -\def\doenumerationfullnumber#1#2% text, title - {\begingroup - \dosetdescriptionattributes\c!headstyle\c!headcolor - \the\everyenumeration - \descriptionparameter\c!command - {\strut - #1% - \descriptionparameter\c!left - \currentenumerationfullnumber - % save cq. treat expansion etc - \doiftext{#2} % always true anyway - {\doif{\descriptionparameter\c!title}\v!yes - {\begingroup - \dosetdescriptionattributes\c!titlestyle\c!titlecolor - \hskip\descriptionparameter\c!titledistance - \descriptionparameter\c!titlecommand - {\descriptionparameter\c!titleleft - \begstrut#2\endstrut - \descriptionparameter\c!titleright}% - \endgroup}}% - % - \descriptionparameter\c!stopper - \descriptionparameter\c!right}% - \endgroup} +\def\skipenumerationcoupling[#1]% e.g. for questions with no answer + {\ctxlua{jobreferences.setnextorder("description","#1")}} \def\showdnpuretext{\strut\descriptionparameter\c!text} % geen spatie \def\showdnlisttext{\descriptionparameter\c!listtext} % space in default @@ -720,29 +756,59 @@ \def\dododescriptioncomponent[#1][#2]% #1=interfaced-settings, #2=optional user data {\begingroup % similar to structure so we might generalize this \getparameters[\??dd\currentdescription][#1]% - \edef\currentdescriptionexpansion{\descriptionparameter\c!expansion}% + % + \xdef\currentdescriptionexpansion {\descriptionparameter\c!expansion}% + \xdef\currentdescriptionxmlsetup {\descriptionparameter\c!xmlsetup}% + \xdef\currentdescriptioncatcodes {\descriptionparameter\s!catcodes}% + \xdef\currentdescriptionlabel {\descriptionparameter\c!label}% + \xdef\currentdescriptionreference {\descriptionparameter\c!reference}% + \xdef\currentdescriptionreferenceprefix{\descriptionparameter\c!referenceprefix}% + %xdef\currentdescriptionshownumber {\descriptionparameter\c!number}% + \xdef\currentdescriptionsaveinlist {\descriptionparameter\c!saveinlist}% + \xdef\currentdescriptionincrementnumber{\descriptionparameter\c!incrementnumber}% + % + \ifx\currentdescriptionexpansion\empty + \glet\currentdescriptionexpansion\v!no + \fi + % \ifx\currentdescriptionexpansion\s!xml - \xdef\currentdescriptiontitle {\detokenizeddescriptionparameter\c!title}% - \xdef\currentdescriptionbookmark{\detokenizeddescriptionparameter\c!bookmark}% \xmlstartraw - \xdef\currentdescriptionlisttitle {\descriptionparameter\c!title}% + \xdef\currentdescriptiontitle {\descriptionparameter\c!title}% + \xdef\currentdescriptionbookmark{\descriptionparameter\c!bookmark}% + \xdef\currentdescriptionmarking {\descriptionparameter\c!marking}% + \xdef\currentdescriptionlist {\descriptionparameter\c!list}% \xmlstopraw + \ifx\currentdescriptionlist\empty + \globallet\currentdescriptionlist\currentdescriptiontitle + \fi \globallet\currentdescriptioncoding\s!xml \else \ifx\currentdescriptionexpansion\v!yes \xdef\currentdescriptiontitle {\descriptionparameter\c!title}% \xdef\currentdescriptionbookmark{\descriptionparameter\c!bookmark}% + \xdef\currentdescriptionmarking {\descriptionparameter\c!marking}% + \xdef\currentdescriptionlist {\descriptionparameter\c!list}% \else \xdef\currentdescriptiontitle {\detokenizeddescriptionparameter\c!title}% \xdef\currentdescriptionbookmark{\detokenizeddescriptionparameter\c!bookmark}% + \xdef\currentdescriptionmarking {\detokenizeddescriptionparameter\c!marking}% + \xdef\currentdescriptionlist {\detokenizeddescriptionparameter\c!list}% + \iflocation \ifx\currentdescriptionbookmark\empty + \begingroup + \simplifycommands + \xdef\currentdescriptionbookmark{\detokenize\expandafter{\normalexpanded{\descriptionparameter\c!title}}}% + \endgroup + \fi \fi + \fi + \ifx\currentdescriptionlist\empty + \globallet\currentdescriptionlist\currentdescriptiontitle \fi - \globallet\currentdescriptionlisttitle \currentdescriptiontitle \globallet\currentdescriptioncoding\s!tex \fi - \xdef\currentdescriptionlabel {\descriptionparameter\c!label}% - \xdef\currentdescriptionreference{\descriptionparameter\c!reference}% % - \doif{\descriptionparameter\c!title}\v!none{\global\nodescriptioncaptiontrue\global\nodescriptionnumbertrue}% will become obsolete + \ifx\currentdescriptiontitle\v!none % will become obsolete + \global\nodescriptioncaptiontrue\global\nodescriptionnumbertrue + \fi % \ifconditional\enumerationnumberenabled \doifelsedescriptioncomponent\donothing\doenumerationincrementcounter @@ -753,16 +819,19 @@ \glet\currentdescriptionsynchronize\relax \glet\currentdescriptionattribute \relax \else - \setnextinternalreference + %\setnextinternalreference + \setnextinternalreferences{description}\currentdescriptionname % plural \xdef\currentdescriptionnumberentry{\ctxlua{structure.lists.push{ metadata = { kind = "description", name = "\currentdescriptionname", level = structure.sections.currentlevel(), catcodes = \the\catcodetable, + % \currentdirectionparameters }, references = { internal = \nextinternalreference, + order = \nextinternalorderreference, reference = "\currentdescriptionreference", referenceprefix = "\referenceprefix", block = "\currentstructureblock", @@ -774,8 +843,8 @@ \ifx\currentdescriptionbookmark\currentdescriptiontitle \else bookmark = \!!bs\detokenize\expandafter{\currentdescriptionbookmark}\!!es, \fi - \ifx\currentdescriptionlisttitle\currentdescriptiontitle \else % \ifx\currentdescriptionsaveinlist\v!no - list = \!!bs\detokenize\expandafter{\currentdescriptionlisttitle }\!!es, + \ifx\currentdescriptionlist\currentdescriptiontitle \else % \ifx\currentdescriptionsaveinlist\v!no + list = \!!bs\detokenize\expandafter{\currentdescriptionlist }\!!es, \fi % \fi }, \ifconditional\enumerationnumberenabled @@ -789,10 +858,11 @@ connector = \!!bs\descriptionparameter\c!prefixconnector\!!es, }, numberdata = { - numbers = structure.counters.compact("\currentdescriptionname",nil,true), + numbers = structure.counters.compact("\currentdescriptionnumber",nil,true), % ! number can be cloned separatorset = "\descriptionparameter\c!numberseparatorset", conversion = "\descriptionparameter\c!numberconversion", conversionset = "\descriptionparameter\c!numberconversionset", + starter = \!!bs\descriptionparameter\c!numberstarter\!!es, stopper = \!!bs\descriptionparameter\c!numberstopper\!!es, segments = "\descriptionparameter\c!numbersegments", }, @@ -800,11 +870,19 @@ userdata = structure.helpers.touserdata(\!!bs\detokenize{#2}\!!es) } }}% - \xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.setinternalreference("\referenceprefix","\currentdescriptionreference",\nextinternalreference,"\@@iafocus"))}}% - \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(\currentdescriptionnumberentry)}}% + \xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.setinternalreference("\referenceprefix","\currentdescriptionreference",\nextinternalreference,"\@@iafocus"))}}% + \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(\currentdescriptionnumberentry)}}% \fi \endgroup} +% This is not so nice, some day i'll just store the number with the entry +% and deal with all at the Lua end, but first we need to be able to set +% macros. + +\def\reinstatedescriptionnumberentry#1% + {\xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.getinternalreference(#1))}}% + \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(#1)}}} + \installstructurelistprocessor{description}{\usestructurelistprocessor{number+title}} % labels, we could share with enumerations and forget about the text; anyhow, figure @@ -814,10 +892,10 @@ % unfinished -\def\setuplabels +\unexpanded\def\setuplabels {\getparameters[\??db]} -\def\definelabel +\unexpanded\def\definelabel {\dotripleargumentwithset\dodefinelabel} \def\dodefinelabel[#1][#2][#3]% #2 or #3 assignment @@ -835,12 +913,12 @@ \fi} \def\dodefinelabelcommands#1#2% - {\unexpanded\setevalue {#1}{\noexpand\dolabelnumbercommand {#1}}% - \unexpanded\setevalue{\c!reset #1}{\noexpand\doresetlabelnumber {#1}}% - %\unexpanded\setevalue{\c!set #1}{\noexpand\dosetlabelnumber {#1}}% [#2] or {#2} ? - \unexpanded\setevalue{\e!next #1}{\noexpand\donextlabelnumber {#1}}% - \unexpanded\setevalue{\e!increment#1}{\noexpand\doincrementlabelnumber{#1}}% - \unexpanded\setevalue{\c!current #1}{\noexpand\docurrentlabelnumber {#1}}} + {\setuevalue {#1}{\noexpand\dolabelnumbercommand {#1}}% + \setuevalue{\c!reset #1}{\noexpand\doresetlabelnumber {#1}}% + %\setuevalue{\c!set #1}{\noexpand\dosetlabelnumber {#1}}% [#2] or {#2} ? + \setuevalue{\e!next #1}{\noexpand\donextlabelnumber {#1}}% + \setuevalue{\e!increment#1}{\noexpand\doincrementlabelnumber{#1}}% + \setuevalue{\c!current #1}{\noexpand\docurrentlabelnumber {#1}}} % this is just for downward compatibility, we might drop it @@ -884,7 +962,7 @@ % to be reimplmented -\def\setupindentations +\unexpanded\def\setupindentations {\dodoubleempty\dosetupindentations} \def\dosetupindentations[#1][#2]% @@ -897,7 +975,7 @@ \def\dodosetupindentations[#1][#2]% {\getparameters[\??ds#1][#2]} -\def\defineindenting +\unexpanded\def\defineindenting {\dodoubleargumentwithset\dodefineindenting} \def\dodefineindenting[#1][#2]% @@ -905,9 +983,9 @@ [\c!text,\c!separator,\c!width,\c!style,\c!color, \c!headstyle,\c!sample,\c!before,\c!after,\c!distance]% \getparameters[\??ds#1][#2]% - \unexpanded\setvalue {#1}{\dododefineindenting{#1}{0}{1}}% - \unexpanded\setvalue {\v!sub#1}{\dododefineindenting{#1}{1}{2}}% - \unexpanded\setvalue{\v!sub\v!sub#1}{\dododefineindenting{#1}{2}{3}}} + \setuvalue {#1}{\dododefineindenting{#1}{0}{1}}% + \setuvalue {\v!sub#1}{\dododefineindenting{#1}{1}{2}}% + \setuvalue{\v!sub\v!sub#1}{\dododefineindenting{#1}{2}{3}}} \def\dododefineindenting#1#2#3% {\par @@ -953,6 +1031,7 @@ \c!hang=, \c!sample=, \c!align=, + \c!headalign=, \c!margin=\v!no, \c!before=\blank, \c!inbetween=\blank, @@ -970,12 +1049,35 @@ [\c!location=\v!top, \c!text=, \c!way=\v!by\v!text, + \c!prefix=\v!no, \c!prefixconnector=., + \c!starter=, \c!stopper=, \c!number=\v!yes, % else description \c!start=0, \s!parent=\??dd] +\setupdescriptions + [\c!expansion=\v!no, + \c!xmlsetup=, + \s!catcodes=, + \c!saveinlist=\v!yes] + +\setupenumerations + [\c!expansion=\v!no, + \c!xmlsetup=, + \s!catcodes=, + \c!saveinlist=\v!yes] + +\setupdescriptions + [\c!width=7em, + \c!distance=1em] + +\setupdescriptions[\c!width:\c!top=\localhsize] % undocumented, only width and distance +% \setupdescriptions[\c!width:\c!left=7em,\c!distance=1em] +% \setupdescriptions[\c!width:\c!right=7em,\c!distance=1em] + + \setuplabels [\s!parent=\??dn] |