Unify to_text usage

This commit is contained in:
Marcel Fabian Krüger 2021-05-01 08:00:29 +02:00
parent 81f0b867cd
commit 5f9d522244
2 changed files with 5 additions and 8 deletions

View File

@ -43,7 +43,7 @@ token.set_lua('__luamml_amsmath_save_tag:', funcid, 'protected')
lua.get_functions_table()[funcid] = function() lua.get_functions_table()[funcid] = function()
local nest = tex.nest.top local nest = tex.nest.top
local chars = {} local chars = {}
last_tag = to_text(nest.head) last_tag = {[0] = 'mtext', to_text(nest.head)}
end end
funcid = luatexbase.new_luafunction'__luamml_amsmath_set_tag:' funcid = luatexbase.new_luafunction'__luamml_amsmath_set_tag:'
@ -53,6 +53,6 @@ lua.get_functions_table()[funcid] = function()
texio.write_nl'WARNING: Tag extraction failed' texio.write_nl'WARNING: Tag extraction failed'
return return
end end
store_tag({[0] = 'mtd', {[0] = 'mtext', last_tag}}) store_tag({[0] = 'mtd', last_tag})
last_tag = nil last_tag = nil
end end

View File

@ -1,6 +1,6 @@
local remap_comb = require'luamml-data-combining' local remap_comb = require'luamml-data-combining'
local stretchy = require'luamml-data-stretchy' local stretchy = require'luamml-data-stretchy'
local to_string = require'luamml-lr' local to_text = require'luamml-lr'
local properties = node.get_properties_table() local properties = node.get_properties_table()
@ -89,11 +89,8 @@ local function kernel_to_table(kernel, cur_style)
return result, result return result, result
elseif id == sub_box_t then elseif id == sub_box_t then
if kernel.list.id == hlist_t then -- We directly give up for vlists if kernel.list.id == hlist_t then -- We directly give up for vlists
local str = to_string(kernel.list.head) local result = {[0] = 'mtext', to_text(kernel.list.head)}
if str then
local result = {[0] = 'mtext', str}
return result, result return result, result
end
else else
local result = {[0] = 'mi', {[0] = 'mglyph', ['tex:box'] = kernel.list}} local result = {[0] = 'mi', {[0] = 'mglyph', ['tex:box'] = kernel.list}}
return result, result return result, result