]> git.lyx.org Git - lyx.git/commitdiff
Introduce a return value for mathmlize(). We will need this to be able
authorRichard Heck <rgheck@comcast.net>
Thu, 31 Dec 2009 03:50:12 +0000 (03:50 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 31 Dec 2009 03:50:12 +0000 (03:50 +0000)
to defer labels.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32684 a592a061-630c-0410-9148-cb99ea01b6c8

59 files changed:
development/HTML/HTML.notes
src/mathed/InsetMath.cpp
src/mathed/InsetMath.h
src/mathed/InsetMathBox.cpp
src/mathed/InsetMathBox.h
src/mathed/InsetMathBrace.cpp
src/mathed/InsetMathBrace.h
src/mathed/InsetMathChar.cpp
src/mathed/InsetMathChar.h
src/mathed/InsetMathComment.cpp
src/mathed/InsetMathComment.h
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathDecoration.h
src/mathed/InsetMathDelim.cpp
src/mathed/InsetMathDelim.h
src/mathed/InsetMathDiff.cpp
src/mathed/InsetMathDiff.h
src/mathed/InsetMathDots.cpp
src/mathed/InsetMathDots.h
src/mathed/InsetMathEnsureMath.cpp
src/mathed/InsetMathEnsureMath.h
src/mathed/InsetMathExFunc.cpp
src/mathed/InsetMathExFunc.h
src/mathed/InsetMathExInt.cpp
src/mathed/InsetMathExInt.h
src/mathed/InsetMathFrac.cpp
src/mathed/InsetMathFrac.h
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathGrid.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h
src/mathed/InsetMathKern.cpp
src/mathed/InsetMathKern.h
src/mathed/InsetMathLim.cpp
src/mathed/InsetMathLim.h
src/mathed/InsetMathMatrix.cpp
src/mathed/InsetMathMatrix.h
src/mathed/InsetMathNumber.cpp
src/mathed/InsetMathNumber.h
src/mathed/InsetMathRoot.cpp
src/mathed/InsetMathRoot.h
src/mathed/InsetMathScript.cpp
src/mathed/InsetMathScript.h
src/mathed/InsetMathSpace.cpp
src/mathed/InsetMathSpace.h
src/mathed/InsetMathSpecialChar.cpp
src/mathed/InsetMathSpecialChar.h
src/mathed/InsetMathSqrt.cpp
src/mathed/InsetMathSqrt.h
src/mathed/InsetMathString.cpp
src/mathed/InsetMathString.h
src/mathed/InsetMathSymbol.cpp
src/mathed/InsetMathSymbol.h
src/mathed/InsetMathUnknown.cpp
src/mathed/InsetMathUnknown.h
src/mathed/MathExtern.cpp
src/mathed/MathExtern.h
src/mathed/MathMacro.cpp
src/mathed/MathMacro.h

index 9c80dbae468907cffe7f5bf47bd7b9049344a09f..b9750e3043f8f9620246863b0551286a2e5d862c 100644 (file)
@@ -52,37 +52,36 @@ These insets work but still need work:
 Math
   We have a fair bit of math now working via MathML output, but there are still some 
   isues, and not all the insets work. Here are the ones I know still need work:
-         - AMSArray
-    - Array
-    - Big: Not sure if we can actually do anything here. Probably they should
-      just be treated as delimiters.
-    - BoldSymbol: Should be easy.
-    - Box
-    - Cases
-    - Diff: Code exists, but I do not know if it is right.
-    - Font
-    - Binom (in Frac): None of these tags exist in MathML 2.0. We'll
-      just output a fraction with delimiters.
-    - Lefteqn
-    - MBox: Use <mtext>.
-    - Overset: Use <mover>.
-    - Par?
-    - Phantom: There is some support for this in MathML....
-    - Ref: Probably needs to be deferred somehow, which is a hassle, because it
-      means the whole MathML output business needs a new argument.
-    - Size: Unclear if we want to do anything here, though we could. See
-      lib/symbols for the commands supported, of course.
-    - Space: Needs checking.
-    - SpecialChar: Needs checking.
-    - Split
-    - Stackrel: Use <mover>, probably.
-    - Substack: This is a stack of however many cells, all in a smaller style.
-      Probably do something with <mover>, again.
-    - Tabular: This is more or less a text-like table in math. Probably output it
-      as a table, but set the font.
-    - Underset: Use <munder>.
-    - XArrow: Contents above and below an arrow. Use...?
-    - XYMatrix: Not sure how this differs from ordinary ones.
+       - AMSArray
+       - Array
+       - Big: Not sure if we can actually do anything here. Probably they should
+               just be treated as delimiters.
+       - BoldSymbol: Should be easy.
+       - Box
+       - Cases
+       - Diff: Code exists, but I do not know if it is right.
+       - Font
+       - Binom (in Frac): None of these tags exist in MathML 2.0. We'll
+               just output a fraction with delimiters.
+       - Lefteqn
+       - MBox: Use <mtext>.
+       - Overset: Use <mover>.
+       - Par?
+       - Phantom: There is some support for this in MathML....
+       - Ref: Needs to be deferred.
+       - Size: Unclear if we want to do anything here, though we could. See
+               lib/symbols for the commands supported, of course.
+       - Space: Needs checking.
+       - SpecialChar: Needs checking.
+       - Split
+       - Stackrel: Use <mover>, probably.
+       - Substack: This is a stack of however many cells, all in a smaller style.
+               Probably do something with <mover>, again.
+       - Tabular: This is more or less a text-like table in math. Probably output it
+               as a table, but set the font.
+       - Underset: Use <munder>.
+       - XArrow: Contents above and below an arrow. Use...?
+       - XYMatrix: Not sure how this differs from ordinary ones.
 
 
 These insets do not work and are not yet scheduled to work:
index 0a9772c6769c3e7c1a243b6170aba64c49a13644..a5cd28a2841f3770143f1dd39db85ac70e9c77c8 100644 (file)
@@ -120,12 +120,13 @@ void InsetMath::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMath::mathmlize(MathStream & os) const
+docstring InsetMath::mathmlize(MathStream & os) const
 {
        os << MTag("mi");
        NormalStream ns(os.os());
        normalize(ns);
        os << ETag("mi");
+       return docstring();
 }
 
 
index 555762c8c7bab3e568b8d9247475e612b1c96ef5..12ea7ab06ce504539e0ed296305b843d6d9117e1 100644 (file)
@@ -187,7 +187,7 @@ public:
        /// write content as something readable by Mathematica
        virtual void mathematica(MathematicaStream &) const;
        /// write content as something resembling MathML
-       virtual void mathmlize(MathStream &) const;
+       virtual docstring mathmlize(MathStream &) const;
        /// write content as something readable by Octave
        virtual void octave(OctaveStream &) const;
 
index d432794fc070980122ec2f7a3436d7a5179b1bf6..701a0bb6344b75725356870b5bf559c8b1fc224d 100644 (file)
@@ -52,7 +52,7 @@ void InsetMathBox::normalize(NormalStream & os) const
 }
 
 
