diff options
author | Marius <mariausol@gmail.com> | 2010-12-13 22:20:15 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-12-13 22:20:15 +0200 |
commit | 7c318ca9064f51e8b438791b98dd552327bb7a00 (patch) | |
tree | 5d25960e97cbe9b56c81868e5383244369441b98 /tex/context/base/strc-lst.mkiv | |
parent | 0146de7d78f6f4a964d77530c01a517566e12234 (diff) | |
download | context-7c318ca9064f51e8b438791b98dd552327bb7a00.tar.gz |
beta 2010.12.13 20:58
Diffstat (limited to 'tex/context/base/strc-lst.mkiv')
-rw-r--r-- | tex/context/base/strc-lst.mkiv | 72 |
1 files changed, 48 insertions, 24 deletions
diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv index 526ed0409..f037ea6ae 100644 --- a/tex/context/base/strc-lst.mkiv +++ b/tex/context/base/strc-lst.mkiv @@ -70,9 +70,18 @@ \def\structurelistinject{\dotripleempty\dostructurelistinject} -\def\dostructurelistinject[#1][#2][#3]% +\def\dostructurelistinject[#1]% [#2][#3]% no check on nofarguments here {\begingroup - \edef\currentlistname{#1}% + \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}% \setnextinternalreference \edef\currentlistnumber{\ctxlua{structures.lists.push{ references = { @@ -81,16 +90,15 @@ section = structures.sections.currentid(), }, metadata = { - kind = "#2", - name = "\currentlistname", + kind = "\currentlisttype", + name = "\currentlist", level = structures.sections.currentlevel(), catcodes = \the\catcodetable, }, - userdata = structures.helpers.touserdata(\!!bs\detokenize{#3}\!!es) + userdata = structures.helpers.touserdata(\!!bs\detokenize{#2}\!!es) }}}% - \edef\structurelistsynchronize{\getvalue{\??li::inject::#2::synchronize}}% % we can do the enhance injection at the lua end which saves tokenization and a call - \ifx\structurelistsynchronize\v!yes + \ifx\currentlistlocation\v!here % this injects nodes ! \expanded{\ctxlatelua{structures.lists.enhance(\currentlistnumber)}}% % new from here @@ -381,23 +389,39 @@ \let\dowritetolist \gobblefourarguments \let\dodowritetolist\gobblefourarguments -% some day we will have \definestructurelistinjector or maybe just as key in #3 - -\letvalue{\??li::inject::command::synchronize}\v!no -\letvalue{\??li::inject::userdata::synchronize}\v!no -\letvalue{\??li::inject::simple::synchronize}\v!yes - -\unexpanded\def\writebetweenlist[#1]#2% - {\doif{\namedlistparameter{#1}\c!state}\v!start{\structurelistinject[#1][command][command={#2}]}} - -\unexpanded\def\writedatatolist - {\dodoubleargument\dowritedatatolist} - -\def\dowritedatatolist[#1][#2]% - {\doif{\namedlistparameter{#1}\c!state}\v!start{\structurelistinject[#1][userdata][#2]}} - -\unexpanded\def\writetolist[#1]#2#3% - {\doif{\namedlistparameter{#1}\c!state}\v!start{\structurelistinject[#1][simple][first={#2},second={#3}]}} +% 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 |