[LyX/master] DocBook: fix MathML prefix in root tag.

Thibaut Cuvelier tcuvelier at lyx.org
Mon May 24 21:43:38 UTC 2021


commit de7785427548edfc4b0b3ea00b1d266c33e5c010
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon May 24 23:55:11 2021 +0200

    DocBook: fix MathML prefix in root tag.
    
    Patch written by lynx: https://www.lyx.org/trac/ticket/12229
---
 src/Buffer.cpp |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index c3d1276..457aa43 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -2144,12 +2144,23 @@ Buffer::ExportStatus Buffer::writeDocBookSource(odocstream & os,
 		   << "<!-- This DocBook file was created by LyX " << lyx_version
 		   << "\n  See https://www.lyx.org/ for more information -->\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\"";
 


More information about the lyx-cvs mailing list