Initial hbox handling

This commit is contained in:
Marcel Fabian Krüger 2021-05-01 07:57:03 +02:00
parent 623e9dbe4a
commit 81f0b867cd

View File

@ -1,9 +1,10 @@
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 properties = node.get_properties_table() local properties = node.get_properties_table()
local kern_t, glue_t, rule_t = node.id'kern', node.id'glue', node.id'rule' local hlist_t, kern_t, glue_t, rule_t = node.id'hlist', node.id'kern', node.id'glue', node.id'rule'
local noad_t, accent_t, style_t, choice_t = node.id'noad', node.id'accent', node.id'style', node.id'choice' local noad_t, accent_t, style_t, choice_t = node.id'noad', node.id'accent', node.id'style', node.id'choice'
local radical_t, fraction_t, fence_t = node.id'radical', node.id'fraction', node.id'fence' local radical_t, fraction_t, fence_t = node.id'radical', node.id'fraction', node.id'fence'
@ -87,8 +88,16 @@ 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
local str = to_string(kernel.list.head)
if str then
local result = {[0] = 'mtext', str}
return result, result
end
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
end
elseif id == sub_mlist_t then elseif id == sub_mlist_t then
return nodes_to_table(kernel.list, cur_style) return nodes_to_table(kernel.list, cur_style)
else else
@ -182,8 +191,7 @@ local function noad_to_table(noad, sub, cur_style, mn)
nucleus, nucleus,
{[0] = 'mo', '\u{203E}',}, {[0] = 'mo', '\u{203E}',},
}, core }, core
elseif class == 'vcenter' then elseif class == 'vcenter' then -- Ignored. Nucleus will need special handling anyway
nucleus['tex:TODO'] = class
else else
error[[confusion]] error[[confusion]]
end end