diff options
Diffstat (limited to 'tex/context/base/mkiv/node-tra.lua')
-rw-r--r-- | tex/context/base/mkiv/node-tra.lua | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua index 8c79e0ab8..f12599866 100644 --- a/tex/context/base/mkiv/node-tra.lua +++ b/tex/context/base/mkiv/node-tra.lua @@ -11,6 +11,7 @@ if not modules then modules = { } end modules ['node-tra'] = { might become a runtime module instead. This module will be cleaned up!</p> --ldx]]-- +local next = next local utfchar = utf.char local format, match, gmatch, concat, rep = string.format, string.match, string.gmatch, table.concat, string.rep local lpegmatch = lpeg.match @@ -38,7 +39,6 @@ local nuts = nodes.nuts local tonut = nuts.tonut local tonode = nuts.tonode -local getfield = nuts.getfield local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid @@ -298,34 +298,38 @@ nodes.showsimplelist = function(h,depth) showsimplelist(h,depth,0) end local function listtoutf(h,joiner,textonly,last,nodisc) local w = { } + local n = 0 while h do local c, id = isglyph(h) if c then - w[#w+1] = c >= 0 and utfchar(c) or formatters["<%i>"](c) + n = n + 1 ; w[n] = c >= 0 and utfchar(c) or formatters["<%i>"](c) if joiner then - w[#w+1] = joiner + n = n + 1 ; w[n] = joiner end elseif id == disc_code then local pre, pos, rep = getdisc(h) if not nodisc then - w[#w+1] = formatters["[%s|%s|%s]"] ( + n = n + 1 ; w[n] = formatters["[%s|%s|%s]"] ( pre and listtoutf(pre,joiner,textonly) or "", pos and listtoutf(pos,joiner,textonly) or "", rep and listtoutf(rep,joiner,textonly) or "" ) elseif rep then - w[#w+1] = listtoutf(rep,joiner,textonly) or "" + n = n + 1 ; w[n] = listtoutf(rep,joiner,textonly) or "" + end + if joiner then + n = n + 1 ; w[n] = joiner end elseif textonly then if id == glue_code then if getwidth(h) > 0 then - w[#w+1] = " " + n = n + 1 ; w[n] = " " end elseif id == hlist_code or id == vlist_code then - w[#w+1] = "[]" + n = n + 1 ; w[n] = "[]" end else - w[#w+1] = "[-]" + n = n + 1 ; w[n] = "[-]" end if h == last then break @@ -333,7 +337,7 @@ local function listtoutf(h,joiner,textonly,last,nodisc) h = getnext(h) end end - return concat(w) + return concat(w,"",1,(w[n] == joiner) and (n-1) or n) end function nodes.listtoutf(h,joiner,textonly,last,nodisc) @@ -376,8 +380,7 @@ local f_z_f = formatters["%0.5Fpt minus %0.5F%s"] local f_z_m = formatters["%0.5Fpt minus %0.5Fpt"] local f_z_z = formatters["%0.5Fpt"] -local tonut = nodes.tonut -local getfield = nodes.nuts.getfield +local tonut = nodes.tonut local function nodetodimen(n) n = tonut(n) |