[LyX/master] MathML: add M/ETagInline.

Thibaut Cuvelier tcuvelier at lyx.org
Tue May 25 01:44:58 UTC 2021


commit 3ab6633b865912b3b701b6a36a704d454e95696f
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Tue May 25 03:34:52 2021 +0200

    MathML: add M/ETagInline.
    
    By lynx: https://www.lyx.org/trac/attachment/ticket/12221/0003-tag-insertion-unification-for-bold-char-delim-dots-exfunc-.patch
---
 src/mathed/MathStream.cpp |   18 ++++++++++++++++++
 src/mathed/MathStream.h   |   26 ++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp
index e14e850..c42a43e 100644
--- a/src/mathed/MathStream.cpp
+++ b/src/mathed/MathStream.cpp
@@ -365,6 +365,17 @@ MathMLStream & operator<<(MathMLStream & ms, MTag const & t)
 }
 
 
+MathMLStream & operator<<(MathMLStream & ms, MTagInline const & t)
+{
+	ms.cr();
+	ms.os() << '<' << from_ascii(ms.namespacedTag(t.tag_));
+	if (!t.attr_.empty())
+		ms.os() << " " << from_ascii(t.attr_);
+	ms << ">";
+	return ms;
+}
+
+
 MathMLStream & operator<<(MathMLStream & ms, ETag const & t)
 {
 	ms.cr();
@@ -375,6 +386,13 @@ MathMLStream & operator<<(MathMLStream & ms, ETag const & t)
 }
 
 
+MathMLStream & operator<<(MathMLStream & ms, ETagInline const & t)
+{
+	ms.os() << "</" << from_ascii(ms.namespacedTag(t.tag_)) << ">";
+	return ms;
+}
+
+
 MathMLStream & operator<<(MathMLStream & ms, CTag const & t)
 {
 	ms.cr();
diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h
index c2dadf2..e6238db 100644
--- a/src/mathed/MathStream.h
+++ b/src/mathed/MathStream.h
@@ -319,6 +319,18 @@ public:
 	std::string attr_;
 };
 
+/// Start inline tag.
+class MTagInline {
+public:
+	///
+	MTagInline(char const * const tag, std::string const & attr = std::string())
+	        : tag_(tag), attr_(attr) {}
+	///
+	char const * const tag_;
+	///
+	std::string attr_;
+};
+
 
 /// End tag.
 class ETag {
@@ -330,6 +342,16 @@ public:
 };
 
 
+/// End inlinetag.
+class ETagInline {
+public:
+	///
+	explicit ETagInline(char const * const tag) : tag_(tag) {}
+	///
+	char const * const tag_;
+};
+
+
 /// Compound tag (no content, directly closed).
 class CTag {
 public:
@@ -416,8 +438,12 @@ MathMLStream & operator<<(MathMLStream &, char_type);
 ///
 MathMLStream & operator<<(MathMLStream &, MTag const &);
 ///
+MathMLStream & operator<<(MathMLStream &, MTagInline const &);
+///
 MathMLStream & operator<<(MathMLStream &, ETag const &);
 ///
+MathMLStream & operator<<(MathMLStream &, ETagInline const &);
+///
 MathMLStream & operator<<(MathMLStream &, CTag const &);
 
 


More information about the lyx-cvs mailing list