Fix MathML namespace in structure elements and improve error handling

This commit is contained in:
Marcel Fabian Krüger 2024-10-20 12:16:10 +02:00
parent e5d5ac2efe
commit cfb5d03b92

View File

@ -13,9 +13,27 @@ local function escape_string(str)
return str return str
end end
local ltx
local function get_ltx()
if not ltx then
ltx = _ENV.ltx
if not ltx then
tex.error("LaTeX PDF support not loaded", {"Maybe try adding \\DocumentMetadata."})
ltx = {pdf = {object_id = function() return 0 end}}
end
end
return ltx
end
local mathml_ns_obj local mathml_ns_obj
local function get_mathml_ns_obj() local function get_mathml_ns_obj()
mathml_ns_obj = mathml_ns_obj or token.create'c__pdf_backend_object_tag/NS/mathml_int'.index if not mathml_ns_obj then
mathml_ns_obj = get_ltx().pdf.object_id'tag/NS/mathml'
if not mathml_ns_obj then
tex.error("Failed to find MathML namespace", {"The PDF support does not know the mathml namespace"})
mathml_ns_obj = 0
end
end
return mathml_ns_obj return mathml_ns_obj
end end