diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/strc-doc.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/strc-doc.lua | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/strc-doc.lua b/Master/texmf-dist/tex/context/base/mkiv/strc-doc.lua index 4b2ac04b7f3..9877a0f9c0e 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/strc-doc.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/strc-doc.lua @@ -41,7 +41,7 @@ local v_positive = variables.positive local v_current = variables.current local trace_sectioning = false trackers.register("structures.sectioning", function(v) trace_sectioning = v end) -local trace_detail = false trackers.register("structures.detail", function(v) trace_detail = v end) +local trace_details = false trackers.register("structures.details", function(v) trace_details = v end) local report_structure = logs.reporter("structure","sectioning") local report_used = logs.reporter("structure") @@ -335,7 +335,7 @@ function sections.setentry(given) -- a trick to permit userdata to overload title, ownnumber and reference -- normally these are passed as argument but nowadays we provide several -- interfaces (we need this because we want to be compatible) - if trace_detail then + if trace_details then report_structure("name %a, mapped level %a, old depth %a, new depth %a, reset set %a", givenname,mappedlevel,olddepth,newdepth,resetset) end @@ -354,7 +354,7 @@ function sections.setentry(given) if newdepth > olddepth then for i=olddepth+1,newdepth do local s = tonumber(sets.get("structure:resets",data.block,saveset and saveset[i] or resetset,i)) - if trace_detail then + if trace_details then report_structure("new depth %s, old depth %s, reset set %a, reset value %a, current %a",olddepth,newdepth,resetset,s,numbers[i]) end if not s or s == 0 then @@ -369,7 +369,7 @@ function sections.setentry(given) elseif newdepth < olddepth then for i=olddepth,newdepth+1,-1 do local s = tonumber(sets.get("structure:resets",data.block,saveset and saveset[i] or resetset,i)) - if trace_detail then + if trace_details then report_structure("new depth %s, old depth %s, reset set %a, reset value %a, current %a",olddepth,newdepth,resetset,s,numbers[i]) end if not s or s == 0 then @@ -402,12 +402,12 @@ function sections.setentry(given) newn = 1 -- maybe zero is nicer end forced[newdepth] = nil - if trace_detail then + if trace_details then report_structure("old depth %a, new depth %a, old n %a, new n %a, forced %t",olddepth,newdepth,oldn,newn,fd) end else newn = oldn + 1 - if trace_detail then + if trace_details then report_structure("old depth %a, new depth %a, old n %a, new n %a, increment",olddepth,newdepth,oldn,newn) end end @@ -426,7 +426,7 @@ function sections.setentry(given) if #ownnumbers > 0 then numberdata.ownnumbers = fastcopy(ownnumbers) -- { unpack(ownnumbers) } end - if trace_detail then + if trace_details then report_structure("name %a, numbers % a, own numbers % a",givenname,numberdata.numbers,numberdata.ownnumbers) end if not references.block then @@ -672,8 +672,15 @@ local function process(index,numbers,ownnumbers,criterium,separatorset,conversio end end -function sections.typesetnumber(entry,kind,...) -- kind='section','number','prefix' - if entry and entry.hidenumber ~= true then -- can be nil +-- kind : section number prefix + +function sections.typesetnumber(entry,kind,...) + -- + -- Maybe the hiding becomes an option .. after all this test was there + -- for a reason, but for now we have this: + -- + -- if entry and entry.hidenumber ~= true then + if entry then local separatorset = "" local conversionset = "" local conversion = "" @@ -878,7 +885,7 @@ function sections.findnumber(depth,what) -- needs checking (looks wrong and slow if sectiondata and sectiondata.hidenumber ~= true then -- can be nil local quit = what == v_previous or what == v_next if what == v_first or what == v_previous then - for i=index,1,-1 do + for i=index-1,1,-1 do local s = collected[i] if s then local n = s.numbers @@ -893,7 +900,7 @@ function sections.findnumber(depth,what) -- needs checking (looks wrong and slow end end elseif what == v_last or what == v_next then - for i=index,#collected do + for i=index+1,#collected do local s = collected[i] if s then local n = s.numbers |