]> git.lyx.org Git - lyx.git/commitdiff
MathML: use M/ETagInline.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Tue, 25 May 2021 01:51:29 +0000 (03:51 +0200)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Tue, 25 May 2021 01:51:29 +0000 (03:51 +0200)
By lynx: https://www.lyx.org/trac/attachment/ticket/12221/0003-tag-insertion-unification-for-bold-char-delim-dots-exfunc-.patch

src/mathed/InsetMath.cpp
src/mathed/InsetMathBig.cpp
src/mathed/InsetMathBoldSymbol.cpp
src/mathed/InsetMathChar.cpp
src/mathed/InsetMathDelim.cpp
src/mathed/InsetMathDots.cpp
src/mathed/InsetMathExFunc.cpp
src/mathed/InsetMathNumber.cpp
src/mathed/MathExtern.cpp

index 0d21b871d689f86f151ad2d744445c92cba3b5f5..e072b487a0ec128ea12520292f7c9673af4fbf75 100644 (file)
@@ -205,10 +205,10 @@ void InsetMath::mathematica(MathematicaStream & os) const
 void InsetMath::mathmlize(MathMLStream & ms) const
 {
        ms << "<!-- " << from_utf8(insetName(lyxCode())) << " -->";
-       ms << MTag("mi");
+       ms << MTagInline("mi");
        NormalStream ns(ms.os());
        normalize(ns);
-       ms << ETag("mi");
+       ms << ETagInline("mi");
 }
 
 
index 091907e5171b8d416d38a724cbbac0158b391352..180af9b8da2116dbe7e4337b80f255585041249f 100644 (file)
@@ -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())
-          << "</" << from_ascii(ms.namespacedTag("mo")) << ">";
+          << ETagInline("mo");
 }
 
 
index ba20aab80789fa0170a270c96b8f2ee0c97012b9..a0651ea52e0908d4e5a7c99ed3fd94337d97ab42 100644 (file)
@@ -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)
-          << "</" << from_ascii(ms.namespacedTag("mstyle")) << ">";
+          << ETagInline("mstyle");
 }
 
 
index febc7c8a31626cfdc7f8c059da8dfb1cfe4c2513..57bd8162a5162f4f7bbf157e24ab887a578ef790 100644 (file)
@@ -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)
-                  << "</" << from_ascii(ms.namespacedTag("mo")) << ">";
+                  << 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_) << "</" << tag << ">";
+       ms << MTagInline(type)
+          << char_type(char_)
+          << ETagInline(type);
 }
 
 
index e97e12c04e217ab935d1b6951c0936d106e9b0a8..e2bd5ac406ffab0125689d1ad0b8768a332fdf3e 100644 (file)
@@ -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())
-          << "</" << from_ascii(ms.namespacedTag("mo")) << ">"
+          << 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())
-          << "</" << from_ascii(ms.namespacedTag("mo")) << ">" << "\n"
-          << "</" << from_ascii(ms.namespacedTag("mrow")) << ">" << "\n";
+          << ETagInline("mo")
+          << ETag("mrow");
 }
 
 
index 5c51511701b687ebda0e6e4caa9cd3a49f4c62cd..63c54c950e03d96603eac45bbe4f8caca1af9b77 100644 (file)
@@ -105,7 +105,7 @@ void InsetMathDots::mathmlize(MathMLStream & ms) const
                        ent = "&vellip;";
                else LASSERT(false, ent = "&hellip;");
        }
-       ms << MTag("mi") << from_ascii(ent) << ETag("mi");
+       ms << MTagInline("mi") << from_ascii(ent) << ETagInline("mi");
 }
 
 
index 16eb38515d40977fdaac0c06cbf258577097c890..c450cceb9718e793251876bea6bbfb61abb0aff4 100644 (file)
@@ -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("mi")) << ">"
-          << "<" << from_ascii(ms.namespacedTag("mo")) << ">"
+       << ETagInline("mi")
+          << MTagInline("mo")
           << "&af;"
-          << "</" << from_ascii(ms.namespacedTag("mo")) << ">"
+          << ETagInline("mo")
           << cell(0);
 }
 
index f5702ab71d8510069e0275fd156047b43872fdee..2ce14a7875b567cd716f9311db7af1b004edd5dc 100644 (file)
@@ -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_
-          << "</" << from_ascii(ms.namespacedTag("mn")) << ">";
+          << ETagInline("mn");
 }
 
 
index a473259ba0b0707fc65f5db8d0f68cdf952011f9..5c182c719fc98be3af8edc13e9d30bcdce45fe4c 100644 (file)
@@ -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 {