From 5f9d5222449c6fd329a914ee07f4b089955da24b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Sat, 1 May 2021 08:00:29 +0200 Subject: [PATCH] Unify to_text usage --- luamml-amsmath.lua | 4 ++-- luamml-convert.lua | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/luamml-amsmath.lua b/luamml-amsmath.lua index b8ac0e3..6ee40e0 100644 --- a/luamml-amsmath.lua +++ b/luamml-amsmath.lua @@ -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 diff --git a/luamml-convert.lua b/luamml-convert.lua index 58fc4f8..164b733 100644 --- a/luamml-convert.lua +++ b/luamml-convert.lua @@ -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