diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-sbe.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/strc-sbe.mkiv | 110 |
1 files changed, 46 insertions, 64 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-sbe.mkiv b/Master/texmf-dist/tex/context/base/strc-sbe.mkiv index e9d8d9c1ae1..a98b6788523 100644 --- a/Master/texmf-dist/tex/context/base/strc-sbe.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-sbe.mkiv @@ -5,7 +5,7 @@ %D subtitle=Section Block Environments, %D author=Hans Hagen, %D date=\currentdate, -%D copyright=PRAGMA-ADE / Hans Hagen] +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for @@ -27,96 +27,90 @@ % \chapter{second} \section{alpha} test \section{beta} test \page % \stopbodymatter % optional -\definesystemvariable {nb} +\unexpanded\def\definesectionblock{\dotripleargument\dodefinesectionblock} +\unexpanded\def\setupsectionblock {\dodoubleargument\dosetupsectionblock} +\def\setsectionblock {\dosingleargument\dosetsectionblock} -\def\v!structureblockenvironment{structureblockenvironment} - -\unexpanded\def\definestructureblock{\dotripleargument\dodefinestructureblock} -\unexpanded\def\setupstructureblock {\dodoubleargument\dosetupstructureblock} -\def\setstructureblock {\dosingleargument\dosetstructureblock} - -% \def\structureblockparameter#1{\executeifdefined{\??nb\currentstructureblock#1}\empty} - -\def\structureblockparameter#1% +\def\sectionblockparameter#1% {\csname - \ifcsname\??nb\currentstructureblock#1\endcsname\??nb\currentstructureblock#1\else\s!empty\fi + \ifcsname\??sb\currentsectionblock#1\endcsname\??sb\currentsectionblock#1\else\s!empty\fi \endcsname} -\newtoks \everybeforestructureblock -\newtoks \everyafterstructureblock +\newtoks \everybeforesectionblock +\newtoks \everyaftersectionblock -\def\dodefinestructureblock[#1][#2][#3]% singular plural settings +\def\dodefinesectionblock[#1][#2][#3]% singular plural settings {\getparameters - [\??nb#1] + [\??sb#1] [\c!number=\v!yes, \c!page=\v!right, % anders worden marks te vroeg gereset ! #3]% \expandafter\newif\csname if#2\endcsname % better a mode - \setstructureblockenvironment{#1}\empty - \setvalue {\e!start#2}{\startstructureblock[#1]}% - \setvalue {\e!stop #2}{\stopstructureblock}} + \setsectionblockenvironment{#1}\empty + \setvalue {\e!start#2}{\startsectionblock[#1]}% + \setvalue {\e!stop #2}{\stopsectionblock}} \ifdefined \resetallstructuremarks \else \let\resetallstructuremarks\relax \fi \appendtoks - \doifsomething{\structureblockparameter\c!page}{\page[\structureblockparameter\c!page]}% + \doifsomething{\sectionblockparameter\c!page}{\page[\sectionblockparameter\c!page]}% \resetallstructuremarks - \getstructureblockenvironment\currentstructureblock - \structureblockparameter\c!before % don't move - \dostarttagged\t!division\currentstructureblock -\to \everybeforestructureblock + \getsectionblockenvironment\currentsectionblock + \sectionblockparameter\c!before % don't move + \dostarttagged\t!division\currentsectionblock +\to \everybeforesectionblock \appendtoks - \structureblockparameter\c!after % don't move - \doifsomething{\structureblockparameter\c!page}{\page[\structureblockparameter\c!page]}% + \sectionblockparameter\c!after % don't move + \doifsomething{\sectionblockparameter\c!page}{\page[\sectionblockparameter\c!page]}% \dostoptagged \resetallstructuremarks -\to \everyafterstructureblock +\to \everyaftersectionblock -\def\dosetupstructureblock[#1]% - {\getparameters[\??nb#1]}% [#2] +\def\dosetupsectionblock[#1]% + {\getparameters[\??sb#1]}% [#2] -\def\dosetstructureblock[#1]% used to set the default - {\edef\currentstructureblock{\ctxlua{structures.sections.setblock("#1")}}} +\def\dosetsectionblock[#1]% used to set the default + {\edef\currentsectionblock{\ctxlua{structures.sections.setblock("#1")}}} -\let\currentstructureblock\s!unknown +\let\currentsectionblock\empty % was \s!unknown -\unexpanded\def\startstructureblock[#1]% +\unexpanded\def\startsectionblock[#1]% {%\ctxlua{structures.counters.check(0)}% we assume sane usage of \page, as this is the only workable place (in push) \begingroup - \edef\currentstructureblock{\ctxlua{structures.sections.pushblock("#1")}}% + \edef\currentsectionblock{\ctxlua{structures.sections.pushblock("#1")}}% \csname #1true\endcsname % for old times sake - \setsystemmode\currentstructureblock - \the\everybeforestructureblock\relax - \showmessage\m!structures1\currentstructureblock} - -\unexpanded\def\stopstructureblock - {\showmessage\m!structures2\currentstructureblock - \the\everyafterstructureblock\relax - \edef\currentstructureblock{\ctxlua{structures.sections.popblock()}}% + \setsystemmode\currentsectionblock + \the\everybeforesectionblock\relax + \showmessage\m!structures1\currentsectionblock} + +\unexpanded\def\stopsectionblock + {\showmessage\m!structures2\currentsectionblock + \the\everyaftersectionblock\relax + \edef\currentsectionblock{\ctxlua{structures.sections.popblock()}}% \endgroup} -\long\def\setstructureblockenvironment#1#2% - {\long\setvalue{\??nb\s!do#1}{\do{#2}}} +\long\def\setsectionblockenvironment#1#2% + {\long\setvalue{\??sb\s!do#1}{\do{#2}}} -\def\getstructureblockenvironment#1% +\def\getsectionblockenvironment#1% {\let\do\firstofoneargument - %\structureblockparameter{\s!do#1}} - \csname\??nb\s!do#1\endcsname} + %\sectionblockparameter{\s!do#1}} + \csname\??sb\s!do#1\endcsname} %D \starttyping %D \startsectionblockenvironment[frontpart] -%D \setuppagenumbering[conversion=romannumerals] +%D \setupnumber[userpage][numberconversion=romannumerals,start=1] %D \stopsectionblockenvironment %D %D \startsectionblockenvironment[bodypart] -%D \setuppagenumber[number=1] +%D \setupnumber[userpage][numberconversion=numbers,start=1] %D \stopsectionblockenvironment %D -%D \startsectionblockenvironment[frontpart] -%D \setuppagenumbering[conversion=character] +%D \startsectionblockenvironment[backpart] +%D \setupnumber[userpage][numberconversion=numbers,start=1] %D \stopsectionblockenvironment %D %D \starttext @@ -126,22 +120,10 @@ %D \stoptext %D \stoptyping -\setvalue{\e!start\v!structureblockenvironment}% - {\dosingleargument\dostartstructureblockenvironment} - -\def\dostartstructureblockenvironment[#1]% evt \pushendofline \popendofline - {\long\def\do##1##2{\setstructureblockenvironment{#1}{##1##2}}% - %\grabuntil{\e!stop\v!structureblockenvironment}{\structureblockparameter{\s!do#1}}} - \grabuntil{\e!stop\v!structureblockenvironment}{\csname\??nb\s!do#1\endcsname}} - -% this will become: (we ran in parallel for a while during transition) - \setvalue{\e!start\v!sectionblockenvironment}% {\dosingleargument\dostartsectionblockenvironment} \def\dostartsectionblockenvironment[#1]% evt \pushendofline \popendofline - {\long\def\do##1##2{\setstructureblockenvironment{#1}{##1##2}}% - %\grabuntil{\e!stop\v!sectionblockenvironment}{\structureblockparameter{\s!do#1}}} - \grabuntil{\e!stop\v!sectionblockenvironment}{\csname\??nb\s!do#1\endcsname}} + {\grabuntil{\e!stop\v!sectionblockenvironment}{\setsectionblockenvironment{#1}}} \protect \endinput |