[LyX/master] MathML: add a version enum.

Thibaut Cuvelier tcuvelier at lyx.org
Sat Sep 28 14:50:59 UTC 2024


commit cb88a362ea33288449cb237cc130e50e9db2f6d4
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Sep 28 16:39:13 2024 +0200

    MathML: add a version enum.
---
 src/mathed/MathStream.cpp |  4 ++--
 src/mathed/MathStream.h   | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp
index 665b3fcbf4..a9d6e0498e 100644
--- a/src/mathed/MathStream.cpp
+++ b/src/mathed/MathStream.cpp
@@ -288,8 +288,8 @@ TeXMathStream & operator<<(TeXMathStream & ws, unsigned int i)
 //////////////////////////////////////////////////////////////////////
 
 
-MathMLStream::MathMLStream(odocstream & os, std::string const & xmlns)
-	: os_(os), xmlns_(xmlns)
+MathMLStream::MathMLStream(odocstream & os, std::string const & xmlns, MathMLVersion version)
+	: os_(os), xmlns_(xmlns), version_(version)
 {
 	if (inText())
 		font_math_style_ = TEXT_STYLE;
diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h
index 40bb7d3bfb..ccc6f14fff 100644
--- a/src/mathed/MathStream.h
+++ b/src/mathed/MathStream.h
@@ -376,8 +376,15 @@ class MathExportException : public std::exception {};
 
 class MathMLStream {
 public:
-	/// Builds a stream proxy for os; the MathML namespace is given by xmlns (supposed to be already defined elsewhere in the document).
-	explicit MathMLStream(odocstream & os, std::string const & xmlns = "");
+	///
+	enum MathMLVersion {
+		mathml3,
+		mathmlCore
+	};
+
+	/// Builds a stream proxy for os; the MathML namespace is given by xmlns
+	/// (supposed to be already defined elsewhere in the document).
+	explicit MathMLStream(odocstream & os, std::string const & xmlns = "", MathMLVersion version = mathml3);
 	///
 	void cr();
 	/// Indentation when nesting tags
@@ -403,7 +410,7 @@ public:
 private:
 	/// Check whether it makes sense to start a <mtext>
 	void beforeText();
-	///Check whether there is a <mtext> to close here
+	/// Check whether there is a <mtext> to close here
 	void beforeTag();
 	///
 	odocstream & os_;
@@ -420,6 +427,8 @@ private:
 	odocstringstream deferred_;
 	///
 	std::string xmlns_;
+	///
+	MathMLVersion version_;
 	/// The only important part of a FontInfo object.
 	MathStyle font_math_style_;
 	///


More information about the lyx-cvs mailing list