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()
local nest = tex.nest.top
local chars = {}
last_tag = to_text(nest.head)
last_tag = {[0] = 'mtext', to_text(nest.head)}
end
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'
return
end
store_tag({[0] = 'mtd', {[0] = 'mtext', last_tag}})
store_tag({[0] = 'mtd', last_tag})
last_tag = nil
end

View File

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