move actualtext to the mc-chunk

This commit is contained in:
Ulrike Fischer 2024-12-11 15:02:56 +01:00
parent c53fb2a956
commit a2fa1d4dcf
2 changed files with 12 additions and 8 deletions

View File

@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
### Changed
- Ulrike Fischer, 2024-11-29
luamml-structelemwriter.lua: moved the actualtext for e.g. stretched braces from the structure element to the mc-chunk.
- Ulrike Fischer, 2024-03-03
luamml.dtx: add plug for mbox socket to correctly annotate them in math.

View File

@ -70,7 +70,7 @@ local function write_elem(tree, stash)
return tex.runtoks(function()
return tex.sprint(struct_use_num, '{', tree[':structnum'], '}')
end)
end
end
if not tree[0] then print('ERR', require'inspect'(tree)) end
local i = 0
for attr, val in next, tree do if type(attr) == 'string' and not string.find(attr, ':') and attr ~= 'xmlns' then
@ -81,7 +81,7 @@ local function write_elem(tree, stash)
table.sort(attrs)
if stash then
tree[':structnum'] = get_ltx().tag.get_struct_num_next()
tree[':structnum'] = get_ltx().tag.get_struct_num_next()
stash = ', stash, '
end
@ -89,18 +89,19 @@ local function write_elem(tree, stash)
tex.sprint(struct_begin, '{tag=' .. tree[0] .. '/mathml')
if stash then tex.sprint(stash) end
if attr_flag then tex.sprint(attr_flag) end
if tree[':actual'] then
tex.sprint(', actualtext = {')
tex.cprint(12, tree[':actual'])
tex.sprint'}'
end
tex.sprint'}'
for j = 1, i do attrs[j] = nil end
if tree[':nodes'] then
local n = tree[':nodes']
tex.runtoks(function()
tex.sprint{mc_begin, string.format('{tag=%s}', tree[0])}
if tree[':actual'] then
tex.sprint(mc_begin,'{tag=Span,actualtext=')
tex.cprint(12,tree[':actual'])
tex.sprint('}')
else
tex.sprint{mc_begin, string.format('{tag=%s}', tree[0])}
end
-- NOTE: This will also flush all previous sprint's... That's often annoying, but in this case actually intentional.
end)
local mct, mcc = tex.attribute[mc_type], tex.attribute[mc_cnt]