-void InsetMathBox::mathmlize(MathStream & ms) const
+docstring InsetMathBox::mathmlize(MathStream & ms) const
 {      
        // FIXME This doesn't actually work yet. We need to be able to signal 
        // that we are in text mode and then just call ms << cell(0). So we
@@ -60,6 +60,7 @@ void InsetMathBox::mathmlize(MathStream & ms) const
        ms << MTag("mtext");
        ms.os() << cell(0);
        ms << ETag("mtext");
+       return docstring();
 }
 
 
index 4ef299401d9b6df2dd4931e6ab8384b8f0cc71fc..03d2da9f9e78bb61946aa759ace6df875feb11af 100644 (file)
@@ -35,7 +35,7 @@ public:
        ///
        void normalize(NormalStream & ns) const;
        ///
-       void mathmlize(MathStream & ms) const;
+       docstring mathmlize(MathStream & ms) const;
        ///
        void infoize(odocstream & os) const;
        ///
@@ -66,7 +66,7 @@ public:
        /// write normalized content
        void normalize(NormalStream & ns) const;
        ///
-       //void mathmlize(MathStream & ms) const;
+       //docstring mathmlize(MathStream & ms) const;
        ///
        void infoize(odocstream & os) const;
 private:
@@ -89,7 +89,7 @@ public:
        /// write normalized content
        void normalize(NormalStream & ns) const;
        ///
-       //void mathmlize(MathStream & ms) const;
+       //docstring mathmlize(MathStream & ms) const;
        ///
        mode_type currentMode() const { return TEXT_MODE; }
        ///
@@ -116,7 +116,7 @@ public:
        ///
        void write(WriteStream & os) const;
        ///
-       //void mathmlize(MathStream & ms) const;
+       //docstring mathmlize(MathStream & ms) const;
        /// write normalized content
        void normalize(NormalStream & ns) const;
        ///
index c1034c9aeeb1f662e48478c7b8fb7e25493b6d2e..4bf24dfb81e7ad3566e25f339f55da3a57eb2e3a 100644 (file)
@@ -13,6 +13,7 @@
 #include "InsetMathBrace.h"
 
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "MetricsInfo.h"
@@ -94,9 +95,12 @@ void InsetMathBrace::octave(OctaveStream & os) const
 }
 
 
-void InsetMathBrace::mathmlize(MathStream & os) const
+docstring InsetMathBrace::mathmlize(MathStream & os) const
 {
-       os << MTag("mrow") << cell(0) << ETag("mrow");
+       os << MTag("mrow");
+       docstring const rv = lyx::mathmlize(cell(0), os);
+       os << ETag("mrow");
+       return rv;
 }
 
 
