From de7785427548edfc4b0b3ea00b1d266c33e5c010 Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Mon, 24 May 2021 23:55:11 +0200 Subject: [PATCH] DocBook: fix MathML prefix in root tag. Patch written by lynx: https://www.lyx.org/trac/ticket/12229 --- src/Buffer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index c3d1276b84..457aa43225 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2144,12 +2144,23 @@ Buffer::ExportStatus Buffer::writeDocBookSource(odocstream & os, << "\n"; + // Prepare the name space declaration for MathML depending on document preferences. + string mathmlNamespace; + if (params().docbook_mathml_prefix != BufferParams::NoPrefix) { + string mathmlPrefix; + if (params().docbook_mathml_prefix == BufferParams::MPrefix) + mathmlPrefix = "m"; + else if (params().docbook_mathml_prefix == BufferParams::MMLPrefix) + mathmlPrefix = "mml"; + mathmlNamespace = + " xmlns:" + mathmlPrefix + "=\"http://www.w3.org/1998/Math/MathML\""; + } + // Directly output the root tag, based on the current type of document. string languageCode = params().language->code(); string params = "xml:lang=\"" + languageCode + '"' + " xmlns=\"http://docbook.org/ns/docbook\"" + " xmlns:xlink=\"http://www.w3.org/1999/xlink\"" - + " xmlns:m=\"http://www.w3.org/1998/Math/MathML\"" + + mathmlNamespace + " xmlns:xi=\"http://www.w3.org/2001/XInclude\"" + " version=\"5.2\"";