summaryrefslogtreecommitdiff
path: root/tex/context/base/strc-sec.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/strc-sec.mkiv')
-rw-r--r--tex/context/base/strc-sec.mkiv23
1 files changed, 19 insertions, 4 deletions
diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv
index 2a6d25631..496d95b67 100644
--- a/tex/context/base/strc-sec.mkiv
+++ b/tex/context/base/strc-sec.mkiv
@@ -15,6 +15,8 @@
\unprotect
+\ifdefined \v!block \else \def\v!block{block} \fi
+
% compatibility issue:
%
% \def\setfullsectionnumber #1{}
@@ -114,10 +116,14 @@
\getparameters[\??nh#1][#2]%
\fi}
+% -2=text -1=manual 0=block 1+=structurelevel
+
\def\structuresectionlevel#1%
{\executeifdefined{\??nh#1\c!level}{-1}}
-\setvalue{\??nh block\c!level}{0} % -1 == manual
+\setvalue{\??nh\v!block\c!level}{0}
+\setvalue{\??nh\v!none \c!level}{-1}
+\setvalue{\??nh\v!text \c!level}{-2}
% head -> structurehead
@@ -600,13 +606,13 @@
\def\dostructureheadspacingbeforeyes
{\docheckstructureheadbefore
- \dohandlestructureheadpagebreak
+ \dohandlestructureheadpagebreakyes
\structureheadparameter\c!inbetween
\dostarttagged\t!section\currentstructurehead}
\def\dostructureheadspacingbeforenop
{\docheckstructureheadbefore
- \docheckstructureheadlayout
+ \dohandlestructureheadpagebreaknop
\structureheadparameter\c!inbetween
\dostarttagged\currentstructurehead\empty}
@@ -675,7 +681,16 @@
\def\currentstructurecounter {\ctxlua{structures.sections.depthnumber(\thenamedstructureheadlevel\currentstructurehead)}}
\def\previousstructurecounter{\ctxlua{structures.sections.depthnumber(\thenamedstructureheadlevel\currentstructurehead-1)}}
-\def\dohandlestructureheadpagebreak
+\def\dohandlestructureheadpagebreaknop
+ {\doifelse{\structureheadparameter\c!continue}\v!yes
+ {\ifnum\previousstructurecounter=\zerocount
+ \docheckstructureheadlayout
+ \else\ifnum\currentstructurecounter>\zerocount
+ \docheckstructureheadlayout
+ \fi\fi}%
+ {\docheckstructureheadlayout}}
+
+\def\dohandlestructureheadpagebreakyes
{%[[\currentstructurehead @\thenamedstructureheadlevel\currentstructurehead/prev:\previousstructurecounter/curr:\currentstructurecounter]]
\ifconditional\ignorehandlepagebreak
\setfalse\ignorehandlepagebreak