]> git.lyx.org Git - features.git/commitdiff
Fix up the math stream.
authorRichard Heck <rgheck@comcast.net>
Wed, 31 Mar 2010 18:57:37 +0000 (18:57 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 31 Mar 2010 18:57:37 +0000 (18:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33969 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathBox.cpp
src/mathed/MathStream.cpp
src/mathed/MathStream.h

index 2f42ee819cc259d07a4eeabf98c84daa7593f223..fa3f5653241eb6fd876fac3a456bf4ed20c6a950 100644 (file)
@@ -54,7 +54,7 @@ void InsetMathBox::normalize(NormalStream & os) const
 
 void InsetMathBox::mathmlize(MathStream & ms) const
 {      
-       SetMode textmode(ms, true, from_ascii("class='mathbox'"));
+       SetMode textmode(ms, true, "class='mathbox'");
        ms << cell(0);
 }
 
@@ -144,7 +144,7 @@ void InsetMathFBox::normalize(NormalStream & os) const
 
 void InsetMathFBox::mathmlize(MathStream & ms) const
 {      
-       SetMode textmode(ms, true, from_ascii("class='fbox'"));
+       SetMode textmode(ms, true, "class='fbox'");
        ms << cell(0);
 }
 
@@ -290,7 +290,7 @@ void InsetMathMakebox::mathmlize(MathStream & ms) const
 {
        // FIXME We could do something with the other arguments.
        std::string const cssclass = framebox_ ? "framebox" : "makebox";
-       SetMode textmode(ms, true, from_ascii("class='" + cssclass + "'"));
+       SetMode textmode(ms, true, "class='" + cssclass + "'");
        ms << cell(2);
 }
 
@@ -370,7 +370,7 @@ void InsetMathBoxed::infoize(odocstream & os) const
 
 void InsetMathBoxed::mathmlize(MathStream & ms) const
 {
-       SetMode mathmode(ms, false, from_ascii("class='boxed'"));
+       SetMode mathmode(ms, false, "class='boxed'");
        ms << cell(0);
 }
 
index 8f2534bbb16e2d00a91061b78ccb9841b0dce002..b142f7e9c04b2d63632d86f57b78883eaf9d6023 100644 (file)
@@ -437,18 +437,18 @@ HtmlStream & operator<<(HtmlStream & ms, docstring const & s)
 SetMode::SetMode(MathStream & os, bool text)
        : os_(os), opened_(false)
 {
-       init(text, from_ascii(""));
+       init(text, "");
 }
 
 
-SetMode::SetMode(MathStream & os, bool text, docstring attrs)
+SetMode::SetMode(MathStream & os, bool text, string const & attrs)
        : os_(os), opened_(false)
 {
        init(text, attrs);
 }
 
 
-void SetMode::init(bool text, docstring attrs)
+void SetMode::init(bool text, string const & attrs)
 {
        was_text_ = os_.inText();
        if (was_text_)
@@ -457,12 +457,12 @@ void SetMode::init(bool text, docstring attrs)
                os_.setTextMode();
                os_ << "<mtext";
                if (!attrs.empty())
-                       os_ << " " << attrs;
+                       os_ << " " << from_utf8(attrs);
                os_ << ">";
                opened_ = true;
        } else {
                if (!attrs.empty()) {
-                       os_ << "<mstyle " << attrs << ">";
+                       os_ << "<mstyle " << from_utf8(attrs) << ">";
                        opened_ = true;
                }
                os_.setMathMode();
@@ -493,21 +493,27 @@ SetMode::~SetMode()
 SetHTMLMode::SetHTMLMode(HtmlStream & os, bool text)
        : os_(os), opened_(false)
 {
-       was_text_ = os_.inText();
-       if (text)
-               os_.setTextMode();
-       else
-               os_.setMathMode();
+       init(text, "");
 }
 
 
 SetHTMLMode::SetHTMLMode(HtmlStream & os, bool text, string attrs)
        : os_(os), opened_(true)
+{
+       init(text, attrs);
+}
+
+
+void SetHTMLMode::init(bool text, string const & attrs)
 {
        was_text_ = os_.inText();
        if (text) {
                os_.setTextMode();
-               os_ << MTag("span", attrs);
+               if (attrs.empty())
+                       os_ << MTag("span");
+               else
+                       os_ << MTag("span", attrs);
+               opened_ = true;
        } else
                os_.setMathMode();
 }
index 502848d23419ff6936870a9057c7c5bc8b7b7245..40b06a0ef0561d401c52840bd699a543e8043275 100644 (file)
@@ -335,14 +335,14 @@ MathStream & operator<<(MathStream &, ETag const &);
 class SetMode {
 public:
        ///
-       explicit SetMode(MathStream & os, bool text, docstring attrs);
+       explicit SetMode(MathStream & os, bool text, std::string const & attrs);
        ///
        explicit SetMode(MathStream & os, bool text);
        ///
        ~SetMode();
 private:
        ///
-       void init(bool, docstring);
+       void init(bool, std::string const &);
        ///
        MathStream & os_;
        ///
@@ -422,6 +422,8 @@ public:
        ///
        ~SetHTMLMode();
 private:
+       ///
+       void init(bool, std::string const &);
        ///
        HtmlStream & os_;
        ///