diff options
author | Hans Hagen <pragma@wxs.nl> | 2013-06-04 19:42:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2013-06-04 19:42:00 +0200 |
commit | fb6533c362f27e9811417482f57ea8cbdd31abf0 (patch) | |
tree | 1f97acb4bbbb3777738581c89e7211b0664f678a /tex/context/base/strc-lst.lua | |
parent | f7eaca8dd3301d6526d1610e523d6538404dc95b (diff) | |
download | context-fb6533c362f27e9811417482f57ea8cbdd31abf0.tar.gz |
beta 2013.06.04 19:42
Diffstat (limited to 'tex/context/base/strc-lst.lua')
-rw-r--r-- | tex/context/base/strc-lst.lua | 30 |
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 |