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
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);
}
}
+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();
}
}
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_;
///
bool in_text_;
///
odocstringstream deferred_;
+ ///
+ friend 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_;
///