]> git.lyx.org Git - lyx.git/commitdiff
more mathml stuff
authorAndré Pönitz <poenitz@gmx.net>
Wed, 7 Nov 2001 18:15:24 +0000 (18:15 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 7 Nov 2001 18:15:24 +0000 (18:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2979 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/array.C
src/mathed/formula.C
src/mathed/math_deliminset.C
src/mathed/math_deliminset.h
src/mathed/math_gridinset.C
src/mathed/math_gridinset.h
src/mathed/math_matrixinset.C
src/mathed/math_matrixinset.h

index 7a3af6592508b6798d395cafac27d43dc8eba0d7..cc53477b0cfaf760db5218658141872d364acd65 100644 (file)
@@ -276,16 +276,22 @@ void MathArray::maplize(MapleStream & os) const
 void MathArray::mathmlize(MathMLStream & os) const
 {
        MathArray ar = glueChars();
-       os << "<mrow>";
-       for (const_iterator it = ar.begin(); it != ar.end(); ++it) {
-               MathInset const * p = it->nucleus();
-               if (MathScriptInset const * q = ar.asScript(it)) {
-                       q->mathmlize(p, os);
-                       ++it;
-               } else 
-                       p->mathmlize(os);
+       if (ar.size() == 0)
+               os << "<mrow/>";
+       else if (ar.size() == 1)
+               os << ar.begin()->nucleus();
+       else {
+               os << "<mrow>";
+               for (const_iterator it = ar.begin(); it != ar.end(); ++it) {
+                       MathInset const * p = it->nucleus();
+                       if (MathScriptInset const * q = ar.asScript(it)) {
+                               q->mathmlize(p, os);
+                               ++it;
+                       } else 
+                               p->mathmlize(os);
+               }
+               os << "</mrow>";
        }
-       os << "</mrow>";
 }
 
 
index 506928cd7b7694e46b3ca5c6ad4b1c46de3ab731..2de2bfd602827b702de9cefcfa7cf761f29af7df 100644 (file)
@@ -307,7 +307,7 @@ int InsetFormula::docbook(Buffer const * buf, ostream & os) const
        MathMLStream ms(os);
        ms << "<equation><alt>";
        int res = ascii(buf, ms.os_, 0);
-       ms << "</alt>\n<mml>" << par_.nucleus() << "<mml></equation>";
+       ms << "</alt>\n<math>" << par_.nucleus() << "<math></equation>";
        return res + 1;
 }
 
index 50e86abd29af585d8a4b2cf1878bbd94a07ba844..d0191cc87bbcde8e724d42ccfd9f2694ade5933e 100644 (file)
@@ -100,15 +100,6 @@ bool MathDelimInset::isMatrix() const
 }
 
 
-void MathDelimInset::octavize(OctaveStream & os) const
-{
-       if (left_ == "|" && right_ == "|")
-               os << "det(" << cell(0) << ")";
-       else
-               os << left_.c_str() << cell(0) << right_.c_str();
-}
-
-
 void MathDelimInset::maplize(MapleStream & os) const
 {
        if (left_ == "|" && right_ == "|") {
@@ -121,3 +112,18 @@ void MathDelimInset::maplize(MapleStream & os) const
                os << left_.c_str() << cell(0) << right_.c_str();
 }
 
+
+void MathDelimInset::mathmlize(MathMLStream & os) const
+{
+       os << "<fenced open=\"" << left_.c_str() << "\" close=\""
+               << right_.c_str() << "\">" << cell(0) << "</fenced>";
+}
+
+
+void MathDelimInset::octavize(OctaveStream & os) const
+{
+       if (left_ == "|" && right_ == "|")
+               os << "det(" << cell(0) << ")";
+       else
+               os << left_.c_str() << cell(0) << right_.c_str();
+}
index 88f0fcce44fedc5fcbef0b5e2ea50c5d2b3a4f1b..e5d5d4aa609cb75df20b31aa95e9c3629a0d9843 100644 (file)
@@ -30,9 +30,11 @@ public:
        ///
        bool isMatrix() const;
        ///
-       void octavize(OctaveStream &) const;
-       ///
        void maplize(MapleStream &) const;
+       ///
+       void mathmlize(MathMLStream &) const;
+       ///
+       void octavize(OctaveStream &) const;
 private:
        ///
        int dw() const;
index 40cca94d6ff502deafb8e6467a3e2ecf6950105e..75d9e8e200d7893c52eba39206df53d5c29518aa 100644 (file)
@@ -587,21 +587,6 @@ std::vector<MathInset::idx_type>
 }
 
 
-void MathGridInset::octavize(OctaveStream & os) const
-{
-       os << '[';
-       for (row_type row = 0; row < nrows(); ++row) {
-               if (row)
-                       os << ';';
-               os << '[';
-               for (col_type col = 0; col < ncols(); ++col) 
-                       os << cell(index(row, col)) << ' ';
-               os <<']';
-       }
-       os <<']';
-}
-
-
 void MathGridInset::maplize(MapleStream & os) const
 {
        os << "array([";
@@ -619,3 +604,30 @@ void MathGridInset::maplize(MapleStream & os) const
        os << "])";
 }
 
+
+void MathGridInset::mathmlize(MathMLStream & os) const
+{
+       os << "<mtable>";
+       for (row_type row = 0; row < nrows(); ++row) {
+               os << "<mtr>";
+               for (col_type col = 0; col < ncols(); ++col) 
+                       os << cell(index(row, col));
+               os << "</mtr>";
+       }
+       os << "</mtable>";
+}
+
+
+void MathGridInset::octavize(OctaveStream & os) const
+{
+       os << '[';
+       for (row_type row = 0; row < nrows(); ++row) {
+               if (row)
+                       os << ';';
+               os << '[';
+               for (col_type col = 0; col < ncols(); ++col) 
+                       os << cell(index(row, col)) << ' ';
+               os << ']';
+       }
+       os << ']';
+}
index c6de00adcff413fd495709e0b67bdd85b70abf4e..e87a537cf2a18aa33edfd634129ffdd15212d198 100644 (file)
@@ -149,10 +149,12 @@ public:
        ///
        void setDefaults();
 
-       ///
-       void octavize(OctaveStream &) const;
        ///
        void maplize(MapleStream &) const;
+       ///
+       void mathmlize(MathMLStream &) const;
+       ///
+       void octavize(OctaveStream &) const;
 
 protected:
        /// returns proper 'end of line' code for LaTeX
index 4fa1ebd1f10c906d02d9809b933d45848cc59df9..cfdbb1b1bdd0a1c3f64a6cadd6adf3118a2eddf4 100644 (file)
@@ -215,6 +215,11 @@ void MathMatrixInset::writeNormal(std::ostream & os) const
 }
 
 
+void MathMatrixInset::mathmlize(MathMLStream & os) const
+{
+       MathGridInset::mathmlize(os);
+}
+
 
 string MathMatrixInset::label(row_type row) const
 {
index c6cdaab385b02e50692f70bb9e04fd20cf39d3b8..2a06385053247c2a87f62ee15cba92c9854c67d7 100644 (file)
@@ -80,6 +80,8 @@ public:
 
        ///
        MathInsetTypes getType() const;
+       ///
+       void mathmlize(MathMLStream &) const;
 
 private:
        ///