index e8e3ea955766283a5019ef0e2e5dec1e9c36fefd..6af0ca32b02d3a7b4210018c9932203ee6f2ebe0 100644 (file)
@@ -46,7 +46,7 @@ public:
        ///
        void octave(OctaveStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void infoize(odocstream & os) const;
        ///
index 8e02c6a92cb5e9ab31d46e1cbbf9e0f778e4fe00..27093e8504ca1ed241d1602f1f5f5c32ecb94ac9 100644 (file)
@@ -165,12 +165,12 @@ void InsetMathChar::octave(OctaveStream & os) const
 // mathalpha, then we'll treat it as an identifier, otherwise as an 
 // operator.
 // Worst case: We get bad spacing, or bad italics.
-void InsetMathChar::mathmlize(MathStream & ms) const
+docstring InsetMathChar::mathmlize(MathStream & ms) const
 {
        switch (char_) {
-               case '<': ms << "<mo>&lt;</mo>"; return;
-               case '>': ms << "<mo>&gt;</mo>"; return;
-               case '&': ms << "<mo>&amp;</mo>"; return;
+               case '<': ms << "<mo>&lt;</mo>"; return docstring();
+               case '>': ms << "<mo>&gt;</mo>"; return docstring();
+               case '&': ms << "<mo>&amp;</mo>"; return docstring();
                default: break;
        }
        
@@ -179,6 +179,7 @@ void InsetMathChar::mathmlize(MathStream & ms) const
                        ? "mi" : "mo";
        // we don't use MTag and ETag because we do not want the spacing
        ms << "<" << type << ">" << char(char_) << "</" << type << ">"; 
+       return docstring();
 }
 
 
index 6dba328c4e3deac9c4aec64a589ad29c72840447..d1a865fc15a564a91abfe42f8ede980dedd3b89f 100644 (file)
@@ -41,7 +41,7 @@ public:
        ///
        void octave(OctaveStream & os) const;
        ///
-       void mathmlize(MathStream & ms) const;
+       docstring mathmlize(MathStream & ms) const;
        /// identifies Charinsets
        InsetMathChar const * asCharInset() const { return this; }
        ///
index ebfba7a859918e35fc00b064334ebcd47c80a6ac..92693a2c7e12e4288c01d226f70d4c657d6abaef 100644 (file)
@@ -86,9 +86,10 @@ void InsetMathComment::octave(OctaveStream &) const
 {}
 
 
-void InsetMathComment::mathmlize(MathStream & os) const
+docstring InsetMathComment::mathmlize(MathStream & os) const
 {
        os << MTag("comment") << cell(0) << cell(1) << ETag("comment");
+       return docstring();
 }
 
 
index bb775a74cb13e82fa94455faf68b5e9cc61258aa..2ab35c2805b6a4273b093d4cfa01e122e8ac2f96 100644 (file)
@@ -44,7 +44,7 @@ public:
        ///
        void octave(OctaveStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void infoize(odocstream & os) const;
        ///
index 629a440abf32cafbab88c5fb5bc9d8b4aa74d4f3..825b212c9de8970c59640982ade338e02b241a50 100644 (file)
@@ -14,6 +14,7 @@
 #include "InsetMathDecoration.h"
 
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathParser.h"
 #include "MathSupport.h"
 #include "MathStream.h"
@@ -205,16 +206,18 @@ namespace {
        }
 }
 
-void InsetMathDecoration::mathmlize(MathStream & os) const
+docstring InsetMathDecoration::mathmlize(MathStream & os) const
 {
        Translator const & t = translator();
        Translator::const_iterator cur = t.find(to_utf8(key_->name));
-       LASSERT(cur != t.end(), return);
+       LASSERT(cur != t.end(), return docstring());
        char const * const outag = cur->second.over ? "mover" : "munder";
-       os << MTag(outag)
-                << MTag("mrow") << cell(0) << ETag("mrow")
+       os << MTag(outag) << MTag("mrow");
+       docstring const rv = lyx::mathmlize(cell(0), os);
+       os << ETag("mrow")
                 << from_ascii("<mo stretchy=\"true\">" + cur->second.tag + "</mo>")
                 << ETag(outag);
+       return rv;
 }
 
 
index 22c9f9bed35379aa4671860ae7cc195e90fe8cfe..7d77b49ae30252e1574d8ae1e7db94f93fd47759 100644 (file)
@@ -42,7 +42,7 @@ public:
        ///
        InsetCode lyxCode() const { return MATH_DECORATION_CODE; }
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
 
 private:
        virtual Inset * clone() const;
index 459866c924ed17fbcd5d66acfc0cca9014a9c866..6da49562eb6347e47cc5a88849bd3ffc273f06c5 100644 (file)
@@ -14,6 +14,7 @@
 #include "InsetMathDelim.h"
 
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "MetricsInfo.h"
@@ -161,10 +162,12 @@ void InsetMathDelim::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMathDelim::mathmlize(MathStream & os) const
+docstring InsetMathDelim::mathmlize(MathStream & os) const
 {
-       os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true'>" << left_ << "</mo>"
-               << cell(0) << "<mo form='postfix' fence='true' stretchy='true' symmetric='true'>" << right_ << "</mo>";
+       os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true'>" << left_ << "</mo>";
+       docstring const rv = lyx::mathmlize(cell(0),os);
+       os << "<mo form='postfix' fence='true' stretchy='true' symmetric='true'>" << right_ << "</mo>";
+       return rv;
 }
 
 
index 67e1db09063db2ea4494fbbd354d710ab9761732..fb70f249270ead6c51127db35fef2fd8b20206df 100644 (file)
@@ -56,7 +56,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void octave(OctaveStream &) const;
        ///
index 1e990d7ffb15a4a05a83054335ddcb79bed97304..f044ab8f15db1f826f5e660e7f56d5a7230739bc 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "InsetMathDiff.h"
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 
 #include "support/debug.h"
@@ -95,15 +96,17 @@ void InsetMathDiff::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMathDiff::mathmlize(MathStream & os) const
+docstring InsetMathDiff::mathmlize(MathStream & os) const
 {
        os << "diff(";
+       docstring rv;
        for (idx_type idx = 0; idx < nargs(); ++idx) {
                if (idx != 0)
                        os << ',';
-               os << cell(idx);
+               rv += lyx::mathmlize(cell(idx), os);
        }
        os << ')';
+       return rv;
 }
 
 
index 6253168397abb059845f58e296fdbaf5e7a1096f..f9f1aba0881d84a7ffef76b63086f0722411dd91 100644 (file)
@@ -39,7 +39,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void maxima(MaximaStream &) const;
        ///
index 8ca2a1e46981c9ed5f4a40f95803b143434360ca..d1b18fa9b4e929759e3daaccd0a71eaa57e33af6 100644 (file)
@@ -85,7 +85,7 @@ void InsetMathDots::validate(LaTeXFeatures & features) const
 }
 
 
