summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/strc-reg.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/strc-reg.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/strc-reg.mkiv104
1 files changed, 93 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/strc-reg.mkiv b/Master/texmf-dist/tex/context/base/mkiv/strc-reg.mkiv
index 559e1bd4231..e955c700ba7 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/strc-reg.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/strc-reg.mkiv
@@ -425,7 +425,12 @@
\def\strc_registers_finish_entry_indeed#1#2#3% register data userdata
{\begingroup
\edef\currentregister{#1}%
- \setupcurrentregister[\c!entries=,\c!label=,\c!keys=,\c!alternative=,#2]% todo: fast setter
+ %\setupcurrentregister[\c!entries=,\c!label=,\c!keys=,\c!alternative=,#2]% todo: fast setter
+ \resetregisterparameter\c!entries
+ \resetregisterparameter\c!label
+ \resetregisterparameter\c!keys
+ \resetregisterparameter\c!alternative
+ \setupcurrentregister[#2]%
\edef\currentregisterlabel {\registerparameter\c!label}%
\edef\currentregisterexpansion{\registerparameter\c!expansion}%
\edef\currentregisterownnumber{\registerparameter\c!ownnumber}%
@@ -628,13 +633,14 @@
\clf_processregister
{#1}%
{%
- language {\registerparameter\s!language}%
- method {\registerparameter\c!method}%
- numberorder {\registerparameter\c!numberorder}%
- check {\registerparameter\c!check}%
- compress {\registerparameter\c!compress}%
- criterium {\registerparameter\c!criterium}%
- pagenumber \ifx\registerpageseparatorsymbol\empty false\else true\fi
+ language {\registerparameter\s!language}%
+ method {\registerparameter\c!method}%
+ numberorder {\registerparameter\c!numberorder}%
+ check {\registerparameter\c!check}%
+ compress {\registerparameter\c!compress}%
+ criterium {\registerparameter\c!criterium}%
+ pagemethod {\registerparameter\c!pagemethod}%
+ pagenumber \ifx\registerpageseparatorsymbol\empty false\else true\fi
}{%
separatorset {\registerparameter\c!pageprefixseparatorset}%
conversionset {\registerparameter\c!pageprefixconversionset}%
@@ -939,6 +945,18 @@
\fi
\popcurrentregister}
+\newconditional\c_strc_registers_following
+
+\appendtoks
+ \edef\p_compress{\registerparameter\c!compress}%
+ \ifx\p_compress\v!text
+ \settrue\c_strc_registers_following
+ \letregisterparameter\c!compress\v!yes
+ \else
+ \setfalse\c_strc_registers_following
+ \fi
+\to \everyplaceregister
+
\unexpanded\def\registerpagerange#1#2#3#4#5#6#7#8% #1:class #2:processor content, content todo: -- configurable
{\pushcurrentregister{#1}%
\edef\p_pagenumber{\registerparameter\c!pagenumber}%
@@ -949,9 +967,17 @@
\dostarttagged\t!registerfrompage\empty
\withregisterpagecommand{#2}{#3}{#4}{#5}%
\dostoptagged
- \registeronepagerangeseparator
- \dostarttagged\t!registertopage\empty
- \withregisterpagecommand{#2}{#6}{#7}{#8}%
+ \ifconditional\c_strc_registers_following
+ \ifnum#3=\numexpr#6-1\relax
+ \labeltext{following:\s!singular}%
+ \else
+ \labeltext{following:\s!plural}%
+ \fi
+ \else
+ \registeronepagerangeseparator
+ \dostarttagged\t!registertopage\empty
+ \withregisterpagecommand{#2}{#6}{#7}{#8}%
+ \fi
\dostoptagged
\dostoptagged
\fi
@@ -1015,10 +1041,66 @@
\dostoptagged
\popcurrentregister}
+\unexpanded\def\doapplyregistersectioncommand#1#2%
+ {\ifx\currentregistersectionindex\empty
+ \applyprocessor{#1}{#2}%
+ \else\iflocation
+ \strc_references_goto_internal{\applyprocessor{#1}{#2}}[sectionindex:\currentregistersectionindex]%
+ \else
+ \applyprocessor{#1}{#2}%
+ \fi\fi}
+
+\unexpanded\def\defaultregistersection#1#2#3#4#5#6#7% class i n #4:processor #5:internal #6:sectionindex #7:word
+ {\pushcurrentregister{#1}%
+ \ifnum#2=\plusone
+ \registerpageseparator
+ \fi
+ \global\setconstant\c_strc_registers_page_state\plustwo
+ \def\currentregisterpageindex{#5}%
+ \dostarttagged\t!registersection\empty
+ \settrue\c_strc_registers_page_done
+ \iflocation
+ \def\currentregistersectionindex{#6}%
+ \else
+ \let\currentregistersectionindex\empty
+ \fi
+ \ifnum#2=\plusone\else
+ ,\space
+ \fi
+ \doapplyregistersectioncommand{#4}{#7}%
+ \dostoptagged
+ \popcurrentregister}
+
+\let\registersection \defaultregistersection
\let\registerseeword \defaultregisterseeword
\let\registerentry \defaultregisterentry
\let\registercharacter\defaultregistercharacter
+%D Experimental:
+%D
+%D \starttyping
+%D \setupregister
+%D [index]
+%D [pagesegments=1:4,
+%D pagemethod=section]
+%D
+%D \starttext
+%D
+%D \chapter {one} \section {alpha}
+%D
+%D x\index {whatever 1}x\index {whatever 2}x\index {whatever 2}x \page
+%D x\index {whatever 1}x\index {whatever 2}x\index {whatever 2}x \page
+%D
+%D \chapter {one} \section {alpha}
+%D
+%D x\index {whatever 1}x\index {whatever 2}x\index {whatever 2}x \page
+%D x\index {whatever 1}x\index {whatever 2}x\index {whatever 2}x \page
+%D
+%D \placeindex[n=1]
+%D
+%D \stoptext
+%D \stoptyping
+
%D A few specific rendering variants:
% \def\doregisterpagelocation#1#2%