summaryrefslogtreecommitdiff
path: root/tex/context/base/page-lin.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2010-10-10 22:38:43 +0300
committerMarius <mariausol@gmail.com>2010-10-10 22:38:43 +0300
commit16099e33b6d50b37bcddb96e29777a235d2335d7 (patch)
tree724169a7882d1588f8ee4a4511c73fb9b9a232cd /tex/context/base/page-lin.lua
parent2040be98036288cccf0384479819e8c0c17e8d8d (diff)
downloadcontext-16099e33b6d50b37bcddb96e29777a235d2335d7.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