Add \tracingmathml for debugging

This commit is contained in:
Marcel Fabian Krüger 2021-04-27 00:07:17 +02:00
parent 3995c7ae05
commit 040f29aeaa
3 changed files with 8 additions and 0 deletions

View File

@ -40,6 +40,9 @@ local mlist_result
local function save_result(xml, style) local function save_result(xml, style)
mlist_result = write_xml(make_root(xml, style)) mlist_result = write_xml(make_root(xml, style))
if tex.count.tracingmathml > 1 then
texio.write_nl(mlist_result .. '\n')
end
end end
luatexbase.add_to_callback('pre_mlist_to_hlist_filter', function(mlist, style) luatexbase.add_to_callback('pre_mlist_to_hlist_filter', function(mlist, style)
@ -87,6 +90,9 @@ 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
if tex.count.tracingmathml == 1 then
texio.write_nl(mlist_result .. '\n')
end
tex.sprint(-2, tostring(pdf.immediateobj('stream', mlist_result, '/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

View File

@ -2,6 +2,7 @@
{Feel free to add a description here} {Feel free to add a description here}
\int_new:N \l__luamml_flag_int \int_new:N \l__luamml_flag_int
\int_new:N \tracingmathml
\lua_now:n { require'luamml-tex' } \lua_now:n { require'luamml-tex' }
\cs_new:Nn \luamml_flag_save: { \cs_new:Nn \luamml_flag_save: {

View File

@ -6,6 +6,7 @@
\RegisterFamilyMapping\symletters{oml} \RegisterFamilyMapping\symletters{oml}
\RegisterFamilyMapping\symlargesymbols{omx} \RegisterFamilyMapping\symlargesymbols{omx}
\ExplSyntaxOn \ExplSyntaxOn
\tracingmathml2
\pdfvariable compresslevel0 \pdfvariable compresslevel0
\cs_new_protected:Npn \ShowMathMLObj { \cs_new_protected:Npn \ShowMathMLObj {
\message { \luamml_get_last_mathml_stream:e{}~0~R } \message { \luamml_get_last_mathml_stream:e{}~0~R }