diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2009-08-23 11:11:32 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2009-08-23 11:11:32 +0000 |
commit | 8fc3039c82d48605b5ca8b2eda3f4fdd755681e1 (patch) | |
tree | 3cd9bbdd599bc4d1ac0409e167fee2136e4c0ec9 /Master/texmf-dist/tex/context/base/strc-swd.mkii | |
parent | 850fc99b7cd3ae7a20065531fe866ff7bae642ec (diff) |
this is context 2009.08.19 17:10
git-svn-id: svn://tug.org/texlive/trunk@14827 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-swd.mkii')
-rw-r--r-- | Master/texmf-dist/tex/context/base/strc-swd.mkii | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-swd.mkii b/Master/texmf-dist/tex/context/base/strc-swd.mkii new file mode 100644 index 00000000000..4a71b8781b8 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/strc-swd.mkii @@ -0,0 +1,127 @@ +%D \module +%D [ file=strc-swd, +%D version=2007.08.14, +%D title=\CONTEXT\ Structure Macros, +%D subtitle=Section Worlds, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is a prelude to a rewrite of sectioning. + +% options : before after setups page text number label bookmark +% dodo : listtext +% +% \startsectionworld[chapter][text={Test}] +% \stopsectionworld + +\writestatus{loading}{ConTeXt Structure Macros / Sectionworlds} + +\unprotect + +\ifx\pushvalue\undefined + + \def\pushvalue#1{\expandafter\pushmacro\csname#1\endcsname} + \def\popvalue #1{\expandafter\popmacro \csname#1\endcsname} + +\fi + +% brrr + +\def\csnameexpanded#1#2% + {\@EA\@EA\@EA\@EA\@EA\@EA\@EA#1\@EA\@EA\@EA\@EA\@EA\@EA\@EA#2\@EA\@EA\@EA\@EA\@EA\@EA\@EA} + +\def\csnameexpandedoneargument#1#2% + {\csnameexpanded\def\csexpandeda{#2}% + \@EA#1\@EA{\csexpandeda}} + +\def\csnameexpandedtwoarguments#1#2#3% + {\csnameexpanded\def\csexpandeda{#2}% + \csnameexpanded\def\csexpandedb{#3}% + \@EA\@EA\@EA#1\@EA\@EA\@EA{\@EA\csexpandeda\@EA}\@EA{\csexpandedb}} + +\def\csnameexpandedthreearguments#1#2#3#4% + {\csnameexpanded\def\csexpandeda{#2}% + \csnameexpanded\def\csexpandedb{#3}% + \csnameexpanded\def\csexpandedc{#4}% + \@EA\@EA\@EA\@EA\@EA\@EA\@EA#1\@EA\@EA\@EA\@EA\@EA\@EA\@EA{\@EA\@EA\@EA\csexpandeda\@EA\@EA\@EA}\@EA\@EA\@EA{\@EA\csexpandedb\@EA}\@EA{\csexpandedc}} + +% \def\xx{XX}\setvalue{xx:yy}{abc \xx def}\def\param#1{\csname xx:#1\endcsname} +% \def\testa #1{\defconvertedargument\ascii{#1}{\tttf\ascii}} +% \def\testb #1#2{\defconvertedargument\ascii{#1 #2}{\tttf\ascii}} +% \def\testc#1#2#3{\defconvertedargument\ascii{#1 #2 #3}{\tttf\ascii}} +% \noindent 1 \csnameexpandedoneargument \testa{\param{yy}} +% \noindent 2 \csnameexpandedtwoarguments \testb{\param{yy}}{\param{yy}} +% \noindent 3 \csnameexpandedthreearguments\testc{\param{yy}}{\param{yy}}{\param{yy}} + +% rewrite the sectioning to use the variables, a bit tricky because then +% we need a special expansion trick + +\def\sectionworldparameter #1{\csname\??sw\currentsectionworldname#1\endcsname} +\def\pushsectionworldparameter#1{\expandafter\pushmacro\csname\??sw\currentsectionworldname#1\endcsname} +\def\popsectionworldparameter #1{\expandafter\popmacro \csname\??sw\currentsectionworldname#1\endcsname} + +\def\setupsectionworld + {\dodoubleargument\dosetupsectionworld} + +\def\dosetupsectionworld[#1][#2]% + {\getparameters[\??sw#1][#2]} % maybe some extra things + +\def\dochecksectionworld#1% + {\ifcsname\??sw\currentsectionworldname\endcsname\else + \getparameters + [\??sw\currentsectionworldname] + [\c!before=, + \c!after=, + \c!setups=, + \c!page=]% + \fi} + +\def\startsectionworld + {\dodoubleargument\dostartsectionworld} + +\def\dostartsectionworld[#1][#2]% + {\pushmacro\currentsectionworldname + \def\currentsectionworldname{#1}% + \dochecksectionworld\currentsectionworldname + \pushsectionworldparameter\c!before + \pushsectionworldparameter\c!after + \pushsectionworldparameter\c!setups + \getparameters + [\??sw\currentsectionworldname] + [\c!text=,\c!number=\finalsectionnumber,\c!label=,\c!bookmark=,#2]% + \doifsomething{\sectionworldparameter\c!page} + {\setsectieenkoppeling\currentsectionworldname + %\handlepagebreak\currentsectionworldname + \checknexthead\handlepagebreak\currentsectionworldname}% + \sectionworldparameter\c!before + \begingroup + \doifsomething{\sectionworldparameter\c!page} + {\settrue\ignorehandlepagebreak}% + \doifsomething{\sectionworldparameter\c!setups} + {\setups[\sectionworldparameter\c!setups]}% + \csnameexpandedthreearguments \doconstructheadwithvars + {\sectionworldparameter\c!label }% + {\sectionworldparameter\c!number}% + {\sectionworldparameter\c!text }% + \doifsomething{\sectionworldparameter\c!bookmark} + {\expanded{\bookmark[\sectionworldparameter\c!bookmark]}}% + \ignorespaces} % for inline heads + +\def\doconstructheadwithvars#1%#2#3% + {\dodododoconstructhead\currentsectionworldname[#1]}% {#2}{#3}} + +\def\stopsectionworld + {\endgraf + \endgroup + \sectionworldparameter\c!after + \popsectionworldparameter\c!setups + \popsectionworldparameter\c!after + \popsectionworldparameter\c!before + \popmacro\currentsectionworldname} + +\protect \endinput |