Compare commits

..

No commits in common. "246ae13e4e26eb828f9242d42e8a8dc7b6ce8310" and "912173cab11414b65f9c76937ddefb8eb00b02a9" have entirely different histories.

2 changed files with 10 additions and 12 deletions

View File

@ -33,7 +33,7 @@ lua.get_functions_table()[funcid] = function()
spacing[#spacing+1] = n.width == 0 and '0' or '.8em' spacing[#spacing+1] = n.width == 0 and '0' or '.8em'
end end
mml_table.columnspacing = table.concat(spacing, ' ', 2, #spacing-2) mml_table.columnspacing = table.concat(spacing, ' ', 2, #spacing-2)
save_result(mml_table, true) save_result(mml_table, 0)
end end
local last_tag local last_tag

View File

@ -36,13 +36,12 @@ end
-- Bit 2: Integrate with table mechanism -- Bit 2: Integrate with table mechanism
local mlist_buffer local mlist_buffer
local mlist_result, mlist_display local mlist_result
local function save_result(xml, display) local function save_result(xml, style)
mlist_result, mlist_display = xml, display mlist_result = write_xml(make_root(xml, style))
if tex.count.tracingmathml > 1 then if tex.count.tracingmathml > 1 then
-- Here xml gets wrapped in an mrow to avoid modifying it. texio.write_nl(mlist_result .. '\n')
texio.write_nl(write_xml(make_root({[0] = 'mrow', xml}, display and 0 or 2)) .. '\n')
end end
end end
@ -65,9 +64,9 @@ luatexbase.add_to_callback('pre_mlist_to_hlist_filter', function(mlist, style)
end end
local xml = process_mlist(new_mlist, style == 'display' and 0 or 2) local xml = process_mlist(new_mlist, style == 'display' and 0 or 2)
if flag & 2 == 0 then if flag & 2 == 0 then
save_result(xml, style == 'display' or flag & 1 == 1) save_result(xml, (style == 'display' or flag & 1 == 1) and 0 or 2)
end else
if style == 'text' then assert(style == 'text')
local startmath = tex.nest.top.tail local startmath = tex.nest.top.tail
local props = properties[startmath] local props = properties[startmath]
if not props then if not props then
@ -91,11 +90,10 @@ lua.get_functions_table()[funcid] = function()
"I was asked to provide MathML code for the last formula, but there weren't any new formulas since you last asked." "I was asked to provide MathML code for the last formula, but there weren't any new formulas since you last asked."
}) })
end end
local mml = write_xml(make_root(mlist_result, mlist_display and 0 or 2))
if tex.count.tracingmathml == 1 then if tex.count.tracingmathml == 1 then
texio.write_nl(mml .. '\n') texio.write_nl(mlist_result .. '\n')
end end
tex.sprint(-2, tostring(pdf.immediateobj('stream', mml, '/Subtype/application#2Fmathml+xml' .. token.scan_argument(true)))) tex.sprint(-2, tostring(pdf.immediateobj('stream', mlist_result, '/Subtype/application#2Fmathml+xml' .. token.scan_argument(true))))
mlist_result = nil mlist_result = nil
end end