-void InsetMathDots::mathmlize(MathStream & os) const
+docstring InsetMathDots::mathmlize(MathStream & os) const
 {
        // which symbols we support is decided by what is listed in
        // lib/symbols as generating a dots inset
@@ -106,6 +106,7 @@ void InsetMathDots::mathmlize(MathStream & os) const
        else
                LASSERT(false, ent = "&hellip;");
        os << MTag("mi") << from_ascii(ent) << ETag("mi");
+       return docstring();
 }
 
 } // namespace lyx
index 4f2428712cfc2ae60838d14fa1eb68f288be2d81..4ba13351e907eff8b31f7a1418e3f83204e9efd7 100644 (file)
@@ -35,7 +35,7 @@ public:
        ///
        InsetCode lyxCode() const { return MATH_DOTS_CODE; }
        ///
-       void mathmlize(MathStream & os) const;
+       docstring mathmlize(MathStream & os) const;
 protected:
        /// cache for the thing's height
        mutable int dh_;
index 8f738a8dae7b6e00c112c2436c63ec456312da81..149bae7d2cb247fbc5fd8871066f3df866d13d11 100644 (file)
@@ -13,8 +13,9 @@
 
 #include "InsetMathEnsureMath.h"
 
-#include "MathStream.h"
+#include "MathExtern.h"
 #include "MathData.h"
+#include "MathStream.h"
 
 #include <ostream>
 
@@ -67,9 +68,9 @@ void InsetMathEnsureMath::write(WriteStream & os) const
 }
 
 
-void InsetMathEnsureMath::mathmlize(MathStream & os) const
+docstring InsetMathEnsureMath::mathmlize(MathStream & os) const
 {
-       os << cell(0);
+       return lyx::mathmlize(cell(0), os);
 }
 
 
index ccc136a157c93cea04c95c232ecb9fa988b5be5c..c8e58bbe97d16297ef17e8c0e47e69f2e80a4b74 100644 (file)
@@ -36,7 +36,7 @@ public:
        ///
        void write(WriteStream & os) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void infoize(odocstream & os) const;
        ///
index 25c8dcbaf9b964300c2844f5243699806f9e1aac..173436eb612a7b031f1b2f862cab3cac734d297f 100644 (file)
@@ -13,6 +13,7 @@
 #include "InsetMathExFunc.h"
 
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "MetricsInfo.h"
@@ -122,10 +123,10 @@ void InsetMathExFunc::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMathExFunc::mathmlize(MathStream & os) const
+docstring InsetMathExFunc::mathmlize(MathStream & os) const
 {
        os << "<mi>" << name_ << "</mi><mo>&af;</mo>";
-       os << cell(0);
+       return lyx::mathmlize(cell(0), os);
 }
 
 
index fb6dda8b360e2e84f7b68cab4bebcc1d98ee47fc..0517484f388721dcd0136598593a4341b12a8bd8 100644 (file)
@@ -43,7 +43,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void octave(OctaveStream &) const;
        ///
index 88970e0e9634dbf54783b7d9f9fb0f8b2a0c2f64..5277b6cde818253302213b17e17a1fc9f9e3d95f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "InsetMathExInt.h"
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 #include "MathStream.h"
 #include "InsetMathSymbol.h"
@@ -122,7 +123,7 @@ void InsetMathExInt::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMathExInt::mathmlize(MathStream & os) const
+docstring InsetMathExInt::mathmlize(MathStream & os) const
 {
        // At the moment, we are not extracting sums and the like for MathML.
        // If we should decide to do so later, then we'll need to re-merge
@@ -150,9 +151,11 @@ void InsetMathExInt::mathmlize(MathStream & os) const
                os << ETag("msub");
        else if (upper)
                os << ETag("msup");
-       os << cell(0) << "<mo> &InvisibleTimes; </mo>"
+       docstring rv = lyx::mathmlize(cell(0), os);
+       os << "<mo> &InvisibleTimes; </mo>"
           << MTag("mrow") << "<mo> &DifferentialD; </mo>"
           << cell(1) << ETag("mrow");
+       return rv;
 }
 
 
index ced825b89074d668e31e1015a2f7baa49f140140..55aa1f78f240cb6d0354dd0931ef65ff3450a411 100644 (file)
@@ -52,7 +52,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void write(WriteStream & os) const;
        ///
