]> git.lyx.org Git - lyx.git/commitdiff
Fix MathML output for MathBox, as suggested in the FIXME.
authorRichard Heck <rgheck@comcast.net>
Thu, 31 Dec 2009 19:49:29 +0000 (19:49 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 31 Dec 2009 19:49:29 +0000 (19:49 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32711 a592a061-630c-0410-9148-cb99ea01b6c8

development/HTML/HTML.notes
src/mathed/InsetMathBox.cpp
src/mathed/MathStream.cpp
src/mathed/MathStream.h

index 74796233871b5dc33ef8ac8ef785883d8557dd40..0f863b47bc762f800b1976ed939f60126fc7c809 100644 (file)
@@ -54,7 +54,6 @@ Math
   isues, and not all the insets work. Here are the ones I know still need work:
        - AMSArray
        - Array
-       - Box
        - Cases
        - Diff: Code exists, but I do not know if it is right.
        - Binom (in Frac): None of these tags exist in MathML 2.0. We'll
index d432794fc070980122ec2f7a3436d7a5179b1bf6..8aba8d80fcbc6323336d8cbc0756176a62d858ee 100644 (file)
@@ -54,12 +54,8 @@ void InsetMathBox::normalize(NormalStream & os) const
 
 void 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
-       // need something like ModeSpecifier for MathStream.
-       ms << MTag("mtext");
-       ms.os() << cell(0);
-       ms << ETag("mtext");
+       SetMode textmode(ms, true);
+       ms << cell(0);
 }
 
 
index 81a89dc6d3af7e28c74512306408d36c4ada75fa..ffc91c4f42667cd611d2fc749cda76f4b9af7630 100644 (file)
@@ -337,22 +337,35 @@ MathStream & operator<<(MathStream & ms, docstring const & s)
 }
 
 
+SetMode::SetMode(MathStream & os, bool text)
+       : os_(os)
+{
+       init(text, from_ascii(""));
+}
+
+
 SetMode::SetMode(MathStream & os, bool text, docstring attrs)
-               : os_(os)
+       : os_(os)
 {
-       was_text_ = os.inText();
+       init(text, attrs);
+}
+
+
+void SetMode::init(bool text, docstring attrs)
+{
+       was_text_ = os_.inText();
        if (was_text_)
-               os << "</mtext>";
+               os_ << "</mtext>";
        if (text) {
-               os.setTextMode();
-               os << "<mtext";
+               os_.setTextMode();
+               os_ << "<mtext";
                if (!attrs.empty())
-                       os << " " << attrs;
-               os << ">";
+                       os_ << " " << attrs;
+               os_ << ">";
        } else {
                if (!attrs.empty())
-                       os << "<mstyle " << attrs << ">";
-               os.setMathMode();
+                       os_ << "<mstyle " << attrs << ">";
+               os_.setMathMode();
        }
 }
 
index df97ce303a7d73aaeb1d92ccda7009ad865e20e5..51760a33dde485c22fdf4e041d503d77b024c88b 100644 (file)
@@ -263,13 +263,13 @@ public:
        void defer(std::string const &);
        ///
        docstring deferred() const;
+       ///
+       bool inText() const { return in_text_; }
+private:
        ///
        void setTextMode() { in_text_ = true; }
        ///
        void setMathMode() { in_text_ = false; }
-       ///
-       bool inText() const { return in_text_; }
-private:
        ///
        odocstream & os_;
        ///
@@ -282,6 +282,8 @@ private:
        bool in_text_;
        ///
        odocstringstream deferred_;
+       ///
+       friend class SetMode;
 };
 
 ///
@@ -307,11 +309,13 @@ class SetMode {
 public:
        ///
        explicit SetMode(MathStream & os, bool text, docstring attrs);
-       // not clear yet precisely what we need...
-       // explicit SetMode(MathStream & os, bool text);
+       ///
+       explicit SetMode(MathStream & os, bool text);
        ///
        ~SetMode();
 private:
+       ///
+       void init(bool, docstring);
        ///
        MathStream & os_;
        ///