diff options
Diffstat (limited to 'tex/context/base/node-aux.lua')
-rw-r--r-- | tex/context/base/node-aux.lua | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/tex/context/base/node-aux.lua b/tex/context/base/node-aux.lua index 03a8789f7..43624adfd 100644 --- a/tex/context/base/node-aux.lua +++ b/tex/context/base/node-aux.lua @@ -19,7 +19,6 @@ local nodecodes = nodes.nodecodes local glyph_code = nodecodes.glyph local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist -local attributelist_code = nodecodes.attributelist -- temporary local nodepool = nodes.pool @@ -36,17 +35,14 @@ local get_attribute = node.get_attribute local unset_attribute = node.unset_attribute local first_glyph = node.first_glyph or node.first_character local copy_node = node.copy -local copy_node_list = node.copy_list local slide_nodes = node.slide local insert_node_after = node.insert_after local isnode = node.is_node -local current_font = font.current +local current_font = font.current() local texbox = tex.box -local report_error = logs.reporter("node-aux:error") - function nodes.repackhlist(list,...) --~ nodes.showsimplelist(list) local temp, b = hpack_nodes(list,...) @@ -268,7 +264,7 @@ end nodes.tonodes = tonodes -local function link(list,currentfont,currentattr,head,tail) +local function link(head,tail,list,currentfont,currentattr) for i=1,#list do local n = list[i] if n then @@ -276,9 +272,6 @@ local function link(list,currentfont,currentattr,head,tail) if not tn then local tn = type(n) if tn == "number" then - if not currentfont then - currentfont = current_font() - end local h, t = tonodes(tostring(n),currentfont,currentattr) if not h then -- skip @@ -289,10 +282,7 @@ local function link(list,currentfont,currentattr,head,tail) end elseif tn == "string" then if #tn > 0 then - if not currentfont then - currentfont = current_font() - end - local h, t = tonodes(n,currentfont,currentattr) + local h, t = tonodes(n,font.current(),currentattr) if not h then -- skip elseif not head then @@ -303,10 +293,7 @@ local function link(list,currentfont,currentattr,head,tail) end elseif tn == "table" then if #tn > 0 then - if not currentfont then - currentfont = current_font() - end - head, tail = link(n,currentfont,currentattr,head,tail) + head, tail = link(head,tail,n,currentfont,currentattr) end end elseif not head then @@ -316,18 +303,6 @@ local function link(list,currentfont,currentattr,head,tail) else tail = n end - elseif n.id == attributelist_code then - -- weird case - report_error("weird node type in list at index %s:",i) - for i=1,#list do - local l = list[i] - if l.id == attributelist_code then - report_error("%3i: ! %s",i,tostring(l)) - else - report_error("%3i: > %s",i,tostring(l)) - end - end - os.exit() else tail.next = n n.prev = tail @@ -344,7 +319,10 @@ local function link(list,currentfont,currentattr,head,tail) return head, tail end -nodes.link = link +function nodes.link(...) + local currentfont = font.current + return link(nil,nil,{...},currentfont,currentattr) +end local function locate(start,wantedid,wantedsubtype) for n in traverse_nodes(start) do @@ -364,7 +342,7 @@ end nodes.locate = locate -function nodes.concat(list) +function nodes.concat(list) -- no slide ! local head, tail for i=1,#list do local li = list[i] @@ -373,10 +351,10 @@ function nodes.concat(list) elseif head then tail.next = li li.prev = tail - tail = li.next and slide_nodes(li) or li + tail = li else head = li - tail = li.next and slide_nodes(li) or li + tail = li end end return head, tail |