index 11d24469db1c09b752105035e8a1951186a2fcbb..3fbd56d8fdfc1bf552538258d4a4455d2a4af2be 100644 (file)
@@ -17,6 +17,7 @@
 #include "Cursor.h"
 #include "LaTeXFeatures.h"
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "MetricsInfo.h"
@@ -384,12 +385,14 @@ void InsetMathFrac::octave(OctaveStream & os) const
 }
 
 
-void InsetMathFrac::mathmlize(MathStream & os) const
+docstring InsetMathFrac::mathmlize(MathStream & os) const
 {
-       os << MTag("mfrac")
-          << MTag("mrow") << cell(0) << ETag("mrow")
-                << MTag("mrow") << cell(1) << ETag("mrow")
-                << ETag("mfrac");
+       os << MTag("mfrac") << MTag("mrow");
+       docstring rv = lyx::mathmlize(cell(0), os);
+       os << ETag("mrow") << MTag("mrow");
+       rv += lyx::mathmlize(cell(1), os);
+       os << ETag("mrow") << ETag("mfrac");
+       return rv;
 }
 
 
@@ -533,8 +536,9 @@ void InsetMathBinom::normalize(NormalStream & os) const
 }
 
 
-void InsetMathBinom::mathmlize(MathStream & os) const
+docstring InsetMathBinom::mathmlize(MathStream & os) const
 {
+       // FIXME This all needs fixing
        switch (kind_) {
        case BINOM:
                os << MTag("mbinom") << cell(0) << cell(1) << ETag("mbinom");
@@ -547,6 +551,7 @@ void InsetMathBinom::mathmlize(MathStream & os) const
                os << MTag("mdbinom") << cell(0) << cell(1) << ETag("mdbinom");
                break;
        }
+       return docstring();
 }
 
 
index 36e7ba363b808cb07320a83195f90bba360c1f1d..14af2f8be31cf6973e693903b11e31a1889fd79f 100644 (file)
@@ -82,7 +82,7 @@ public:
        ///
        void octave(OctaveStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void validate(LaTeXFeatures & features) const;
 public:
@@ -121,7 +121,7 @@ public:
        ///
        bool extraBraces() const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void validate(LaTeXFeatures & features) const;
        ///
index 432a39a2f26b0be7d58f1a5805d2cea7864c291e..c4fa2418579ee12da6485ffd30f3f0f93c958c31 100644 (file)
@@ -14,6 +14,7 @@
 #include "InsetMathGrid.h"
 
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathParser.h"
 #include "MathStream.h"
 #include "MetricsInfo.h"
@@ -967,19 +968,21 @@ void InsetMathGrid::normalize(NormalStream & os) const
 }
 
 
-void InsetMathGrid::mathmlize(MathStream & os) const
+docstring InsetMathGrid::mathmlize(MathStream & os) const
 {
        bool const havetable = nrows() > 1;
        if (havetable)
                os << MTag("mtable");
+       docstring rv;
        for (row_type row = 0; row < nrows(); ++row) {
                os << MTag("mrow");
                for (col_type col = 0; col < ncols(); ++col)
-                       os << cell(index(row, col));
+                       rv += lyx::mathmlize(cell(index(row, col)), os);
                os << ETag("mrow");
        }
        if (havetable)
                os << ETag("mtable");
+       return rv;
 }
 
 
index 926216ea1cdca3967a63b2c301c7b0172bf97434..aaef2aaa21c844a42da4e456d6b667e00a491490 100644 (file)
@@ -219,7 +219,7 @@ public:
        ///
        //void maple(MapleStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        //void octave(OctaveStream &) const;
 
index 57137db2f2d1ea286e6cc2cbd5a498640e36b906..492e748d7989c7f90e9561b8c7a1e88e964d36cd 100644 (file)
@@ -1092,9 +1092,9 @@ void InsetMathHull::normalize(NormalStream & os) const
 }
 
 
-void InsetMathHull::mathmlize(MathStream & os) const
+docstring InsetMathHull::mathmlize(MathStream & os) const
 {
-       InsetMathGrid::mathmlize(os);
+       return InsetMathGrid::mathmlize(os);
 }
 
 
@@ -1782,9 +1782,9 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const &) const
                xs << StartTag("math", 
                        "display=\"block\" xmlns=\"http://www.w3.org/1998/Math/MathML\"", true);
        MathStream ms(xs.os());
-       InsetMathGrid::mathmlize(ms);
+       docstring const rv = InsetMathGrid::mathmlize(ms);
        xs << EndTag("math");
-       return docstring();
+       return rv;
 }
 
 
index db4d2ff89cca83f0e7cd911559c139b0ff06ad80..a48edd1da5e71ae7298394be09d4388fb42c64e0 100644 (file)
@@ -102,7 +102,7 @@ public:
        ///
        void write(WriteStream & os) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void normalize(NormalStream &) const;
        ///
index 7f990f996842ff99068b19794feb5d72186a6695..fddecfe58e27c7cc19b905b8b1c8d674e74149df 100644 (file)
@@ -73,4 +73,10 @@ void InsetMathKern::normalize(NormalStream & os) const
 }
 
 
+docstring InsetMathKern::mathmlize(MathStream &) const
+{
+       return docstring();
+}
+
+
 } // namespace lyx
