diff options
Diffstat (limited to 'tex/context/base/core-sec.tex')
-rw-r--r-- | tex/context/base/core-sec.tex | 224 |
1 files changed, 153 insertions, 71 deletions
diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex index 14af7f030..d628188a0 100644 --- a/tex/context/base/core-sec.tex +++ b/tex/context/base/core-sec.tex @@ -11,6 +11,9 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% start-stop per section en dan combineren met sectieblok; in dat geval +% eenvoudiger per-* acties + % nummeren per sectieblok implementeren % this module needs a clean up, currently some manipulations @@ -458,20 +461,20 @@ {\doifnot{#1}\lastsection {\donexttrackcommando{\nextsection{#1}}}} -\newif\ifalllevels +\chardef\alltoclevels\zerocount % \newif\ifalllevels \let\currentlevel\empty \def\dosetcurrentlevel#1% - {\global\alllevelsfalse + {\global\chardef\alltoclevels\zerocount \xdef\currentlevel{\getvalue{\lastsection\s!format}}} \def\dosetpreviouslevel#1% - {\global\alllevelstrue + {\global\chardef\alltoclevels\plusone \globallet\currentlevel\empty \def\dobacktrackcommando##1% {\ifnum\countervalue{\??se##1}>\zerocount - \global\alllevelsfalse + \global\chardef\alltoclevels\zerocount \xdef\currentlevel{\getvalue{\previoussection{##1}\s!format}}% \else \dobacktracklevel{##1}% @@ -479,7 +482,7 @@ \dobacktrackcommando\lastsection} \def\dosettextlevel#1% - {\global\alllevelstrue + {\global\chardef\alltoclevels\plusone \globallet\currentlevel\empty} \def\dosetotherlevel#1% @@ -487,16 +490,16 @@ {\edef\@@sectie{\getvalue{\??ko#1\c!sectie}}} % hoofdstuk\c!format {\edef\@@sectie{#1}}% \doifdefinedelse{\??se\@@sectie} - {\global\alllevelsfalse + {\global\chardef\alltoclevels\zerocount \xdef\currentlevel{\getvalue{\@@sectie\s!format}}} - {\global\alllevelstrue + {\global\chardef\alltoclevels\plusone \globallet\currentlevel\empty \def\dobacktrackcommando##1% {\@EA\ifx\csname\??se##1\c!start\endcsname\relax \dobacktracklevel{##1}% \else \ifnum\countervalue{\??se##1}>\zerocount - \global\alllevelsfalse + \global\chardef\alltoclevels\zerocount \xdef\currentlevel{\getvalue{##1\s!format}}% \else \dobacktracklevel{##1}% @@ -513,9 +516,9 @@ \else\ifx\askedlevel\v!vorige \dosetpreviouslevel\askedlevel \else\ifx\askedlevel\v!alles - \global\alllevelstrue + \global\chardef\alltoclevels\plusone \else\ifx\askedlevel\v!tekst - \global\alllevelstrue + \global\chardef\alltoclevels\plusone \else \edef\byaskedlevel{\csname\??by\askedlevel\endcsname}% \ifx\byaskedlevel\v!tekst @@ -530,9 +533,14 @@ \fi \egroup} -\def\dontsetfilterlevel#1% +% \def\dontsetfilterlevel#1#2% +% {\let\currentlevel\somesavedlevel +% \chardef\alltoclevels\zerocount} + +\def\dontsetfilterlevel#1#2% {\let\currentlevel\somesavedlevel - \alllevelsfalse} + \let\@@sectiontype\@@tocsectiontype + \chardef\alltoclevels\zerocount} \def\honorlocalfilterlevel % local lists will be real local {\let\dosetfilterlevel\dontsetfilterlevel} @@ -540,36 +548,36 @@ % cleaner % % \def\doifnextlevelelse[#1::#2]#3#4% -% {\ifalllevels -% #3% -% \else +% {\ifcase\alltoclevels % \doifelse{\@@sectiontype}{#1} % {\doifinstringelse{=\currentlevel:}{=:#2:} % {\doifinstringelse{=\currentlevel:0}{=:#2:}{#4}{#3}} % {#4}} % {#4}% +% \else +% #3% % \fi} % % \def\doifprevlevelelse[#1::#2]#3#4% -% {\ifalllevels -% #3% -% \else +% {\ifcase\alltoclevels % \doifelse{\@@sectiontype}{#1} % {\doifinstringelse{=\currentlevel:}{=:#2:}{#3}{#4}} % {#4}% +% \else +% #3% % \fi} % % faster % % \def\doifnextlevelelse[#1::#2]% -% {\ifalllevels -% \donetrue -% \else +% {\ifcase\alltoclevels % \doifelse{\@@sectiontype}{#1} % {\doifinstringelse{=\currentlevel:}{=:#2:} % {\doifinstringelse{=\currentlevel:0}{=:#2:}\donefalse\donetrue} % \donefalse} % \donefalse +% \else +% \donetrue % \fi % \ifdone % \expandafter\firstoftwoarguments @@ -578,12 +586,12 @@ % \fi} % % \def\doifprevlevelelse[#1::#2]% -% {\ifalllevels -% \donetrue -% \else +% {\ifcase\alltoclevels % \doifelse{\@@sectiontype}{#1} % {\doifinstringelse{=\currentlevel:}{=:#2:}\donetrue\donefalse} % \donefalse +% \else +% \donetrue % \fi % \ifdone % \expandafter\firstoftwoarguments @@ -604,14 +612,14 @@ % \def\doifnextlevelelse[#1::#2]% % {\dosavesomelevel[#2:0:0:0:0]% -% \ifalllevels -% \donetrue -% \else +% \ifcase\alltoclevels % \doifelse{\@@sectiontype}{#1} % {\doifinstringelse{=\currentlevel:}{=:#2:} % {\doifinstringelse{=\currentlevel:0}{=:#2:}\donefalse\donetrue} % \donefalse} % \donefalse +% \else +% \donetrue % \fi % \ifdone % \expandafter\firstoftwoarguments @@ -621,12 +629,12 @@ % % \def\doifprevlevelelse[#1::#2]% % {\dosavesomelevel[#2:0:0:0:0]% -% \ifalllevels -% \donetrue -% \else +% \ifcase\alltoclevels % \doifelse{\@@sectiontype}{#1} % {\doifinstringelse{=\currentlevel:}{=:#2:}\donetrue\donefalse} % \donefalse +% \else +% \donetrue % \fi % \ifdone % \expandafter\firstoftwoarguments @@ -638,16 +646,18 @@ % \def\doifnextlevelelse[#1::#2]% beware: this one is \let % {\dosavesomelevel[#2:0:0:0:0]% -% \ifalllevels -% \donetrue -% \else\ifnum\@@sectiontype=#1 -% \def\levelstring{=:#2:}% -% \doifincsnameelse{=\currentlevel:}\levelstring -% {\doifincsnameelse{=\currentlevel:0}\levelstring\donefalse\donetrue} +% \ifcase\alltoclevels +% \ifnum\@@sectiontype=#1 +% \def\levelstring{=:#2:}% +% \doifincsnameelse{=\currentlevel:}\levelstring +% {\doifincsnameelse{=\currentlevel:0}\levelstring\donefalse\donetrue} +% \donefalse +% \else % \donefalse +% \fi % \else -% \donefalse -% \fi\fi +% \donetrue +% \fi % \ifdone % \expandafter\firstoftwoarguments % \else @@ -656,13 +666,15 @@ % %\def\doifprevlevelelse[#1::#2]% beware: this one is \let % {\dosavesomelevel[#2:0:0:0:0]% -% \ifalllevels -% \donetrue -% \else\ifnum\@@sectiontype=#1 -% \doifinstringelse{=\currentlevel:}{=:#2:}\donetrue\donefalse +% \ifcase\alltoclevels +% \ifnum\@@sectiontype=#1 +% \doifinstringelse{=\currentlevel:}{=:#2:}\donetrue\donefalse +% \else +% \donefalse +% \fi % \else -% \donefalse -% \fi\fi +% \donetrue +% \fi % \ifdone % \expandafter\firstoftwoarguments % \else @@ -675,26 +687,73 @@ % % we want to be able to overload them globally -% This will be reimplemented +% This will be reimplemented some day soon % % {nn}{xx}{yy} % % -> \scan{..}{..}{0} met 0 als sentinel +% still not perfect +% +% \def\doifnextlevelelse[#1]% !! this one is \let / uti seperator -- +% {\edef\somesavedlevel{\sectionseparator\@@filterlevelpart[#1]}% +% \ifcase\alltoclevels +% \ifnum\@@sectiontype=\@@filterblockpart[#1]\relax +% \edef\levelstring{=\sectionseparator\@@filternumberpart[#1]\sectionseparator}% +% \doifincsnameelse{=\currentlevel\sectionseparator}\levelstring +% {\doifincsnameelse{=\currentlevel\sectionseparator0}\levelstring +% \donefalse +% \donetrue} +% \donefalse +% \else +% \donefalse +% \fi +% \else +% \donetrue +% \fi +% \ifdone +% \expandafter\firstoftwoarguments +% \else +% \expandafter\secondoftwoarguments +% \fi} +% +% \def\doifprevlevelelse[#1]% !! this one is \let / uti seperator -- +% {\edef\somesavedlevel{\sectionseparator\@@filterlevelpart[#1]}% +% \ifcase\alltoclevels +% \ifnum\@@sectiontype=\@@filterblockpart[#1]\relax +% \doifinstringelse +% {=\currentlevel\sectionseparator} +% {=\sectionseparator\@@filternumberpart[#1]\sectionseparator} +% \donetrue\donefalse +% \else +% \donefalse +% \fi +% \else +% \donetrue +% \fi +% \ifdone +% \expandafter\firstoftwoarguments +% \else +% \expandafter\secondoftwoarguments +% \fi} + \def\doifnextlevelelse[#1]% !! this one is \let / uti seperator -- {\edef\somesavedlevel{\sectionseparator\@@filterlevelpart[#1]}% - \ifalllevels - \donetrue - \else\ifnum\@@sectiontype=\@@filterblockpart[#1]\relax - \edef\levelstring{=\sectionseparator\@@filternumberpart[#1]\sectionseparator}% - \doifincsnameelse{=\currentlevel\sectionseparator}\levelstring - {\doifincsnameelse{=\currentlevel\sectionseparator0}\levelstring - \donefalse - \donetrue} + \edef\@@tocsectiontype{\@@filterblockpart[#1]}% needed for nested tocs + \ifcase\alltoclevels + \ifnum\@@sectiontype=\@@tocsectiontype\relax + \edef\levelstring{=\sectionseparator\@@filternumberpart[#1]\sectionseparator}% + \doifincsnameelse{=\currentlevel\sectionseparator}\levelstring + {\doifincsnameelse{=\currentlevel\sectionseparator0}\levelstring + \donefalse + \donetrue} + \donefalse + \else \donefalse + \fi \else - \donefalse - \fi\fi + \donetrue + \fi \ifdone \expandafter\firstoftwoarguments \else @@ -703,22 +762,43 @@ \def\doifprevlevelelse[#1]% !! this one is \let / uti seperator -- {\edef\somesavedlevel{\sectionseparator\@@filterlevelpart[#1]}% - \ifalllevels - \donetrue - \else\ifnum\@@sectiontype=\@@filterblockpart[#1]\relax - \doifinstringelse - {=\currentlevel\sectionseparator} - {=\sectionseparator\@@filternumberpart[#1]\sectionseparator} - \donetrue\donefalse + \edef\@@tocsectiontype{\@@filterblockpart[#1]}% needed for nested tocs + \ifcase\alltoclevels + \ifnum\@@sectiontype=\@@tocsectiontype\relax + \doifinstringelse + {=\currentlevel\sectionseparator} + {=\sectionseparator\@@filternumberpart[#1]\sectionseparator} + \donetrue\donefalse + \else + \donefalse + \fi \else - \donefalse - \fi\fi + \donetrue + \fi \ifdone \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} +% we need to cover the special case of nested lists in section blocks +% +% \starttext +% +% \def\ChapterEntry#1#2#3% +% {chapter : \hbox to \hsize{\strut\bf#2\hss#3}\endgraf\placelist[section]} +% +% \startfrontmatter % optional +% \placelist[chapter][alternative=command,command=\ChapterEntry,criterium=text] \page +% \stopfrontmatter % optional +% +% \startbodymatter % optional +% \chapter{first} \section{one} test \section{two} test \page +% \chapter{second} \section{alpha} test \section{beta} test \page +% \stopbodymatter % optional +% +% \stoptext + \def\doiftoclevelelse{\doifnextlevelelse} \def\doifreglevelelse{\doifprevlevelelse} \def\doifblklevelelse{\doifprevlevelelse} @@ -1254,6 +1334,8 @@ [ \v!ja=>\verhoognummertrue, \v!nee=>\verhoognummerfalse, \v!lijst=>\verhoognummerfalse + % beware, since no numbers are used, no nested lists are + % possible here \naarlijsttrue, \s!unknown=>{\ifx\currentproduct\empty \findsectionnumber{#1}\commalistelement{#4}% @@ -1303,7 +1385,7 @@ \resetsectionmarks\@@sectie \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% \let\fullsectionnumber\writtenfullsectionnumber - \doschrijfnaarlijst{\@@koppeling}{\someheadconversion}{#4}{\v!kop}}% + \doschrijfnaarlijst\@@koppeling\someheadconversion{#4}\v!kop}% {\dohandleheadnumber\someheadconversion}% handle is new {#4} {\marking[#1]{#4}% @@ -1319,7 +1401,7 @@ \rawreference\s!sec{#2}{{#3}{\asciititle}}% \resetsectionmarks\@@sectie \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% - \doschrijfnaarlijst{\@@koppeling}{#3}{#4}{\v!kop}} + \doschrijfnaarlijst\@@koppeling{#3}{#4}\v!kop} {\sectiebloklabel{#1}{\dohandleheadnumber{#3}}}% handle is new {#4} {\marking[#1]{#4}% @@ -1338,7 +1420,7 @@ \rawreference\s!sec{#2}{{#3}{\asciititle}}% \resetsectionmarks\@@sectie \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% - \doschrijfnaarlijst{\@@koppeling}{}{#4}{\v!kop}} + \doschrijfnaarlijst\@@koppeling{}{#4}\v!kop} {#4} {\marking[#1]{#4}% \doifelsevalue{\??ko#1\c!eigennummer}\v!ja % brrr @@ -1390,11 +1472,11 @@ \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% \ifkopnummer \rawreference\s!sec{#2}{{#3}{\asciititle}}% - \doschrijfnaarlijst{\@@koppeling}{#3}{#4}{\v!kop}% + \doschrijfnaarlijst\@@koppeling{#3}{#4}\v!kop \writesection{#1}{#3}{#4}% \else \rawreference\s!sec{#2}{{#3}{\asciititle}}% - \doschrijfnaarlijst{\@@koppeling}{}{#4}{\v!kop}% + \doschrijfnaarlijst\@@koppeling{}{#4}\v!kop \writesection{#1}{-}{#4}% \fi \egroup @@ -1447,7 +1529,7 @@ \bgroup \stelkopnummerin[#1][+1]% traag, wordt \getvalue{\c!volgende...} \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% - \doschrijfnaarlijst{\@@koppeling}{}{#2}{\v!kop}% + \doschrijfnaarlijst\@@koppeling{}{#2}\v!kop \stelkopnummerin[#1][-1]% traag, wordt \getvalue{\c!vorige...} \egroup \fi} @@ -2035,7 +2117,7 @@ \setvalue{#1}% {\dodoubleempty\dosomekop[#1]}} -\def\definieerkop% +\def\definieerkop {\dodoubleemptywithset\dodefinieerkop} \def\dosomekop[#1][#2]% |