summaryrefslogtreecommitdiff
path: root/tex/context/base/strc-lst.mkiv
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-01-24 12:40:18 +0200
committerMarius <mariausol@gmail.com>2012-01-24 12:40:18 +0200
commit61f9cff70fd57ae1be9208820b4d31bd7152c785 (patch)
tree393a2d0c960552d2bd29c1c1bdbc0a749d177bb3 /tex/context/base/strc-lst.mkiv
parent6371f988d54dd0bec1c613110df77e5be103591f (diff)
downloadcontext-61f9cff70fd57ae1be9208820b4d31bd7152c785.tar.gz
beta 2012.01.24 11:11
Diffstat (limited to 'tex/context/base/strc-lst.mkiv')
-rw-r--r--tex/context/base/strc-lst.mkiv998
1 files changed, 0 insertions, 998 deletions
diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv
deleted file mode 100644
index d80217a32..000000000
--- a/tex/context/base/strc-lst.mkiv
+++ /dev/null
@@ -1,998 +0,0 @@
-%D \module
-%D [ file=strc-lst,
-%D version=2008.10.20,
-%D title=\CONTEXT\ Structure Macros,
-%D subtitle=Lists,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%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
-%C details.
-
-\writestatus{loading}{ConTeXt Structure Macros / Lists}
-
-\registerctxluafile{strc-lst}{1.001}
-
-% needs clean up
-
-% nmstate -> no pagenumber if not start
-% autocrossdocument -> todo
-% expansion -> todo
-% auto refs to lists (chain) -> todo (\dododowritetolist)
-% todo: \normalexpanded{\noexpand\everylistentry\emptytoks\the\everylistentry}% \emptytoks, else loop
-
-\unprotect
-
-\installcorenamespace{list}
-\installcorenamespace{listextras}
-\installcorenamespace{listalternatives}
-\installcorenamespace{listelement}
-\installcorenamespace{listelementcommand}
-
-\installframedcommandhandler \??list {list} \??list
-
-\def\usenestedliststyleandcolor#1#2% will change
- {\useliststyleandcolor#1#2%
- \ifx\currentcolorparameter\empty \else
- \resetinteractionparameter\c!color
- \resetinteractionparameter\c!contrastcolor
- \fi}
-
-\let\setuplists\setuplist % yes or no
-
-\unexpanded\def\doifelselist#1% can also move to \installcommandhandler
- {\ifcsname\namedlisthash{#1}\s!parent\endcsname
- \expandafter\firstoftwoarguments
- \else
- \expandafter\secondoftwoarguments
- \fi}
-
-\setuplist
- [\c!height=\v!broad,
- \c!depth=\v!broad,
- \c!offset=0.25em,
- \c!maxwidth=,
- \c!state=\v!start,
- \c!coupling=\v!off,
- \c!criterium=\v!local,
- \c!number=0,
- \c!width=3em,
- \c!alternative=\c!b,
- \c!style=\v!normal,
- \c!textstyle=\listparameter\c!style,
- \c!numberstyle=\listparameter\c!style,
- \c!pagestyle=\listparameter\c!style,
- %\c!color=,
- \c!textcolor=\listparameter\c!color,
- \c!numbercolor=\listparameter\c!color,
- \c!pagecolor=\listparameter\c!color,
- \c!numbercommand=\listnumbercommand,
- \c!textcommand=\listtextcommand,
- \c!pagecommand=\listpagecommand,
- \c!pagenumber=\v!yes,
- \c!headnumber=\v!yes,
- \c!extras=,
- \c!margin=\!!zeropoint,
- \c!aligntitle=,
- \c!before=,
- \c!after=,
- \c!inbetween=,
- \c!symbol=,
- \c!interaction=\v!sectionnumber,
- \c!label=\v!no,
- \c!distance=\!!zeropoint,
- %\c!number*=
- %\c!prefix*=,
- %\c!pageprefix*=,
- %\c!expansion=,
- \c!limittext=\languageparameter\c!limittext] % not used currently
-
-% Whatever:
-
-\def\currentstructurelistnumber{0}
-
-% we have to deal with compatible processing, i.e. list elements that have two
-% elements plus a pagenumber
-
-\let\listentry\gobblesixarguments
-
-\def\currentlistmethod{entry}
-\def\currentlistindex {0}
-
-% The next code injects data into the list at the current level.
-
-\def\structurelistinject{\dotripleempty\dostructurelistinject}
-
-\def\dostructurelistinject[#1]% [#2][#3]% no check on nofarguments here
- {\begingroup
- \edef\currentlist{#1}%
- \doifelse{\listparameter\c!state}\v!start\dodostructurelistinject\nonostructurelistinject}
-
-\def\dodostructurelistinject[#1][#2]%
- {\endgroup}
-
-\def\dodostructurelistinject[#1][#2]%
-% {\getparameters[\??li\??li][\c!type=userdata,\c!location=\v!none,#1]%
-% \edef\currentlisttype {\@@li@@litype}%
-% \edef\currentlistlocation{\@@li@@lilocation}%
- {\setupcurrentlist[\c!type=userdata,\c!location=\v!none,#1]% grouped
- \edef\currentlisttype {\listparameter\c!type}%
- \edef\currentlistlocation{\listparameter\c!location}%
- \setnextinternalreference
- \edef\currentlistnumber{\ctxlua{structures.lists.push{
- references = {
- internal = \nextinternalreference,
- block = "\currentsectionblock", % handy for lists, like bibl
- section = structures.sections.currentid(),
- % location = "\currentlistlocation",
- },
- metadata = {
- kind = "\currentlisttype",
- name = "\currentlist",
- level = structures.sections.currentlevel(),
- catcodes = \the\catcodetable,
- },
- userdata = structures.helpers.touserdata(\!!bs\detokenize{#2}\!!es)
- }}}%
- % we can do the enhance injection at the lua end which saves tokenization and a call
- \ifx\currentlistlocation\v!here
- % this injects nodes !
- \expanded{\ctxlatelua{structures.lists.enhance(\currentlistnumber)}}%
- % new from here
- \xdef\currentstructurelistattribute{\ctxlua{tex.write(structures.references.setinternalreference(nil,nil,\nextinternalreference))}}%
- \xdef\currentdestinationattribute{\number\lastdestinationattribute}%
- %begingroup\attribute\destinationattribute\currentdestinationattribute\dontleavehmode\emptyhbox\endgroup % todo
- \dontleavehmode\hbox attr \destinationattribute \currentdestinationattribute{}% todo
- % end of new
- \else
- \ctxlua{structures.lists.enhance(\currentlistnumber)}% direct injection
- \fi
- \endgroup}
-
-\def\structurelistlocation
- {\ctxlua{structures.lists.location(\currentlistindex)}}
-
-\def\structurelistpagenumber
- {\dostarttagged\t!listpage\empty
- \ctxlua{structures.lists.prefixedpage(
- "\currentlist",
- \currentlistindex,
- {
- separatorset = "\listparameter\c!pageprefixseparatorset",
- conversionset = "\listparameter\c!pageprefixconversionset",
- set = "\listparameter\c!pageprefixset",
- segments = "\listparameter\c!pageprefixsegments",
- connector = \!!bs\listparameter\c!pageprefixconnector\!!es,
- },
- {
- prefix = "\listparameter\c!pageprefix",
- conversionset = "\listparameter\c!pageconversionset",
- starter = \!!bs\listparameter\c!pagestarter\!!es,
- stopper = \!!bs\listparameter\c!pagestopper\!!es,
- }
- )}%
- \dostoptagged}
-
-\def\structurelistrealpagenumber
- {\ctxlua{structures.lists.realpage("\currentlist",\currentlistindex)}}
-
-\def\structurelistfirst
- {\dostarttagged\t!listdata{first}% not always ok
- \ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"first")}%
- \dostoptagged}
-
-\def\structurelistsecond
- {\dostarttagged\t!listdata{second}%
- \ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"second")}%
- \dostoptagged}
-
-\def\structurelistuservariable#1%
- {\dostarttagged\t!listdata{#1}%
- \ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"#1")}%
- \dostoptagged}
-
-% we also need named ones (of the current parent)
-
-% \appendtoks
-% \to \everystructurelist
-
-\unexpanded\def\doplacestructurelist#1#2#3#4#5% beware, not a user command
- {\dostarttagged\t!list\empty
- \ctxlua{structures.lists.process {
- names = "#1",
- criterium = "#2",
- number = "#3",
- extras = "#4",
- order = "#5"
- }}%
- \dostoptagged}
-
-\unexpanded\def\doanalyzestructurelist#1#2#3%
- {\ctxlua{structures.lists.analyze {
- names = "#1",
- criterium = "#2",
- number = "#3"
- }}}
-
-\def\firststructureelementinlist#1%
- {\ctxcommand{firstinlist("#1")}}
-
-\def\structurelistsize
- {\ctxlua{structures.lists.size()}}
-
-\def\@@structurelistprocess{structurelist:process:}
-
-\unexpanded\def\installstructurelistprocessor#1#2%
- {\expandafter\def\csname\@@structurelistprocess#1\endcsname{#2}}
-
-\def\usestructurelistprocessor#1%
- {\csname\@@structurelistprocess#1\endcsname}
-
-\installstructurelistprocessor\s!default
- {no list method}
-
-% push pop test:
-%
-% \starttext
-% \placelist[chapter] [after={\placelist[section][criterium=local]}]
-% \chapter{One} \section{Alpha} \section{Beta}
-% \chapter{Two} \section{First} \section{Second}
-% \stoptext
-
-\def\definelistextra
- {\dodoubleargument\dodefinelistextra}
-
-\def\dodefinelistextra[#1][#2]%
- {\getparameters[\??listextras#1:][#2]}
-
-% todo: more generic tracing
-
-\definelistextra
- [\v!page]
- [\c!before={\showmessage\m!system{14}{\currentlist/\currentlistindex}\page}]
-
-\def\processlistextrabefore{\executeifdefined{\??listextras\currentlistextra:\c!before}\relax}
-\def\processlistextraafter {\executeifdefined{\??listextras\currentlistextra:\c!after }\relax}
-
-\unexpanded\def\processlistofstructure#1#2#3#4% name, method, n, extra
- {\ctxlua{structures.lists.pushnesting(#3)}%
- \edef\currentlist {#1}%
- \edef\currentlistmethod {#2}%
- \edef\currentlistindex {#3}%
- \edef\currentlistextra {#4}%
- \processlistextrabefore
- \dostarttagged\t!listitem\currentlist
- \csname\@@structurelistprocess
- \ifcsname\@@structurelistprocess\currentlist:\currentlistmethod\endcsname\currentlist:\currentlistmethod\else
- \ifcsname\@@structurelistprocess\currentlistmethod \endcsname\currentlistmethod \else
- \ifcsname\@@structurelistprocess\currentlist \endcsname\currentlist \else
- \s!default \fi\fi\fi
- \endcsname
- \dostoptagged
- \processlistextraafter
- \ctxlua{structures.lists.popnesting()}}
-
-% \installstructcurelistprocessor{pubs:userdata}
-% {\ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"bibref")}}
-
-\installstructurelistprocessor{command}
- {\ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"command")}}
-
-\installstructurelistprocessor{section}
- {\dodolistelement
- \currentlist
- \structurelistlocation
- \structurelistgenericnumber
- \structurelistgenerictitle % hm, can end up in message (volkers test)
- \structurelistpagenumber
- \structurelistrealpagenumber}
-
-% so far (todo: also recursive)
-
-% TODO: also make this a commandhandler
-
-\def\listalternativeparameter#1%
- {\ifcsname\??listalternatives\listparameter\c!alternative#1\endcsname
- \csname\??listalternatives\listparameter\c!alternative#1\endcsname
- \else
- \listparameter{#1}%
- \fi}
-
-\unexpanded\def\setuplistalternative[#1]%
- {\dodoubleargument\getparameters[\??listalternatives#1]}
-
-\def\listfill {\listalternativeparameter\c!command }
-\def\listskip {\listalternativeparameter\c!distance}
-\def\listwidth {\listalternativeparameter\c!width }
-\def\liststretch{\listalternativeparameter\c!stretch }
-
-% a : nr - tit - pag
-% b : nr - tit - fill - pag
-% c : nr - tit - dots - pag
-
-\setuplistalternative[a][\c!distance=0pt,\c!width=2em,\c!stretch=10em,\c!command=\hskip.25em\relax]
-\setuplistalternative[b][\c!distance=5em,\c!width=2em,\c!stretch=10em,\c!command=\hfill]
-\setuplistalternative[c][\c!distance=5em,\c!width=0pt,\c!stretch=10em,\c!command=\hskip.5em\listdots\hskip.5em\relax]
-
-%def\listdots{\leaders \hbox to .5em{\hss.\hss}\hfill}
-\def\listdots{\gleaders\hbox to .5em{\hss.\hss}\hfill}
-
-\unexpanded\def\placelist
- {\dodoubleempty\doplacelist}
-
-\unexpanded\def\placerawlist
- {\dodoubleempty\doplacerawlist}
-
-\def\dobeginoflist
- {\begingroup
- \startpacked[\v!blank]}
-
-\def\doendoflist
- {\stoppacked
- \endgroup}
-
-\def\doplacelist[#1][#2]%
- {\dobeginoflist
- \doplacerawlist[#1][#2]%
- \doendoflist}
-
-\newtoks\everystructurelist
-
-% writing to lists
-
-\let\dowritetolist \gobblefourarguments
-\let\dodowritetolist\gobblefourarguments
-
-%D Regular list entries are bound to a specific location in order to
-%D get the right pagenumber etc.\ associated. When pushing something
-%D inbetween (in mkiv) it ends up directtly in the list. This is the
-%D default because otherwise users will wonder why spacing might get
-%D messed up (due to an unseen but present node). It is possible to
-%D force a location by explicitly setting \type {location} to \type
-%D {here}.
-%D
-%D Another way to force a certain order is to set the \type {order}
-%D variable when placing a list. The \type {command} option only
-%D pushes commands into the right order, and \type {all} orders all
-%D entries (which might be too much). In this case no specific
-%D location is needed with the inbetween method. Maybe additional
-%D mechanisms show up some day. See \type {inbetween-001.tex} for an
-%D example.
-
-% command : location=none
-% userdata : location=none
-% simple : location=here
-
-\unexpanded\def\writebetweenlist{\dodoubleempty \dowritebetweenlist}
-\unexpanded\def\writedatatolist {\dotripleargument\dowritedatatolist}
-\unexpanded\def\writetolist {\dodoubleempty \dowritetolist}
-
-\def\dowritebetweenlist[#1][#2]#3% we can overload location
- {\doif{\namedlistparameter{#1}\c!state}\v!start
- {\ifsecondargument
- \dostructurelistinject[#1][#2,\c!type=command][command={#3}]%
- \else
- \dostructurelistinject[#1][\c!type=command][command={#3}]%
- \fi}}
-
-\def\dowritedatatolist[#1][#2][#3]% we can overload location
- {\doif{\namedlistparameter{#1}\c!state}\v!start
- {\ifthirdargument
- \dostructurelistinject[#1][#2,\c!type=userdata][#3]%
- \else
- \dostructurelistinject[#1][\c!type=userdata][#2]%
- \fi}}
-
-\def\dowritetolist[#1][#2]#3#4% we can overload location
- {\doif{\namedlistparameter{#1}\c!state}\v!start
- {\ifsecondargument
- \dostructurelistinject[#1][\c!location=\v!here,#2,\c!type=simple][first={#3},second={#4}]%
- \else
- \dostructurelistinject[#1][\c!location=\v!here,\c!type=simple][first={#3},second={#4}]%
- \fi}}
-
-\installstructurelistprocessor{simple}
- {\dodolistelement
- \currentlist
- \structurelistlocation
- \structurelistfirst
- \structurelistsecond
- \structurelistpagenumber
- \structurelistrealpagenumber}
-
-% % %
-
-\def\doplacerawlist[#1][#2]% listreferences will be redone
- {\begingroup
- \setuplist[#1][#2]%
- \edef\currentlist{\firststructureelementinlist{#1}}%
- \the\everystructurelist
- \doif{\listparameter\c!coupling}\v!on{\startlistreferences{#1}}%
- \doplacestructurelist
- {#1}%
- {\listparameter\c!criterium}%
- {\number\listparameter\c!number}%
- {\listparameter\c!extras}%
- {\listparameter\c!order}%
- \stoplistreferences
- \endgroup
- \dosetlistmode}
-
-\def\dosetlistmode
- {\ifcase\structurelistsize\relax
- \resetsystemmode\v!list
- \else
- \setsystemmode \v!list
- \fi}
-
-\unexpanded\def\systemsuppliedchapter {\getvalue{\v!chapter}} % obsolete
-\unexpanded\def\systemsuppliedtitle {\getvalue{\v!title}} % obsolete
-
-\def\dodocompletelist[#1][#2][#3]% enkelvoud, meervoud, instellingen
- {\normalexpanded{\startnamedsection[\v!title][\c!title=\headtext{#2},\c!reference=#2]}%
- \doplacelist[#1][#3]%
- \stopnamedsection}
-
-\def\docompletelist[#1][#2]%
- {\dodocompletelist[#1][#1][#2]}
-
-\unexpanded\def\completelist
- {\dodoubleempty\docompletelist}
-
-\def\listelements {} % list of page breaks
-\def\listnumbercommand #1{#1} % no strut due to interactive version
-\def\listtextcommand #1{\begstrut#1\endstrut}
-\def\listpagecommand #1{\strut#1}
-
-\def\doassignlistdimen#1#2#3%
- {\doifinsetelse{#2}{\v!fit,\v!broad}{#1=#3}{#1=#2}\relax}
-
-\unexpanded\def\listsymbol[#1]#2%
- {\begingroup
- \edef\currentlist{#1}%
- \def\currentlistnumber{#2}% no edef else tag problems
- \currentlistsymbol
- \endgroup}
-
-% Beware, the list symbol macro gets an argument passed, i.e. when this
-% argument is not picked up, the symbol becomes a kind of prefix.
-
-% for historical reasons we're stuck to symbols, so in order to generalize,
-% we have to hook it into the symbol handler; we need a beter clean up later
-%
-% < 2005
-%
-% \def\dosetlistsymbol % #1
-% {\executeifdefined{listsymbol@\listparameter\c!symbol}\listsymbol@default} % {#1}
-%
-% >= 2005
-%
-% at this symbol level, we have access to the raw 'number' in
-% \currentlistnumber
-
-\definesymbol[\v!list][\v!none ][\listsymbol@none ]
-\definesymbol[\v!list][\v!one ][\listsymbol@one ]
-\definesymbol[\v!list][\v!two ][\listsymbol@two ]
-\definesymbol[\v!list][\v!three ][\listsymbol@three ]
-\definesymbol[\v!list][\s!default][\listsymbol@default]
-\definesymbol[\v!list][\s!unknown][\listsymbol@unknown]
-
-\unexpanded\def\currentlistsymbol
- {\doifinsymbolsetelse\v!list{\listparameter\c!symbol}
- {\directsymbol\v!list{\listparameter\c!symbol}}
- {\directsymbol\v!list\s!default}}
-
-\def\listsymbol@none
- {\doassignlistdimen\scratchdimen{\listparameter\c!width}{1.5em}%
- \hbox to \scratchdimen{}}
-
-\def\listsymbol@one
- {\strut$\bullet$}
-
-\def\listsymbol@two
- {\vrule\!!width1em\!!height1ex\!!depth\zeropoint}
-
-\def\listsymbol@three
- {\begingroup
- \doassignlistdimen{\dimen0}{\listparameter\c!width }{1.5em}%
- \doassignlistdimen{\dimen2}{\listparameter\c!height}{1ex}%
- \doassignlistdimen{\dimen4}{\listparameter\c!depth }\zeropoint
- \vrule\!!width\dimen0\!!height\dimen2\!!depth\dimen4%
- \endgroup}
-
-\def\listsymbol@default
- {\strut
- \begingroup
- \edef\currentlistlabel{\listparameter\c!label}%
- \ifx\currentlistlabel\empty % default
- \listparameter\c!starter
- \currentlistnumber
- \listparameter\c!stopper
- \else\ifx\currentlistlabel\v!no % also default
- \listparameter\c!starter
- \currentlistnumber
- \listparameter\c!stopper
- \else\ifx\currentlistlabel\v!none % real minimal (as suggested by WS)
- \currentlistnumber
- \else\ifx\currentlistlabel\v!yes % auto (use value stored in tuc file)
- \edef\currentlistlabel{\ctxlua{structures.lists.label(\currentlistindex,"\currentlistlabel")}}%
- \leftlabeltext\currentlistlabel
- \listparameter\c!starter
- \currentlistnumber
- \listparameter\c!stopper
- \rightlabeltext\currentlistlabel
- \else % use whatever is set
- \leftlabeltext\currentlistlabel
- \listparameter\c!starter
- \currentlistnumber
- \listparameter\c!stopper
- \rightlabeltext\currentlistlabel
- \fi\fi\fi\fi
- \endgroup}
-
-\def\listsymbol@unknown
- {\listparameter\c!symbol}
-
-% so far for list symbols
-
-\def\dosomelistelement#1#2#3{#1 #2 #3}
-
-\setvalue{\??listelement a}{\let\dosomelistelement\dodofixdlistelementABC}
-\setvalue{\??listelement b}{\let\dosomelistelement\dodofixdlistelementABC}
-\setvalue{\??listelement c}{\let\dosomelistelement\dodofixdlistelementABC}
-\setvalue{\??listelement d}{\let\dosomelistelement\dodofixdlistelementD}
-\setvalue{\??listelement e}{\let\dosomelistelement\dodofixdlistelementE}
-\setvalue{\??listelement f}{\let\dosomelistelement\dodofixdlistelementF}
-\setvalue{\??listelement g}{\let\dosomelistelement\dodofixdlistelementG}
-
-\setvalue{\??listelement\v!none }{\def\dosomelistelement{\dodofreevlistelement}}
-\setvalue{\??listelement\v!vertical }{\def\dosomelistelement{\dodofreevlistelement}}
-\setvalue{\??listelement\v!horizontal}{\def\dosomelistelement{\dodofreehlistelement}}
-\setvalue{\??listelement\v!command }{\let\dosomelistelement\dodocommandlistelement}
-
-% \setuplist
-% [section]
-% [alternative=MyListItem,
-% after=\blank,
-% before=\blank]
-%
-% \definelistplacement[MyListItem][none]#1#2#3%
-% {(#1) (#2) (#3)}
-
-\unexpanded\def\definelistplacement
- {\dodoubleempty\dodefinelistplacement}
-
-\def\dodefinelistplacement[#1][#2]% looks messy
- {\setvalue{\??listelement#1}%
- {\doifelsenothing{#2}
- {\getvalue{\??listelement\v!command}}%
- {\executeifdefined{\??listelement#2}{\getvalue{\??listelement\v!command}}}%
- \setlistparameter\c!command{\getvalue{\??listelementcommand#1}}}%
- \setvalue{\??listelementcommand#1}}
-
-% don't mess arround with endgraf/grouping else we loose leftskip
-
-% \strippedcsname\dodolistelement
-
-\def\newlineinlist{\space}
-
-\def\docurrentlistalternative
- {\edef\currentlistalternative{\listparameter\c!alternative}%
- \ifx\currentlistalternative\empty
- [unknown list alternative]%
- \else
- \executeifdefined{\??listelement\currentlistalternative}{[unknown list alternative: \currentlistalternative]}%
- \fi}
-
-\def\dodolistelement#1#2#3#4#5#6%
- {\edef\currentlist{#1}%
- \def\currentlistnumber{#3}% no edef else tag problem
- \docurrentlistalternative
- \letinteractionparameter\c!width\zeropoint
- \dontcomplain
- \dosomelistelement{#1}{#2}{#3}{#4}{#5}{#6}}
-
-\def\dodocommandlistelement#1#2#3#4#5#6%
- {\doifdefinedelse{\currentlisthash\c!command}
- {\listparameter\c!command{#3}{#4}{#5}}
- {[\currentlist: #3 -- #4 -- #5]}}
-
-\def\domakelistelement#1#2#3#4% ref internal command data
- {\dontleavehmode
- \iflocation % we cannot tweak \iflocation as we nest
- \doifelse{\listparameter\c!interaction}{#1}
- {\begingroup
- \doif{\namedheadparameter\currentlist\c!interaction}\v!list
- {\dosetsimplepagereference{bck:#2}%
- \attribute\destinationattribute\currentdestinationattribute}%
- \directgoto{\setlocationcolor#4}[internal(#2)]% we can get the attribute instead so then we don't need a goto
- \endgroup}% was \directgotobox
- {#3{#4}}%
- \else
- #3{#4}%
- \fi}
-
-\def\dodofreelistelement#1#2#3#4#5#6#7#8% #1 is sort of redundant
- {\listparameter\c!before% can be \hskip
- \doifdefinedelse{\currentlisthash\c!command} % maybe ifcsname
- {\domakelistelement{\listparameter\c!interaction}{#2}\hbox
- {\listparameter\c!command
- {#3}% geen conversies etc
- {#4}% geen conversies etc
- {#5}}}% geen command
- {#7%
- \vbox
- {\forgetall
- \domakelistelement\v!all{#2}\hbox
- {\doif{\listparameter\c!headnumber}\v!yes
- {\domakelistelement\v!sectionnumber{#2}\hbox
- {\usenestedliststyleandcolor\c!numberstyle\c!numbercolor
- {\listparameter\c!numbercommand{\currentlistsymbol}}}}%
- \domakelistelement\v!text{#2}\hbox
- {\usenestedliststyleandcolor\c!textstyle\c!textcolor
- {\let\\=\newlineinlist
- \dontconvertfont
- \listparameter\c!textcommand{#4}}}%
- \doif{\listparameter\c!pagenumber}\v!yes
- {\doifsomething{#5}
- {\domakelistelement\v!pagenumber{#2}\hbox
- {\usenestedliststyleandcolor\c!pagestyle\c!pagecolor
- {\listparameter\c!pagecommand{#5}}}}}}}%
- #8}%
- \listparameter\c!after}
-
-\def\dodofreehlistelement#1#2#3#4#5#6%
- {\dodofreelistelement{#1}{#2}{#3}{#4}{#5}{#6}
- {\noindent}{}}
-
-\def\dodofreevlistelement#1#2#3#4#5#6% % \nointerlineskip needed,
- {\dodofreelistelement{#1}{#2}{#3}{#4}{#5}{#6} % otherwise wrong spacing
- {\ifvmode\nointerlineskip\fi} % at multi-line lists
- {\ifvmode\nointerlineskip\fi\endgraf\allowbreak}} % test is saveguard
-
-% to be documented: align, hang
-
-\def\limitatedlistentry#1%
- {\doifelsenothing{\listparameter\c!maxwidth}
- {\listparameter\c!textcommand{#1}}
- {\listparameter\c!textcommand
- {\limitatetext
- {#1}%
- {\listparameter\c!maxwidth}%
- {\splitsymbol{\listparameter\c!limittext}}}}}
-
-\def\dodofixdlistelementABC#1#2#3#4#5#6% weeden
- {\endgraf
- \leftskip\listparameter\c!margin% na de \endgraf !
- \listparameter\c!before
- \!!widthc\listparameter\c!distance
- \doifelse{\listparameter\c!width}\v!fit
- {\!!widtha\zeropoint}
- {\doifelsenothing{#3}
- {\doifelse{\listparameter\c!aligntitle}\v!yes
- {\!!widtha\zeropoint
- \!!widthc\zeropoint}
- {\!!widtha\listparameter\c!width}}
- {\!!widtha\listparameter\c!width}}%
- \endgraf
- \noindent
- \domakelistelement\v!all{#2}\hbox
- {\setlocalhsize
- \hsize\localhsize
- \hbox to \hsize
- {\forgetall
- \useliststyleandcolor\c!style\c!color
- \!!widthb\hsize
- \doifelse{\listparameter\c!headnumber}\v!yes
- {\setbox2\hbox \ifdim\!!widtha>\zeropoint to \!!widtha \fi
- {\domakelistelement\v!sectionnumber{#2}\hbox
- {\usenestedliststyleandcolor\c!numberstyle\c!numbercolor
- {\listparameter\c!numbercommand{\currentlistsymbol}}%
- \hfill}}}
- {\!!widtha\zeropoint
- \!!widthc\zeropoint
- \setbox2\emptyhbox}%
- \setbox4\hbox
- {\doif{\listparameter\c!pagenumber}\v!yes
- {\doifsomething{#5} % \listwidth is new ; temp hack
- {\hbox \ifdim\listwidth>\zeropoint to \listwidth\fi
- {\hfill
- \domakelistelement\v!pagenumber{#2}\hbox
- {\usenestedliststyleandcolor\c!pagestyle\c!pagecolor
- {\listparameter\c!pagecommand{#5}}}}}}}%
- \vbox
- {\hsize\!!widthb
- \setupalign[\listparameter\c!align]%
- \ifdim\!!widtha<\hsize
- \hangindent\wd2
- \dimen2=\!!widthc % \listparameter\c!distance
- \advance\hangindent \dimen2
- \hangafter\plusone
- \doif{\listparameter\c!hang}\v!no{\hangafter\zerocount}%
- \ifdim\wd4=\zeropoint % \ifvoid4
- % we kunnen gewoon afbreken aan het eind
- \else
- \ifdim\listskip>\zeropoint\relax
- \rightskip\listskip\!!plus\liststretch\relax
- \parfillskip-\rightskip
- \fi
- \fi
- \else
- \dimen2\zeropoint
- \fi
- \parindent\zeropoint\relax
- \leavevmode
-% % topaligned
-%
-% \dontleavehmode
-% \scratchdimen\wd2
-% \setbox2\hbox to \hsize{\box2\hss\box4}%
-% \wd2\scratchdimen
-%
- \box2\relax
- \hskip\dimen2
- \domakelistelement\v!text{#2}\firstofoneargument
- {\bgroup
- \usenestedliststyleandcolor\c!textstyle\c!textcolor
- {\let\\=\newlineinlist
- \dontconvertfont
- %\listparameter\c!textcommand{#4}}%
- \limitatedlistentry{#4}}%
- %\carryoverpar % new otherwise wrong linespacing
- \egroup}%
- \ifdim\wd4=\zeropoint\relax % \ifvoid4
- % \ifdim\!!widtha<\hsize \hfill\strut \fi % spoils align
- \else
- \nobreak\listfill
- \box4\relax
- \relax
- \fi}%
- \hss}}% new
- \endgraf % new, else problems with nointerlinespace and prevdepth
- \nointerlineskip % anders verkeerde spatiering bij multi-line
- \endgraf
- \allowbreak
- \listparameter\c!after}
-
-% % example from the context list
-%
-% \setuphead [part] [page=right,placehead=yes]
-% \setuplist [chapter] [alternative=d,before=\blank,after=\blank]
-% \setuplist [part] [before=\blank,after=\blank]
-%
-% \starttext
-% \startnarrower[2*right] \placecontent \stopnarrower
-% \blank[4*big]
-% \startsetups chapter
-% \blank \startnarrower[3*middle] \placecontent[criterium=local] \stopnarrower
-% \stopsetups
-% \placelist[part][criterium=text,after=\setups{chapter}]
-%
-% \part{First part} \chapter{Chapter one} \chapter{Chapter two}
-% \chapter{Chapter three} \chapter{Chapter four} \chapter{Chapter five}
-% \part{Second part} \chapter{Chapter one} \chapter{Chapter two}
-% \chapter{Chapter three} \chapter{Chapter four} \chapter{Chapter five}
-% \part{Third part} \chapter{Chapter one} \chapter{Chapter two}
-% \chapter{Chapter three} \chapter{Chapter four} \chapter{Chapter five}
-% \stoptext
-
-% overrulen interactie kan sneller, bv door hulpconstanten
-% te gebruiken en die te letten
-
-\def\dodofixdlistelementD#1#2#3#4#5#6%
- {%\leftskip=\listparameter\c!margin
- \ifvmode
- \advance\leftskip\listparameter\c!margin% AANGEPAST
- \fi
- \bgroup
- \ifvmode
- \noindent\leavevmode % leavevmode ? ? ?
- \fi
-%% actually, the next can be supported now (will be enabled when I have time to test it)
- \doif{\listparameter\c!interaction}\v!text % not supported
- {\setlistparameter\currentlist\c!interaction\v!sectionnumber}%
- \doif{\listparameter\c!interaction}\v!all % not supported
- {\setlistparameter\currentlist\c!interaction\v!sectionnumber}%
-%%
- \setbox4\hbox
- {\doif{\listparameter\c!pagenumber}\v!yes
- {\doifsomething{#5}
- {\domakelistelement\v!pagenumber{#2}\hbox
- {\usenestedliststyleandcolor\c!pagestyle\c!pagecolor
- {\listparameter\c!pagecommand{#5}}}}}}%
-%% \domakelistelement\v!all{#2}\firstofoneargument{%
- \doif{\listparameter\c!headnumber}\v!yes
- {\donetrue
- \doifnothing{#3}{\doifnothing{\listparameter\c!symbol}\donefalse}%
- % == \doifnothing{#3\listparameter\c!symbol}\donefalse
- \ifdone
- \hbox
- {\listparameter\c!left
- \domakelistelement\v!sectionnumber{#2}\hbox
- {\usenestedliststyleandcolor\c!numberstyle\c!numbercolor
- {\listparameter\c!numbercommand{\currentlistsymbol}}}%
- \listparameter\c!right
- \hskip.5em}%
- \nobreak
- \fi}%
- \tolerance3500 % niet zomaar veranderen
-%% \domakelistelement\v!text{#2}\firstofoneargument{%
- \usenestedliststyleandcolor\c!textstyle\c!textcolor
- {\let\\=\newlineinlist
- \dontconvertfont
- %\listparameter\c!textcommand{#4}}%
- \limitatedlistentry{#4}}%
-%% }%
- \ifvoid4\else
- \nobreak
- \hskip.75em\relax
- \nobreak
- \box4
- \fi
-%% }%
- \dimen0=\listparameter\c!distance\relax
- \ifdim\dimen0<1em\relax
- \hskip1em\!!plus1em\!!minus.25em\relax
- \else
- \hskip\dimen0\!!plus.5\dimen0\!!minus.25\dimen0\relax
- \fi
- \egroup}
-
-\def\dodofixdlistelementE#1%
- {\dodofixdlistelementEFG
- {\setupinteraction[\c!strut=\v!no]}
- {\letlistparameter\c!depth\!!zeropoint
- \letlistparameter\c!color\empty
- \inheritedlistframed}
- {}}
-
-\def\dodofixdlistelementF#1%
- {\dodofixdlistelementEFG
- {}
- {\dosetraggedhbox{\listparameter\c!align}\raggedbox}
- {}}
-
-\def\dodofixdlistelementG#1%
- {\dodofixdlistelementEFG
- {}
- \midaligned
- {}}
-
-\def\dodofixdlistelementEFG#1#2#3#4#5#6#7#8%
- {\noindent
- \bgroup
- \domakelistelement\v!all{#4}{#2}%
- {\let\\=\newlineinlist
- #1% in case E nils the strut (still needed?)
- \usesetliststyleandcolor\c!style\c!color
- \ignorespaces\dontconvertfont\setstrut
- \begstrut
- \limitatedlistentry{#6}%
- \endstrut}%
- \egroup
- \par
- \listparameter\c!inbetween}
-
-\def\listlength{\utilitylistlength}
-\def\listwidth {\utilitylistwidth}
-\def\listheight{\utilitylistheight}
-
-\def\utilitylistlength {0}
-\def\utilitylistwidth {0pt} % no longer supported
-\def\utilitylistheight {0pt} % no longer supported
-
-\def\dodeterminelistcharacteristics[#1][#2]%
- {\begingroup
- \setuplist[#1][#2]%
- \edef\currentlist{\firststructureelementinlist{#1}}%
- \the\everystructurelist
- \doanalyzestructurelist{#1}{\listparameter\c!criterium}{\number\listparameter\c!number}%
- \xdef\utilitylistlength{\structurelistsize}%
- \endgroup
- \dosetlistmode}
-
-\unexpanded\def\determinelistcharacteristics
- {\dodoubleempty\dodeterminelistcharacteristics}
-
-% todo: make simple parameter handler
-
-\def\combinedlistparameter#1{\csname\??ih\currentcombinedlist#1\endcsname} % to be redone!
-\def\combinedlisttoks {\csname\??ih::\currentcombinedlist\endcsname} % to be redone!
-
-\unexpanded\def\definecombinedlist
- {\dotripleempty\dodefinecombinedlist}
-
-\def\dodefinecombinedlist[#1][#2][#3]%
- {\edef\currentcombinedlist{#1}%
- \getparameters
- [\??ih#1]
- [\c!criterium=\v!local,\c!number=0,\c!list={#2},#3]%
- \expandafter\newtoks\csname\??ih::\currentcombinedlist\endcsname
- \combinedlisttoks{#3}%
- \setvalue{\e!setup#1\e!endsetup}{\dodoubleempty\dosetupcombinedlist[#1]}%
- \setvalue{\e!place#1}{\dodoubleempty\doplacecombinedlist[#1]}%
- \setvalue{\e!complete#1}{\dodoubleempty\docompletecombinedlist[#1]}}
-
-\unexpanded\def\setupcombinedlist
- {\dodoubleargument\dosetupcombinedlist}
-
-% \def\dosetupcombinedlist[#1][#2]% this will change, as we now adapt all list elements
-% {\getparameters[\??ih#1][#2]% % maybe some parent magic or store in a toks
-% \edef\currentcombinedlist{#1}%
-% \normalexpanded{\setuplist[\combinedlistparameter\c!list]}[#2]}
-
-\def\dosetupcombinedlist[#1][#2]%
- {\edef\currentcombinedlist{#1}%
- \getparameters[\??ih#1][#2]%
- \combinedlisttoks\expandafter{\the\combinedlisttoks,#2}}% can accumulate
-
-\unexpanded\def\placecombinedlist
- {\dodoubleempty\doplacecombinedlist}
-
-\def\doplacecombinedlist[#1][#2]% we can move much of the analysis to lua
- {\begingroup
- % level is no longer supported
- \edef\currentcombinedlist{#1}%
- \getparameters[\??ih#1][#2]%
- \edef\combinedlist{\combinedlistparameter\c!list}%
- \the\everystructurelist
- \doif{\combinedlistparameter\c!coupling}\v!on{\startlistreferences{#1}}%
- \dobeginoflist
-% \normalexpanded{\setuplist[\combinedlist][#2]}%
-\normalexpanded{\setuplist[\combinedlist][\the\combinedlisttoks,#2]}% or ,}#2]%
- \doplacestructurelist
- {\combinedlist}%
- {\combinedlistparameter\c!criterium}%
- {\combinedlistparameter\c!number}%
- {\combinedlistparameter\c!extras}%
- {\combinedlistparameter\c!order}%
- \doendoflist
- \stoplistreferences
- \endgroup
- \dosetlistmode}
-
-\def\docompletecombinedlist[#1][#2]%
- {\normalexpanded{\startnamedsection[\v!title][\c!title={\headtext{#1}},\c!reference=#1]}%
- \doplacecombinedlist[#1][#2]%
- \stopnamedsection}
-
-% lists that have a number/title are kind of generic and can share code
-
-\installstructurelistprocessor{number+title}
- {\dodolistelement
- \currentlist
- \structurelistlocation
- \structurelistgenericnumber
- \structurelistgenerictitle
- \structurelistpagenumber
- \structurelistrealpagenumber}
-
-\def\structurelistgenerictitle
- {\dostarttagged\t!listcontent\empty
- \ctxlua{structures.lists.title("\currentlist",\currentlistindex)}%
- \dostoptagged}
-
-\def\structurelistgenericnumber % tricky, we need to delay tagging as we have nested lua calls
- {\dostarttagged\t!listtag\empty
- \ctxlua{structures.lists.prefixednumber("\currentlist",\currentlistindex, {
- prefix = "\listparameter\c!prefix",
- separatorset = "\listparameter\c!prefixseparatorset",
- conversionset = "\listparameter\c!prefixconversionset",
- starter = \!!bs\listparameter\c!prefixstarter\!!es,
- stopper = \!!bs\listparameter\c!prefixstopper\!!es,
- set = "\listparameter\c!prefixset",
- segments = "\listparameter\c!prefixsegments",
- connector = \!!bs\listparameter\c!prefixconnector\!!es,
- },
- {
- separatorset = "\listparameter\c!numberseparatorset",
- conversionset = "\listparameter\c!numberconversionset",
- starter = \!!bs\listparameter\c!numberstarter\!!es,
- stopper = \!!bs\listparameter\c!numberstopper\!!es,
- segments = "\listparameter\c!numbersegments",
- } )}%
- \dostoptagged}
-
-\protect \endinput