diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/page-lin.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/page-lin.lua | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/page-lin.lua b/Master/texmf-dist/tex/context/base/mkiv/page-lin.lua index 3689c7f8d1d..a6b6a12c400 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/page-lin.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/page-lin.lua @@ -43,14 +43,15 @@ local v_no = variables.no local properties = nodes.properties local nodecodes = nodes.nodecodes +local skipcodes = nodes.skipcodes +local whatcodes = nodes.whatcodes local listcodes = nodes.listcodes local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local whatsit_code = nodecodes.whatsit local glyph_code = nodecodes.glyph - -local linelist_code = listcodes.line +local line_code = listcodes.line local a_displaymath = attributes.private('displaymath') local a_linenumber = attributes.private('linenumber') @@ -70,7 +71,7 @@ local getattr = nuts.getattr local setattr = nuts.setattr local getlist = nuts.getlist local getbox = nuts.getbox ------ getdirection = nuts.getdirection +----- getdir = nuts.getdir ----- getwidth = nuts.getwidth local getheight = nuts.getheight local getdepth = nuts.getdepth @@ -78,9 +79,8 @@ local getdepth = nuts.getdepth local setprop = nuts.setprop local getprop = nuts.getprop -local nexthlist = nuts.traversers.hlist -local nextvlist = nuts.traversers.vlist - +local traverse_id = nuts.traverse_id +local traverse = nuts.traverse local copy_node = nuts.copy ----- hpack_nodes = nuts.hpack local is_display_math = nuts.is_display_math @@ -224,9 +224,7 @@ implement { local function check_number(n,a,skip,sameline) local d = data[a] if d then - local tag = d.tag or "" - local skipflag = 0 - local s = d.start or 1 + local tag, skipflag, s = d.tag or "", 0, d.start or 1 current_list[#current_list+1] = { n, s } if sameline then skipflag = 0 @@ -246,7 +244,7 @@ local function check_number(n,a,skip,sameline) end local p = checkline(n) if p then - ctx_makelinenumber(tag,skipflag,s,p.hsize,p.reverse and 1 or 0) + ctx_makelinenumber(tag,skipflag,s,p.hsize,p.reverse and "TRT" or "TLT") else report_lines("needs checking") end @@ -285,8 +283,8 @@ end local function listisnumbered(list) if list then - for n, subtype in nexthlist, list do - if subtype == linelist_code then + for n in traverse_id(hlist_code,list) do + if getsubtype(n) == line_code then local a = getattr(n,a_linenumber) if a then -- a quick test for lines (only valid when \par before \stoplinenumbering) @@ -308,7 +306,7 @@ local function findnumberedlist(list) while n do local id = getid(n) if id == hlist_code then - if getsubtype(n) == linelist_code then + if getsubtype(n) == line_code then local a = getattr(n,a_linenumber) if a then return a > 0 and list @@ -385,8 +383,9 @@ function boxed.stage_one(n,nested) local skip = false local function check() - for n, subtype in nexthlist, list do - if subtype ~= linelist_code then + for n in traverse_id(hlist_code,list) do -- attr test here and quit as soon as zero found + local subtype = getsubtype(n) + if subtype ~= line_code then -- go on elseif getheight(n) == 0 and getdepth(n) == 0 then -- skip funny hlists -- todo: check line subtype @@ -451,7 +450,7 @@ function boxed.stage_one(n,nested) if not list then return end - for n in nextvlist, list do + for n in traverse_id(vlist_code,list) do local p = properties[n] if p and p.columngap then if trace_numbers then @@ -473,21 +472,18 @@ end function boxed.stage_two(n,m) if #current_list > 0 then m = m or lines.scratchbox - local t = { } - local tn = 0 - for l in nexthlist, getlist(getbox(m)) do + local t, tn = { }, 0 + for l in traverse_id(hlist_code,getlist(getbox(m))) do tn = tn + 1 t[tn] = copy_node(l) -- use take_box instead end for i=1,#current_list do local li = current_list[i] - local n = li[1] - local m = li[2] - local ti = t[i] + local n, m, ti = li[1], li[2], t[i] if ti then - -- local d = getdirection(n) + -- local d = getdir(n) -- local l = getlist(n) - -- if d == 1 then + -- if d == "TRT" then -- local w = getwidth(n) -- ti = hpack_nodes(linked_nodes(new_kern(-w),ti,new_kern(w))) -- end |