index bd26e4e02118f177e65a8c347738648b7984d2c4..db701cf158160121a282222da1ef1f112056378b 100644 (file)
@@ -39,7 +39,7 @@ public:
        ///
        void normalize(NormalStream & ns) const;
        ///
-       void mathmlize(MathStream &) const { }
+       docstring mathmlize(MathStream &) const;
        ///
        InsetCode lyxCode() const { return MATH_KERN_CODE; }
 
index a5eae28bb71f4eae1e909c3c7fecd2c452624b46..91335f3c3bd329fb101cccb085720e71f443b1c2 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "InsetMathLim.h"
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 
 #include "support/debug.h"
@@ -71,13 +72,16 @@ void InsetMathLim::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMathLim::mathmlize(MathStream & os) const
+docstring      InsetMathLim::mathmlize(MathStream & os) const
 {
        // FIXME XHTML We need a form of MTag that takes attributes.
        os << "<munder>"
           << "<mo form='prefix'>" << "lim" << "</mo>"
-          << "<mrow>" << cell(1) << "<mo>&rarr;</mo>" << cell(2) << "</mrow></munder>"
-          << "<mo>(</mo>" << cell(0) << "<mo>)</mo>" ; 
+                << "<mrow>" << cell(1) << "<mo>&rarr;</mo>" << cell(2)
+                << "</mrow></munder>" << "<mo>(</mo>";
+       docstring const rv = lyx::mathmlize(cell(0), os);
+       os << "<mo>)</mo>";
+       return rv;
 }
 
 
index 11d18dc06e2765e596535e28d718176b3e4c69e3..5d1f1a4c6ab63b02e9e091e71b03d2b61501547a 100644 (file)
@@ -40,7 +40,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void write(WriteStream & os) const;
        ///
index d368f217b7b1493485c0ebbc652f5bd487824ae4..7b73d3803e43b4e5dd714f43b59dd239b3c7b1b5 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "InsetMathMatrix.h"
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 
 
@@ -89,20 +90,25 @@ void InsetMathMatrix::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMathMatrix::mathmlize(MathStream & os) const
+docstring InsetMathMatrix::mathmlize(MathStream & os) const
 {
        os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>"
           << left_ << "</mo>";
        os << MTag("mtable");
+       docstring rv;
        for (row_type row = 0; row < nrows(); ++row) {
                os << MTag("mtr");
-               for (col_type col = 0; col < ncols(); ++col)
-                       os << MTag("mtd") << cell(index(row, col)) << ETag("mtd");
+               for (col_type col = 0; col < ncols(); ++col) {
+                       os << MTag("mtd");
+                       rv += lyx::mathmlize(cell(index(row, col)), os);
+                       os << ETag("mtd");
+               }
                os << ETag("mtr");
        }
        os << ETag("mtable");
        os << "<mo form='postfix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>"
           << right_ << "</mo>";
+       return rv;
 }
 
 
index a62c8ea44b7bfb5a020e962b9810758b20099950..e9639811c8dabfd246c7fbd497613874b7340180 100644 (file)
@@ -40,7 +40,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void octave(OctaveStream &) const;
        ///
index fdacf0c7bccda1df8d70a4d2e1051f6e2b260cd2..eb2e85bdc73de6618f4c1915b0b0a7257aefef52 100644 (file)
@@ -67,9 +67,10 @@ void InsetMathNumber::octave(OctaveStream & os) const
 }
 
 
-void InsetMathNumber::mathmlize(MathStream & os) const
+docstring InsetMathNumber::mathmlize(MathStream & os) const
 {
        os << "<mn> " << str_ << " </mn>";
+       return docstring();
 }
 
 
index a6ca9dae297f60c19edbd0d21698811da34cdcf9..ed9e95ffcb0b25209bf8b04604870bd59a4ef48a 100644 (file)
@@ -43,7 +43,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void write(WriteStream & os) const;
        ///
index 38c09469c90473840745c441e2b1fe307c47ce6c..7ca7706ba0dfbadda57adea73824bd909404e2f4 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "InsetMathRoot.h"
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 #include "Cursor.h"
 
@@ -112,9 +113,13 @@ void InsetMathRoot::octave(OctaveStream & os) const
 }
 
 
-void InsetMathRoot::mathmlize(MathStream & os) const
+docstring InsetMathRoot::mathmlize(MathStream & os) const
 {
-       os << MTag("mroot") << cell(1) << cell(0) << ETag("mroot");
+       os << MTag("mroot");
+       docstring rv = lyx::mathmlize(cell(1), os);
+       rv += lyx::mathmlize(cell(0), os);
+       os << ETag("mroot");
+       return rv;
 }
 
 
