From 92c4ba2c9a6404cbf3ac78f7b120b2c5892a45e7 Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 29 Sep 2010 15:27:34 +0100 Subject: beta 2010.09.29 10:46 --- tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/strc-lst.lua | 51 ++++++++++++++++++---- tex/context/base/strc-lst.mkiv | 65 +++++++++++++++++++++-------- tex/context/interface/cont-cs.xml | 2 +- tex/context/interface/cont-de.xml | 2 +- tex/context/interface/cont-en.xml | 2 +- tex/context/interface/cont-fr.xml | 2 +- tex/context/interface/cont-it.xml | 2 +- tex/context/interface/cont-nl.xml | 2 +- tex/context/interface/cont-pe.xml | 2 +- tex/context/interface/cont-ro.xml | 2 +- tex/generic/context/luatex-fonts-merged.lua | 2 +- 13 files changed, 100 insertions(+), 38 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index caf609b45..7b2b86610 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.09.28 23:57} +\newcontextversion{2010.09.29 10:46} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 993eecd1d..48d039a4d 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.09.28 23:57} +\edef\contextversion{2010.09.29 10:46} %D For those who want to use this: diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index f237b6e42..c15b834d0 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -53,6 +53,25 @@ references.specials = references.specials or { } local variables = interfaces.variables local matchingtilldepth, numberatdepth = sections.matchingtilldepth, sections.numberatdepth +-- -- -- -- -- -- + +function table.zerostrippedconcat(t,separator) + local f, l = 1, #t + for i=f,l do + if t[i] == 0 then + f = f + 1 + end + end + for i=l,f,-1 do + if t[i] == 0 then + l = l - 1 + end + end + return concat(t,separator,f,l) +end + +-- -- -- -- -- -- + local function initializer() -- create a cross reference between internal references -- and list entries @@ -251,7 +270,7 @@ local function filtercollected(names, criterium, number, collected, forced, nest local cnumbers = sectionnumber.numbers local metadata = v.metadata if cnumbers then ---~ print(#cnumbers, depth, table.concat(cnumbers)) +--~ print(#cnumbers, depth, concat(cnumbers)) if metadata and not metadata.nolist and (all or names[metadata.name or false]) and #cnumbers >= depth then local ok = true for d=1,depth do @@ -350,24 +369,27 @@ end lists.filtercollected = filtercollected -function lists.filter(names, criterium, number, forced) - return filtercollected(names, criterium, number, lists.collected, forced) +function lists.filter(specification) + return filtercollected(specification.names, specification.criterium, specification.number, lists.collected, specification.forced) end lists.result = { } -function lists.process(...) - lists.result = lists.filter(...) +function lists.process(specification) + lists.result = lists.filter(specification) + local specials = utilities.parsers.settings_to_hash(specification.extras or "") + specials = next(specials) and specials or nil for i=1,#lists.result do local r = lists.result[i] local m = r.metadata - texsprint(ctxcatcodes,format("\\processlistofstructure{%s}{%s}{%i}",m.name,m.kind,i)) ---~ context.processlistofstructure(m.name,m.kind,i) + local s = specials and r.numberdata and specials[table.zerostrippedconcat(r.numberdata.numbers,".")] or "" + texsprint(ctxcatcodes,format("\\processlistofstructure{%s}{%s}{%i}{%s}",m.name,m.kind,i,s)) +--~ context.processlistofstructure(m.name,m.kind,i,s) end end -function lists.analyze(...) - lists.result = lists.filter(...) +function lists.analyze(specification) + lists.result = lists.filter(specification) end function lists.userdata(name,r,tag) -- to tex (todo: xml) @@ -397,6 +419,17 @@ function lists.location(n) texsprint(l.references.internal or n) end +--~ function lists.stamp(n) +--~ local l = lists.result[n] +--~ local numberdata = l.numberdata +--~ if numberdata then +--~ local numbers = numberdata.numbers +--~ if numbers then +--~ tex.sprint(table.zerostrippedconcat(numbers,".")) +--~ end +--~ end +--~ end + function lists.sectionnumber(name,n,spec) local data = lists.result[n] local sectiondata = sections.collected[data.references.section] diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv index 59b69d516..e13ad52c8 100644 --- a/tex/context/base/strc-lst.mkiv +++ b/tex/context/base/strc-lst.mkiv @@ -148,9 +148,14 @@ % \appendtoks % \to \everystructurelist -\unexpanded\def\placestructurelist#1#2#3% hm ... [][][] +\unexpanded\def\placestructurelist#1#2#3#4% {\dostarttagged\t!list\empty - \ctxlua{structures.lists.process("#1","#2","#3")}% + \ctxlua{structures.lists.process { + names = "#1", + criterium = "#2", + number = "#3", + extras = "#4" + }}% \dostoptagged} \unexpanded\def\analyzestructurelist#1#2#3% @@ -181,11 +186,28 @@ % \chapter{Two} \section{First} \section{Second} % \stoptext -\unexpanded\def\processlistofstructure#1#2#3% name, method, n +\def\definelistextra + {\dodoubleargument\dodefinelistextra} + +\def\dodefinelistextra[#1][#2]% + {\getparameters[\??li:\c!extras:#1:][#2]} + +% todo: more generic tracing + +\definelistextra + [\v!page] + [\c!before={\showmessage\m!systems{14}{\currentlist/\currentlistindex}\page}] + +\def\processlistextrabefore{\executeifdefined{\??li:\c!extras:\currentlistextra:\c!before}\relax} +\def\processlistextraafter {\executeifdefined{\??li:\c!extras:\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\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 @@ -194,6 +216,7 @@ \s!default \fi\fi\fi \endcsname \dostoptagged + \processlistextraafter \ctxlua{structures.lists.popnesting()}} % \installstructcurelistprocessor{pubs:userdata} @@ -289,7 +312,7 @@ \c!pagecommand=\listpagecommand, \c!pagenumber=\v!yes, \c!headnumber=\v!yes, - \c!pageboundaries=, + \c!extras=, \c!margin=\!!zeropoint, \c!aligntitle=, \c!before=, @@ -387,7 +410,11 @@ \edef\currentlist{\firststructureelementinlist{#1}}% \the\everystructurelist \doif{\listparameter\c!coupling}\v!on{\startlistreferences{#1}}% - \placestructurelist{#1}{\listparameter\c!criterium}{\number\listparameter\c!number}% + \placestructurelist + {#1}% + {\listparameter\c!criterium}% + {\number\listparameter\c!number}% + {\listparameter\c!extras}% \stoplistreferences \endgroup \dosetlistmode} @@ -559,16 +586,14 @@ {\edef\currentlist{#1}% \edef\currentlistnumber{#3}% \docurrentlistalternative - %\showcomposition - \let\@@iawidth\!!zeropoint % moet boolean worden - \begingroup - \edef\listelements{\listparameter\c!pageboundaries}% - \normalexpanded{\noexpand\doifinset{#3}{\listelements}} - {\showmessage\m!systems{14}{#3}% - \page}% - \endgroup + \let\@@iawidth\!!zeropoint % todo: constant or so +% \begingroup +% \edef\listelements{\listparameter\c!pageboundaries}% +% \normalexpanded{\noexpand\doifinset{#3}{\listelements}} +% {\showmessage\m!systems{14}{#3}% +% \page}% +% \endgroup \dontcomplain - %\setfullsectionnumber{\??li\currentlist}% todo \dosomelistelement{#1}{#2}{#3}{#4}{#5}{#6}} \def\dodocommandlistelement#1#2#3#4#5#6% @@ -900,7 +925,11 @@ \doif{\combinedlistparameter\c!coupling}\v!on{\startlistreferences{#1}}% \dobeginoflist \normalexpanded{\noexpand\dosetuplist[\combinedlist][#2]}% - \placestructurelist{\combinedlist}{\combinedlistparameter\c!criterium}{\combinedlistparameter\c!number}% + \placestructurelist + {\combinedlist}% + {\combinedlistparameter\c!criterium}% + {\combinedlistparameter\c!number}% + {\combinedlistparameter\c!pageboundaries}% \doendoflist \stoplistreferences \endgroup diff --git a/tex/context/interface/cont-cs.xml b/tex/context/interface/cont-cs.xml index 5214a4254..e4d5db460 100644 --- a/tex/context/interface/cont-cs.xml +++ b/tex/context/interface/cont-cs.xml @@ -5033,7 +5033,7 @@ - + diff --git a/tex/context/interface/cont-de.xml b/tex/context/interface/cont-de.xml index acdb17c5a..36f3c7f23 100644 --- a/tex/context/interface/cont-de.xml +++ b/tex/context/interface/cont-de.xml @@ -5033,7 +5033,7 @@ - + diff --git a/tex/context/interface/cont-en.xml b/tex/context/interface/cont-en.xml index 5611cbfbf..826fabd93 100644 --- a/tex/context/interface/cont-en.xml +++ b/tex/context/interface/cont-en.xml @@ -5033,7 +5033,7 @@ - + diff --git a/tex/context/interface/cont-fr.xml b/tex/context/interface/cont-fr.xml index a062fec82..84cfb0dba 100644 --- a/tex/context/interface/cont-fr.xml +++ b/tex/context/interface/cont-fr.xml @@ -5033,7 +5033,7 @@ - + diff --git a/tex/context/interface/cont-it.xml b/tex/context/interface/cont-it.xml index de37bdff9..38e5d5a8d 100644 --- a/tex/context/interface/cont-it.xml +++ b/tex/context/interface/cont-it.xml @@ -5033,7 +5033,7 @@ - + diff --git a/tex/context/interface/cont-nl.xml b/tex/context/interface/cont-nl.xml index b82a7d07a..a0f6b6fba 100644 --- a/tex/context/interface/cont-nl.xml +++ b/tex/context/interface/cont-nl.xml @@ -5033,7 +5033,7 @@ - + diff --git a/tex/context/interface/cont-pe.xml b/tex/context/interface/cont-pe.xml index 36cd1bb1c..de53b0679 100644 --- a/tex/context/interface/cont-pe.xml +++ b/tex/context/interface/cont-pe.xml @@ -5033,7 +5033,7 @@ - + diff --git a/tex/context/interface/cont-ro.xml b/tex/context/interface/cont-ro.xml index 156e88ea0..1bb4625bd 100644 --- a/tex/context/interface/cont-ro.xml +++ b/tex/context/interface/cont-ro.xml @@ -5033,7 +5033,7 @@ - + diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 8778ad879..9ee8f7aee 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/28/10 23:57:54 +-- merge date : 09/29/10 10:46:09 do -- begin closure to overcome local limits and interference -- cgit v1.2.3