summaryrefslogtreecommitdiff
path: root/tex/context/base/page-lin.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2010-10-10 14:25:00 +0200
committerHans Hagen <pragma@wxs.nl>2010-10-10 14:25:00 +0200
commit1b2a17ebfd56124803e8d0168c2755cb073ff425 (patch)
tree5cb2721788834bf63282ed75762fcae17e5719ea /tex/context/base/page-lin.lua
parente34ee22d154fbde65af2d2c6283e0049b41dee8b (diff)
downloadcontext-1b2a17ebfd56124803e8d0168c2755cb073ff425.tar.gz
beta 2010.10.10 14:25
Diffstat (limited to 'tex/context/base/page-lin.lua')
-rw-r--r--tex/context/base/page-lin.lua46
1 files changed, 43 insertions, 3 deletions
diff --git a/tex/context/base/page-lin.lua b/tex/context/base/page-lin.lua
index e814fd7c4..895f0ec80 100644
--- a/tex/context/base/page-lin.lua
+++ b/tex/context/base/page-lin.lua
@@ -178,11 +178,43 @@ local function check_number(n,a,skip,sameline)
end
end
-function boxed.stage_one(n)
+-- xlist
+-- xlist
+-- hlist
+
+local function identify(list)
+ if list then
+ for n in traverse_id(hlist_code,list) do
+ if has_attribute(n,a_linenumber) then
+ return list
+ end
+ end
+ local n = list
+ while n do
+ local id = n.id
+ if id == hlist_code or id == vlist_code then
+ local ok = identify(n.list)
+ if ok then
+ return ok
+ end
+ end
+ n = n.next
+ end
+ end
+end
+
+function boxed.stage_zero(n)
+ return identify(texbox[n].list)
+end
+
+function boxed.stage_one(n,nested)
current_list = { }
local head = texbox[n]
if head then
local list = head.list
+ if nested then
+ list = identify(list)
+ end
local last_a, last_v, skip = nil, -1, false
for n in traverse_id(hlist_code,list) do -- attr test here and quit as soon as zero found
if n.height == 0 and n.depth == 0 then
@@ -200,6 +232,9 @@ function boxed.stage_one(n)
da.start = 1 -- eventually we will have a normal counter
end
last_a = a
+ if trace_numbers then
+ report_lines("starting line number range %s: start %s, continue",a,da.start,da.continue or "no")
+ end
end
if has_attribute(n,a_displaymath) then
if nodes.is_display_math(n) then
@@ -231,8 +266,13 @@ function boxed.stage_two(n,m)
for i=1,#current_list do
local li = current_list[i]
local n, m, ti = li[1], li[2], t[i]
- ti.next, n.list = n.list, ti
- resolve(n,m)
+ if ti then
+ ti.next, n.list = n.list, ti
+ resolve(n,m)
+ else
+ report_lines("error in linenumbering (1)")
+ return
+ end
end
end
end