diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-19 23:37:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-19 23:37:39 +0000 |
commit | 69de3344104bfec286cbe7ea63f03fab58d3c1ec (patch) | |
tree | 14d60f3983479b6a35b024ed1c170d109b86d4e9 /Master/texmf-dist/tex/context/base/strc-lst.lua | |
parent | 9ff55323bdb88ede985266ee9123bc2cdda58848 (diff) |
context update from cont-tmf.zip of Apr 20 01:16, 11085698 bytes
git-svn-id: svn://tug.org/texlive/trunk@30044 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-lst.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/strc-lst.lua | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-lst.lua b/Master/texmf-dist/tex/context/base/strc-lst.lua index 95f5e675ecd..ad7dc0f5413 100644 --- a/Master/texmf-dist/tex/context/base/strc-lst.lua +++ b/Master/texmf-dist/tex/context/base/strc-lst.lua @@ -115,12 +115,31 @@ end job.register('structures.lists.collected', tobesaved, initializer) +local groupindices = table.setmetatableindex("table") + +function lists.groupindex(name,group) + local groupindex = groupindices[name] + return groupindex and groupindex[group] or 0 +end + function lists.addto(t) + local m = t.metadata local u = t.userdata if u and type(u) == "string" then t.userdata = helpers.touserdata(u) -- nicer at the tex end end - local m = t.metadata + local numberdata = t.numberdata + local group = numberdata and numberdata.group + if not group then + -- forget about it + elseif group == "" then + group, numberdata.group = nil, nil + else + local groupindex = groupindices[m.name][group] + if groupindex then + numberdata.numbers = cached[groupindex].numberdata.numbers + end + end local r = t.references local i = r and r.internal or 0 -- brrr local p = pushed[i] @@ -134,6 +153,9 @@ function lists.addto(t) if setcomponent then setcomponent(t) -- might move to the tex end end + if group then + groupindices[m.name][group] = p + end return p end @@ -196,11 +218,12 @@ end local nesting = { } function lists.pushnesting(i) - local r = lists.result[i] - local name = r.metadata.name - local numberdata = r and r.numberdata - local n = (numberdata and numberdata.numbers[sections.getlevel(name)]) or 0 - insert(nesting, { number = n, name = name, result = lists.result, parent = r }) + local parent = lists.result[i] + local name = parent.metadata.name + local numberdata = parent and parent.numberdata + local numbers = numberdata and numberdata.numbers + local number = numbers and numbers[sections.getlevel(name)] or 0 + insert(nesting, { number = number, name = name, result = lists.result, parent = parent }) end function lists.popnesting() @@ -656,11 +679,12 @@ commands.listprefixednumber = lists.prefixednumber commands.listprefixedpage = lists.prefixedpage -function commands.addtolist (...) context(lists.addto (...)) end -- we could use variables instead of print -function commands.listsize (...) context(lists.size (...)) end -function commands.listlocation(...) context(lists.location(...)) end -function commands.listlabel (...) context(lists.label (...)) end -function commands.listrealpage(...) context(lists.realpage(...)) end +function commands.addtolist (...) context(lists.addto (...)) end -- we could use variables instead of print +function commands.listsize (...) context(lists.size (...)) end +function commands.listlocation (...) context(lists.location (...)) end +function commands.listlabel (...) context(lists.label (...)) end +function commands.listrealpage (...) context(lists.realpage (...)) end +function commands.listgroupindex(...) context(lists.groupindex(...)) end function commands.listuserdata(...) local str, metadata = lists.userdata(...) |