summaryrefslogtreecommitdiff
path: root/tex/context/base/strc-lst.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/strc-lst.lua')
-rw-r--r--tex/context/base/strc-lst.lua30
1 files changed, 25 insertions, 5 deletions
diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua
index 305b6a6fa..d5597109f 100644
--- a/tex/context/base/strc-lst.lua
+++ b/tex/context/base/strc-lst.lua
@@ -27,6 +27,9 @@ local trace_lists = false trackers.register("structures.lists", function(
local report_lists = logs.reporter("structure","lists")
+local context = context
+local commands = commands
+
local structures = structures
local lists = structures.lists
local sections = structures.sections
@@ -122,6 +125,8 @@ function lists.groupindex(name,group)
return groupindex and groupindex[group] or 0
end
+-- we could use t (as hash key) in order to check for dup entries
+
function lists.addto(t)
local m = t.metadata
local u = t.userdata
@@ -130,12 +135,13 @@ function lists.addto(t)
end
local numberdata = t.numberdata
local group = numberdata and numberdata.group
+ local name = m.name
if not group then
-- forget about it
elseif group == "" then
group, numberdata.group = nil, nil
else
- local groupindex = groupindices[m.name][group]
+ local groupindex = groupindices[name][group]
if groupindex then
numberdata.numbers = cached[groupindex].numberdata.numbers
end
@@ -154,7 +160,10 @@ function lists.addto(t)
setcomponent(t) -- might move to the tex end
end
if group then
- groupindices[m.name][group] = p
+ groupindices[name][group] = p
+ end
+ if trace_lists then
+ report_lists("added %a, internal %a",name,p)
end
return p
end
@@ -181,10 +190,17 @@ end
-- this is the main pagenumber enhancer
+local enhanced = { }
+
function lists.enhance(n)
- -- todo: symbolic names for counters
local l = cached[n]
- if l then
+ if not l then
+ report_lists("enhancing %a, unknown internal",n)
+ elseif enhanced[n] then
+ if trace_lists then
+ report_lists("enhancing %a, name %a, duplicate ignored",n,name)
+ end
+ else
local metadata = l.metadata
local references = l.references
--
@@ -196,19 +212,23 @@ function lists.enhance(n)
-- tags
local kind = metadata.kind
local name = metadata.name
+ if trace_lists then
+ report_lists("enhancing %a, name %a",n,name)
+ end
if references then
-- is this used ?
local tag = tags.getid(kind,name)
if tag and tag ~= "?" then
references.tag = tag
end
- --~ references.listindex = n
end
-- specific enhancer (kind of obsolete)
local enhancer = kind and lists.enhancers[kind]
if enhancer then
enhancer(l)
end
+ --
+ enhanced[n] = true
return l
end
end