]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathHull.cpp
Assure correct spacing of colored items in mathed
[lyx.git] / src / mathed / InsetMathHull.cpp
index 5731ba9a8a94f2679b7ea56ff5558832c92ee16d..d0e11fe2ab1118b9b4401ac8f1eb91f460c1bce9 100644 (file)
@@ -2406,11 +2406,6 @@ int InsetMathHull::plaintext(odocstringstream & os,
 
 void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) const
 {
-       // With DocBook 5, MathML must be within its own namespace; defined in Buffer.cpp::writeDocBookSource as "m".
-       // Output everything in a separate stream so that this does not interfere with the standard flow of DocBook tags.
-       odocstringstream osmath;
-       MathStream ms(osmath, "m", true);
-
        // Choose the tag around the MathML equation.
        docstring name;
        if (getType() == hullSimple)
@@ -2420,15 +2415,21 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
 
        // DocBook also has <equation>, but it comes with a title.
 
-       docstring bname = name;
+       docstring attr;
        for (row_type i = 0; i < nrows(); ++i) {
                if (!label(i).empty()) {
-                       bname += " xml:id=\"" + xml::cleanID(label(i)) + "\"";
+                       attr = "xml:id=\"" + xml::cleanID(label(i)) + "\"";
                        break;
                }
        }
 
-       ++ms.tab(); ms.cr(); ms.os() << '<' << bname << '>';
+       xs << xml::StartTag(name, attr);
+       xs << xml::CR();
+
+       // With DocBook 5, MathML must be within its own namespace; defined in Buffer.cpp::writeDocBookSource as "m".
+       // Output everything in a separate stream so that this does not interfere with the standard flow of DocBook tags.
+       odocstringstream osmath;
+       MathStream ms(osmath, "m", true);
 
        // Output the MathML subtree.
        odocstringstream ls;
@@ -2463,11 +2464,10 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
                osmath << "MathML export failed. Please report this as a bug.";
        }
 
-       // Close the DocBook tag enclosing the formula.
-       ms.cr(); --ms.tab(); ms.os() << "</" << name << '>';
-
-       // Output the complete tag to the DocBook stream.
+       // Output the complete formula to the DocBook stream.
        xs << XMLStream::ESCAPE_NONE << osmath.str();
+       xs << xml::CR();
+       xs << xml::EndTag(name);
 }