From: Thibaut Cuvelier Date: Tue, 25 May 2021 01:34:52 +0000 (+0200) Subject: MathML: add M/ETagInline. X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3ab6633b865912b3b701b6a36a704d454e95696f;hp=a579128c06a27659313987d0d04e92b564fa8896;p=features.git 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 --- diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp index e14e850e18..c42a43e3fa 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() << ""; + return ms; +} + + MathMLStream & operator<<(MathMLStream & ms, CTag const & t) { ms.cr(); diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h index c2dadf243a..e6238db36a 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 &);