index cfcac0a7f3189b68bf368cbd8fd6093e3009c7ae..e05cc807a303f8d85cc37fd3e6acd1d30cdf09fa 100644 (file)
@@ -36,7 +36,7 @@ public:
        ///
        void normalize(NormalStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void maple(MapleStream &) const;
        ///
index 1af0e573459938104334cf93fa251f7cf501e6f3..74420279cb8d5ee23abe7fe3b55ad29129e7f12b 100644 (file)
@@ -18,6 +18,7 @@
 #include "InsetMathScript.h"
 #include "InsetMathSymbol.h"
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 
@@ -616,7 +617,7 @@ void InsetMathScript::mathematica(MathematicaStream & os) const
 // It may be worth trying to output munder, mover, and munderover
 // in certain cases, e.g., for display formulas. But then we would
 // need to know if we're in a display formula.
-void InsetMathScript::mathmlize(MathStream & os) const
+docstring InsetMathScript::mathmlize(MathStream & os) const
 {
        bool d = hasDown() && down().size();
        bool u = hasUp() && up().size();
@@ -628,9 +629,12 @@ void InsetMathScript::mathmlize(MathStream & os) const
        else if (d)
                os << MTag("msub");
 
-       if (nuc().size())
-               os << MTag("mrow") << nuc() << ETag("mrow");
-       else
+       docstring rv;
+       if (nuc().size()) {
+               os << MTag("mrow");
+               rv = lyx::mathmlize(nuc(), os);
+               os << ETag("mrow");
+       } else
                os << "<mrow />";
 
        if (u && d)
@@ -641,6 +645,7 @@ void InsetMathScript::mathmlize(MathStream & os) const
                os << MTag("mrow") << up() << ETag("mrow") << ETag("msup");
        else if (d)
                os << MTag("mrow") << down() << ETag("mrow") << ETag("msub");
+       return rv;
 }
 
 
index 569bc79f3531da354073db0b74a23391ec16fe86..8d704dca9f912b338514699d90927b3469554bdb 100644 (file)
@@ -61,7 +61,7 @@ public:
        /// write content as something readable by Mathematica
        void mathematica(MathematicaStream &) const;
        /// write content as something resembling MathML
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        /// write content as something readable by Octave
        void octave(OctaveStream &) const;
 
index c771d2595bcd402c2d7521354353bde781cf1943..b2a321234df7366418156ade3ebf5af2004b3f90 100644 (file)
@@ -192,11 +192,11 @@ void InsetMathSpace::octave(OctaveStream & os) const
 }
 
 
-void InsetMathSpace::mathmlize(MathStream & ms) const
+docstring InsetMathSpace::mathmlize(MathStream & ms) const
 {
        SpaceInfo const & si = space_info[space_];
        if (si.negative || !si.visible)
-               return;
+               return docstring();
        string l;
        if (si.custom)
                l = length_.asHTMLString();
@@ -210,6 +210,7 @@ void InsetMathSpace::mathmlize(MathStream & ms) const
        if (!l.empty())
                ms << " width=\"" << from_ascii(l) << "\"";
        ms << " />";
+       return docstring();
 }
 
        
index 3e60b41c12e8409a043b279f50ed75f606afd1f0..442fe2e799c2f15ea239fd24b68b6e165dbeb616 100644 (file)
@@ -52,7 +52,7 @@ public:
        ///
        void octave(OctaveStream &) const;
        ///
-       void mathmlize(MathStream & ms) const;
+       docstring mathmlize(MathStream & ms) const;
        ///
        void write(WriteStream & os) const;
        /// generate something that will be understood by the Dialogs.
index 2c600d0c2b38791bf7c0852c368fb06630a5a38a..b32c2e2302785ef4933ea05869292970d8e1e3bc 100644 (file)
@@ -147,7 +147,7 @@ void InsetMathSpecialChar::octave(OctaveStream & os) const
 }
 
 
-void InsetMathSpecialChar::mathmlize(MathStream & ms) const
+docstring InsetMathSpecialChar::mathmlize(MathStream & ms) const
 {
        switch (char_) {
        case '&':
@@ -157,6 +157,7 @@ void InsetMathSpecialChar::mathmlize(MathStream & ms) const
                ms.os().put(char_);
                break;
        }
+       return docstring();
 }
 
 
index c672b504f688045bce4ba1acabf181f25f7ad756..5dcc0128010071a64563718055faa1d4507863e8 100644 (file)
@@ -45,7 +45,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream & ms) const;
+       docstring mathmlize(MathStream & ms) const;
        /// identifies SpecialChar insets
        InsetMathSpecialChar const * asSpecialCharInset() const { return this; }
        ///
index f738e2c17bc516db242b681850146839f7050244..dc154f8f6b6573dde96f5477372c267a349da9b7 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "InsetMathSqrt.h"
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 #include "TextPainter.h"
 #include "frontends/Painter.h"
@@ -107,9 +108,12 @@ void InsetMathSqrt::octave(OctaveStream & os) const
 }
 
 
-void InsetMathSqrt::mathmlize(MathStream & os) const
+docstring InsetMathSqrt::mathmlize(MathStream & os) const
 {
-       os << MTag("msqrt") << cell(0) << ETag("msqrt");
+       os << MTag("msqrt");
+       docstring const rv = lyx::mathmlize(cell(0), os);
+       os << ETag("msqrt");
+       return rv;
 }
 
 
index 485f66a574d856016365d63128e1b2dbf3747839..2cdc0e5a37caad46d9a260b03a0c2cff2dd1e7b2 100644 (file)
@@ -44,7 +44,7 @@ public:
        ///
        void octave(OctaveStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        InsetCode lyxCode() const { return MATH_SQRT_CODE; }
 
index ac951a1838203e0137a2cdc32c4ea3a37bda24b0..28069ca6adbd17ddb92f7f503bd0429c2a096811 100644 (file)
@@ -89,13 +89,6 @@ void InsetMathString::octave(OctaveStream & os) const
 }
 
 
