From: Richard Heck Date: Wed, 31 Mar 2010 18:57:37 +0000 (+0000) Subject: Fix up the math stream. X-Git-Tag: 2.0.0~3611 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9ee805185c7b86752400401acde10d7ba3ee69e1;p=features.git Fix up the math stream. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33969 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/InsetMathBox.cpp b/src/mathed/InsetMathBox.cpp index 2f42ee819c..fa3f565324 100644 --- a/src/mathed/InsetMathBox.cpp +++ b/src/mathed/InsetMathBox.cpp @@ -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); } diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp index 8f2534bbb1..b142f7e9c0 100644 --- a/src/mathed/MathStream.cpp +++ b/src/mathed/MathStream.cpp @@ -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_ << ""; opened_ = true; } else { if (!attrs.empty()) { - os_ << ""; + os_ << ""; 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(); } diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h index 502848d234..40b06a0ef0 100644 --- a/src/mathed/MathStream.h +++ b/src/mathed/MathStream.h @@ -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_; ///