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 | 125 |
1 files changed, 79 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-des.mkiv b/Master/texmf-dist/tex/context/base/strc-des.mkiv index 29e4ea36c80..54eba1eaa65 100644 --- a/Master/texmf-dist/tex/context/base/strc-des.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-des.mkiv @@ -70,6 +70,8 @@ \def\descriptionmainparameter #1{\csname\dodescriptionparameter{\??dd\currentdescriptionmain }#1\endcsname} \def\descriptionnumberparameter#1{\csname\dodescriptionparameter{\??dd\currentdescriptionnumber}#1\endcsname} +\def\nameddescriptionparameter #1#2{\csname\dodescriptionparameter{\??dd#1}#2\endcsname} + \def\detokenizeddescriptionparameter#1{\detokenize\expandafter\expandafter\expandafter{\csname\??dd\currentdescription#1\endcsname}} \def\dodescriptionparameter#1#2% @@ -239,10 +241,10 @@ \nobreak \@@dodescription} -\def\do@@description#1% +\def\do@@description#1% temp hack, the scope {\def\\{\crlf}% \noindent - #1{\ifhbox\descriptionheadbox\unhcopy\else\copy\fi\descriptionheadbox}% + #1[\c!scope=\v!local]{\ifhbox\descriptionheadbox\unhcopy\else\copy\fi\descriptionheadbox}% \@@dodescription} \setvalue{@@description\v!inmargin }{\do@@description\inmargin} @@ -321,8 +323,10 @@ %D A new key 'headalign' in definitions. +\newconstant\nesteddescriptionstate + \def\resetdescriptions % to be used in e.g. footnotes - {\chardef\nesteddescriptionstate\zerocount} + {\nesteddescriptionstate\zerocount} \resetdescriptions @@ -338,7 +342,7 @@ \fi \setbox\descriptionheadbox\hbox {\forgetall\dontcomplain - \trialtypesettingtrue + \settrialtypesetting \doifelsenothing{\descriptionparameter\c!sample} {\dodescriptionhandler\currentdescriptiontext}% {\dodescriptionhandler\currentdescriptionsample}}% @@ -359,9 +363,9 @@ \normalexpanded{\noexpand\indenting[\descriptionparameter\c!indenting]}% % better a system mode \ifcase\nesteddescriptionstate - \chardef\nesteddescriptionstate\plusone + \nesteddescriptionstate\plusone \or - \chardef\nesteddescriptionstate\plustwo + \nesteddescriptionstate\plustwo \fi % now happens elsewhere : \noindent\ignorespaces \@@resetdescriptionclosesymbol} @@ -374,11 +378,14 @@ \def\@@stopdescription {\@@placedescriptionclosesymbol - \par % else we loose + \doifnot{\descriptionparameter\c!display}\v!no\par + \dostoptagged + \dostoptagged \endgroup \descriptionparameter\c!after % which currentdescription is taken here? - \egroup % temporary hack - \checknextindentation[\descriptionparameter\c!indentnext] + \normalexpanded + {\egroup % temporary hack + \noexpand\checknextindentation[\descriptionparameter\c!indentnext]}% \dorechecknextindentation} \def\@@dodescription @@ -412,6 +419,8 @@ \BeforePar{\@@makedescription[#1]{#2}}% \GotoPar} +\let\dotagsetdescriptiontag\relax + \def\@@dostartdescriptionindeed {\edef\currentdescriptionlocation{\descriptionparameter\c!location}% \ifx\currentdescriptionlocation\empty @@ -420,15 +429,20 @@ \ifcsname @@description\currentdescriptionlocation\endcsname \else \let\currentdescriptionlocation\v!left \fi + \dostarttagged\t!description\currentdescription + \dostarttagged\t!descriptiontag\empty + \dotagsetdescriptiontag \@@dostartdescription - \csname @@description\currentdescriptionlocation\endcsname} % args not needed + \csname @@description\currentdescriptionlocation\endcsname + \dostoptagged + \dostarttagged\t!descriptioncontent\empty} % args not needed \def\@@makedescription[#1]#2% - {\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} + {\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} @@ -522,7 +536,7 @@ \fi#1} \def\@@dododescriptiontext - {\ctxlua{structure.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} + {\ctxlua{structures.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} \def\@@dodescriptiontext {\begingroup @@ -590,7 +604,7 @@ \def\dosetupenumerationcounter#1% {\edef\currentenumerationcountername{#1}% only used in the token list - \edef\currentdiscription{#1}% + \edef\currentdescription{#1}% \the\everysetupenumerationcounter} \appendtoks @@ -603,9 +617,12 @@ \def\dodefineenumerationcommands#1#2#3#4% since we use \currentdescription, we need an edef {\setevalue{\??dd#3#1\s!parent}{#4}% - \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}}} + \setuevalue {#3#1}{\noexpand\doenumerationcommand {#1}{#2}{#3}}% + \setuevalue{\c!reset#3#1}{\noexpand\doresetenumerationnumber{#1}{#2}{#3}}% + %setuevalue{\c!set #3#1}{\noexpand\dosetenumerationnumber {#1}{#2}{#3}}% + \setuevalue{\e!next #3#1}{\noexpand\donextenumerationnumber {#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 @@ -643,13 +660,13 @@ \let\@@doenumerationhandler\@@dodescriptionhandler % \def\currentenumerationfullnumber -% {\ctxlua{structure.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} +% {\ctxlua{structures.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} \def\@@doenumerationnumber - {\ctxlua{structure.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} + {\ctxlua{structures.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} \def\@@dodoenumerationtext - {\ctxlua{structure.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} + {\ctxlua{structures.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} \def\doenumerationnumber {\descriptionparameter\c!left @@ -661,18 +678,32 @@ \def\@@doenumerationtext {\ifconditional\enumerationnumberenabled \iftrialtypesetting - \doenumerationfullnumber\showdntext + \doenumerationfullnumberyes \doenumerationcouplingsymbol \else \doenumerationregistercoupling - \doenumerationfullnumber\showdntext + \doenumerationfullnumberyes \doenumerationcouplingsymbol \fi \else - \doenumerationfullnumber\showdnpuretext + \doenumerationfullnumbernop \fi} -\def\doenumerationfullnumber#1% text, title +\def\doenumerationfullnumberyes % text, title + {\begingroup + \dosetdescriptionattributes\c!headstyle\c!headcolor + \the\everyenumeration + \descriptionparameter\c!command{\strut\showdntext\doenumerationnumber\doenumerationextratext}% + \endgroup} + +\def\doenumerationfullnumbernop % text, title + {\begingroup + \dosetdescriptionattributes\c!headstyle\c!headcolor + \the\everyenumeration + \descriptionparameter\c!command{\strut\showdnpuretext\doenumerationextratext}% + \endgroup} + +\def\doenumerationfullnumber#1% text, title (used in notes) .. todo {\begingroup \dosetdescriptionattributes\c!headstyle\c!headcolor \the\everyenumeration @@ -681,14 +712,15 @@ \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}} + {\doifsomething\@@dodoenumerationtext + {\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]} @@ -719,7 +751,7 @@ \fi \fi} \def\skipenumerationcoupling[#1]% e.g. for questions with no answer - {\ctxlua{jobreferences.setnextorder("description","#1")}} + {\ctxlua{structures.references.setnextorder("description","#1")}} \def\showdnpuretext{\strut\descriptionparameter\c!text} % geen spatie \def\showdnlisttext{\descriptionparameter\c!listtext} % space in default @@ -745,7 +777,7 @@ \newif\ifnodescriptioncaption \def\doifelsedescriptioncomponent - {\ctxlua{structure.lists.doifstoredelse(currentdescriptionnumberentry)}} + {\ctxlua{structures.lists.doifstoredelse(currentdescriptionnumberentry)}} \def\dodescriptioncomponent {\doifelsedescriptioncomponent\nododescriptioncomponent\dododescriptioncomponent} @@ -821,11 +853,11 @@ \else %\setnextinternalreference \setnextinternalreferences{description}\currentdescriptionname % plural - \xdef\currentdescriptionnumberentry{\ctxlua{structure.lists.push{ + \xdef\currentdescriptionnumberentry{\ctxlua{structures.lists.push{ metadata = { kind = "description", name = "\currentdescriptionname", - level = structure.sections.currentlevel(), + level = structures.sections.currentlevel(), catcodes = \the\catcodetable, % \currentdirectionparameters }, @@ -835,7 +867,7 @@ reference = "\currentdescriptionreference", referenceprefix = "\referenceprefix", block = "\currentstructureblock", - section = structure.sections.currentid(), + section = structures.sections.currentid(), }, titledata = { label = \!!bs\detokenize\expandafter{\currentdescriptionlabel }\!!es, @@ -858,7 +890,7 @@ connector = \!!bs\descriptionparameter\c!prefixconnector\!!es, }, numberdata = { - numbers = structure.counters.compact("\currentdescriptionnumber",nil,true), % ! number can be cloned + numbers = structures.counters.compact("\currentdescriptionnumber",nil,true), % ! number can be cloned separatorset = "\descriptionparameter\c!numberseparatorset", conversion = "\descriptionparameter\c!numberconversion", conversionset = "\descriptionparameter\c!numberconversionset", @@ -867,11 +899,11 @@ segments = "\descriptionparameter\c!numbersegments", }, \fi - userdata = structure.helpers.touserdata(\!!bs\detokenize{#2}\!!es) + userdata = structures.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(structures.references.setinternalreference("\referenceprefix","\currentdescriptionreference",\nextinternalreference,"\interactionparameter\c!focus"))}}% + \xdef\currentdescriptionsynchronize{\ctxlatelua{structures.lists.enhance(\currentdescriptionnumberentry)}}% \fi \endgroup} @@ -880,8 +912,8 @@ % macros. \def\reinstatedescriptionnumberentry#1% - {\xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.getinternalreference(#1))}}% - \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(#1)}}} + {\xdef\currentdescriptionattribute {\ctxlua {tex.write(structures.references.getinternalreference(#1))}}% + \xdef\currentdescriptionsynchronize{\ctxlatelua{structures.lists.enhance(#1)}}} \installstructurelistprocessor{description}{\usestructurelistprocessor{number+title}} @@ -1042,6 +1074,7 @@ \c!titleright=), \c!closesymbol=, \c!closecommand=\wordright, + \c!display=\v!yes, \c!command=, \c!titlecommand=] |