-void InsetMathString::mathmlize(MathStream & /*os*/) const
-{
-       // useless, no doubt, but we should not be here
-       LASSERT(false, /* */);
-}
-
-
 void InsetMathString::write(WriteStream & os) const
 {
        if (!os.latex() || os.lockedMode()) {
index 9f94a7457fe986f056a7054fe1f159e5ceded9c4..95b2937c1ca34892dc377bd38777f16713692e4b 100644 (file)
@@ -47,8 +47,6 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
-       ///
        void write(WriteStream & os) const;
        ///
        InsetCode lyxCode() const { return MATH_STRING_CODE; }
index a4a761171fbfd88239be554bbee952041a09f8a6..d09d40b02c901a21c92adf58ea48b5c1cfc4b947 100644 (file)
@@ -184,7 +184,7 @@ char const * MathMLtype(docstring const & s)
 }
 
 
-void InsetMathSymbol::mathmlize(MathStream & os) const
+docstring InsetMathSymbol::mathmlize(MathStream & os) const
 {
        // FIXME To get this working properly, we need to do add the 
        // XML entity definitions to lib/symbols. And probably do more
@@ -197,6 +197,7 @@ void InsetMathSymbol::mathmlize(MathStream & os) const
        else
                os << sym_->xmlname;
        os << " </" << type << '>';
+       return docstring();
 }
 
 
index 5382f72e85712f3fe7ed510465eefdd683070165..a9b96fc4b55490ab59e987f47c87f1455d5174fb 100644 (file)
@@ -61,7 +61,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void octave(OctaveStream &) const;
        ///
index 2cd11c2a8666ed1f537ab58ac6e026fcbe3b6552..ae6f8ce005eaed85851bfcb2477defbf5b0beefd 100644 (file)
@@ -86,9 +86,10 @@ void InsetMathUnknown::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMathUnknown::mathmlize(MathStream & os) const
+docstring InsetMathUnknown::mathmlize(MathStream & os) const
 {
        os << MTag("mi") << name_ << ETag("mi");
+       return docstring();
 }
 
 
index b43bcfd6721a010e594b4dfba2d3ee8645f8495d..9493ecfc2827e1b5a0c826b3742a1d4e6caa3980 100644 (file)
@@ -50,7 +50,7 @@ public:
        ///
        void mathematica(MathematicaStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void octave(OctaveStream &) const;
        ///
index f9b9f42af2d9a1af304fc4c0e07fbef13adf3903..ee7ceebe4f29ffd40bb2bf3a92dc54131d03405f 100644 (file)
@@ -1413,20 +1413,22 @@ void mathematica(MathData const & dat, MathematicaStream & os)
 }
 
 
-void mathmlize(MathData const & dat, MathStream & os)
+docstring mathmlize(MathData const & dat, MathStream & os)
 {
        MathData ar = dat;
        extractStructure(ar, MATHML);
+       docstring retval;
        if (ar.size() == 0)
                os << "<mrow/>";
        else if (ar.size() == 1)
-               os << ar.front();
+               retval = ar.front()->mathmlize(os);
        else {
                os << MTag("mrow");
                for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
-                       (*it)->mathmlize(os);
+                       retval += (*it)->mathmlize(os);
                os << ETag("mrow");
        }
+       return retval;
 }
 
 // convert this inset somehow to a number
index 199295ae960511a633e0e2440feae16922b55609..d367b1e901e33ba2331dcd27a2f60b6a94191708 100644 (file)
@@ -30,7 +30,7 @@ void normalize(MathData const &, NormalStream &);
 void maple(MathData const &, MapleStream &);
 void maxima(MathData const &, MaximaStream &);
 void mathematica(MathData const &, MathematicaStream &);
-void mathmlize(MathData const &, MathStream &);
+docstring mathmlize(MathData const &, MathStream &);
 void octave(MathData const &, OctaveStream &);
 
 bool extractNumber(MathData const & ar, int & i);
index 5564600d06487f06ed46261486e9ed608e80eaa3..dd7ccf3e713ee4ae3eb749c9242d4f987d56ea79 100644 (file)
@@ -73,7 +73,10 @@ public:
        }
        // FIXME Other external things need similar treatment.
        ///
-       void mathmlize(MathStream & ms) const { ms << mathMacro_.cell(idx_); }
+       docstring mathmlize(MathStream & ms) const {
+               ms << mathMacro_.cell(idx_);
+               return docstring();
+       }
        ///
        void draw(PainterInfo & pi, int x, int y) const {
                if (mathMacro_.editMetrics(pi.base.bv)) {
@@ -740,9 +743,10 @@ void MathMacro::maple(MapleStream & os) const
 }
 
 
-void MathMacro::mathmlize(MathStream & os) const
+docstring MathMacro::mathmlize(MathStream & os) const
 {
        os << expanded_.cell(0);
+       return docstring();
 }
 
 
index b431a9a9a516c9344117d618cab328cd3ee6ae72..bb9ed723cafae160d949077e248d8829e27246de 100644 (file)
@@ -71,7 +71,7 @@ public:
        ///
        void maple(MapleStream &) const;
        ///
-       void mathmlize(MathStream &) const;
+       docstring mathmlize(MathStream &) const;
        ///
        void octave(OctaveStream &) const;
        ///