From: Thibaut Cuvelier Date: Tue, 25 May 2021 01:51:29 +0000 (+0200) Subject: MathML: use M/ETagInline. X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a68e979350c13d5cd20927c67f22eab84074351f;p=features.git MathML: use 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/InsetMath.cpp b/src/mathed/InsetMath.cpp index 0d21b871d6..e072b487a0 100644 --- a/src/mathed/InsetMath.cpp +++ b/src/mathed/InsetMath.cpp @@ -205,10 +205,10 @@ void InsetMath::mathematica(MathematicaStream & os) const void InsetMath::mathmlize(MathMLStream & ms) const { ms << ""; - ms << MTag("mi"); + ms << MTagInline("mi"); NormalStream ns(ms.os()); normalize(ns); - ms << ETag("mi"); + ms << ETagInline("mi"); } diff --git a/src/mathed/InsetMathBig.cpp b/src/mathed/InsetMathBig.cpp index 091907e517..180af9b8da 100644 --- a/src/mathed/InsetMathBig.cpp +++ b/src/mathed/InsetMathBig.cpp @@ -137,10 +137,9 @@ void InsetMathBig::normalize(NormalStream & os) const void InsetMathBig::mathmlize(MathMLStream & ms) const { - ms << "<" << from_ascii(ms.namespacedTag("mo")) - << " form='prefix' fence='true' stretchy='true' symmetric='true'>" + ms << MTagInline("mo", "fence='true' stretchy='true' symmetric='true'>") << convertDelimToXMLEscape(delim_, ms.xmlMode()) - << ""; + << ETagInline("mo"); } diff --git a/src/mathed/InsetMathBoldSymbol.cpp b/src/mathed/InsetMathBoldSymbol.cpp index ba20aab807..a0651ea52e 100644 --- a/src/mathed/InsetMathBoldSymbol.cpp +++ b/src/mathed/InsetMathBoldSymbol.cpp @@ -109,9 +109,9 @@ void InsetMathBoldSymbol::write(TeXMathStream & os) const void InsetMathBoldSymbol::mathmlize(MathMLStream & ms) const { - ms << "<" << from_ascii(ms.namespacedTag("mstyle")) << " mathvariant='bold'>" + ms << MTagInline("mstyle", "mathvariant='bold'>") << cell(0) - << ""; + << ETagInline("mstyle"); } diff --git a/src/mathed/InsetMathChar.cpp b/src/mathed/InsetMathChar.cpp index febc7c8a31..57bd8162a5 100644 --- a/src/mathed/InsetMathChar.cpp +++ b/src/mathed/InsetMathChar.cpp @@ -252,9 +252,9 @@ void InsetMathChar::mathmlize(MathMLStream & ms) const } if (!entity.empty()) { - ms << "<" << from_ascii(ms.namespacedTag("mo")) << ">" + ms << MTagInline("mo") << from_ascii(entity) - << ""; + << ETagInline("mo"); return; } @@ -263,7 +263,9 @@ void InsetMathChar::mathmlize(MathMLStream & ms) const ? "mi" : "mo"; // we don't use MTag and ETag because we do not want the spacing before the end tag. docstring tag = from_ascii(ms.namespacedTag(type)); - ms << "<" << tag << ">" << char_type(char_) << ""; + ms << MTagInline(type) + << char_type(char_) + << ETagInline(type); } diff --git a/src/mathed/InsetMathDelim.cpp b/src/mathed/InsetMathDelim.cpp index e97e12c04e..e2bd5ac406 100644 --- a/src/mathed/InsetMathDelim.cpp +++ b/src/mathed/InsetMathDelim.cpp @@ -181,17 +181,17 @@ void InsetMathDelim::mathematica(MathematicaStream & os) const void InsetMathDelim::mathmlize(MathMLStream & ms) const { - ms << "<" << from_ascii(ms.namespacedTag("mrow")) << ">" << "\n" - << "<" << from_ascii(ms.namespacedTag("mo")) << " form='prefix' fence='true' stretchy='true' symmetric='true'>" + ms << MTag("mrow") + << MTagInline("mo", "form='prefix' fence='true' stretchy='true' symmetric='true'>") << convertDelimToXMLEscape(left_, ms.xmlMode()) - << "" + << ETagInline("mo") << "\n" << cell(0) << "\n" - << "<" << from_ascii(ms.namespacedTag("mo")) << " form='postfix' fence='true' stretchy='true' symmetric='true'>" + << MTagInline("mo", "form='postfix' fence='true' stretchy='true' symmetric='true'>") << convertDelimToXMLEscape(right_, ms.xmlMode()) - << "" << "\n" - << "" << "\n"; + << ETagInline("mo") + << ETag("mrow"); } diff --git a/src/mathed/InsetMathDots.cpp b/src/mathed/InsetMathDots.cpp index 5c51511701..63c54c950e 100644 --- a/src/mathed/InsetMathDots.cpp +++ b/src/mathed/InsetMathDots.cpp @@ -105,7 +105,7 @@ void InsetMathDots::mathmlize(MathMLStream & ms) const ent = "⋮"; else LASSERT(false, ent = "…"); } - ms << MTag("mi") << from_ascii(ent) << ETag("mi"); + ms << MTagInline("mi") << from_ascii(ent) << ETagInline("mi"); } diff --git a/src/mathed/InsetMathExFunc.cpp b/src/mathed/InsetMathExFunc.cpp index 16eb38515d..c450cceb97 100644 --- a/src/mathed/InsetMathExFunc.cpp +++ b/src/mathed/InsetMathExFunc.cpp @@ -124,12 +124,12 @@ void InsetMathExFunc::mathematica(MathematicaStream & os) const void InsetMathExFunc::mathmlize(MathMLStream & ms) const { - ms << "<" << from_ascii(ms.namespacedTag("mi")) << ">" + ms << MTagInline("mi") << name_ - << "" - << "<" << from_ascii(ms.namespacedTag("mo")) << ">" + << ETagInline("mi") + << MTagInline("mo") << "⁡" - << "" + << ETagInline("mo") << cell(0); } diff --git a/src/mathed/InsetMathNumber.cpp b/src/mathed/InsetMathNumber.cpp index f5702ab71d..2ce14a7875 100644 --- a/src/mathed/InsetMathNumber.cpp +++ b/src/mathed/InsetMathNumber.cpp @@ -70,9 +70,9 @@ void InsetMathNumber::octave(OctaveStream & os) const void InsetMathNumber::mathmlize(MathMLStream & ms) const { - ms << "<" << from_ascii(ms.namespacedTag("mn")) << ">" + ms << MTagInline("mn") << str_ - << ""; + << ETagInline("mn"); } diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp index a473259ba0..5c182c719f 100644 --- a/src/mathed/MathExtern.cpp +++ b/src/mathed/MathExtern.cpp @@ -1591,7 +1591,7 @@ void mathmlize(MathData const & dat, MathMLStream & ms) MathData ar = dat; extractStructure(ar, MATHML); if (ar.empty()) - ms << "<" << from_ascii(ms.namespacedTag("mrow")) << "/>"; + ms << CTag("mrow"); else if (ar.size() == 1) ms << ar.front(); else {