diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-10-01 16:40:17 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-10-01 16:40:17 +0200 |
commit | 80743fc19190334d3a0d4c86538663b98695a573 (patch) | |
tree | 7a94f73a318e0362bacc2596ac8fc6201ed1d1b6 /tex/context/base/mkiv/node-tra.lua | |
parent | 164a98ac4e58ae88de0a83d1eb60583827f4fbab (diff) | |
download | context-80743fc19190334d3a0d4c86538663b98695a573.tar.gz |
2017-10-01 14:38:00
Diffstat (limited to 'tex/context/base/mkiv/node-tra.lua')
-rw-r--r-- | tex/context/base/mkiv/node-tra.lua | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua index d5165c50b..fab9d51ac 100644 --- a/tex/context/base/mkiv/node-tra.lua +++ b/tex/context/base/mkiv/node-tra.lua @@ -297,34 +297,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 @@ -332,7 +336,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) |