mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix MathML output for MathBox, as suggested in the FIXME.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32711 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
31d6e4a9fc
commit
19cd5f0e82
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -337,22 +337,35 @@ MathStream & operator<<(MathStream & ms, docstring const & s)
|
||||
}
|
||||
|
||||
|
||||
SetMode::SetMode(MathStream & os, bool text, docstring attrs)
|
||||
: os_(os)
|
||||
SetMode::SetMode(MathStream & os, bool text)
|
||||
: os_(os)
|
||||
{
|
||||
was_text_ = os.inText();
|
||||
init(text, from_ascii(""));
|
||||
}
|
||||
|
||||
|
||||
SetMode::SetMode(MathStream & os, bool text, docstring attrs)
|
||||
: os_(os)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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_;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user