void MathArray::mathmlize(MathMLStream & os) const
{
MathArray ar = glueChars();
- os << "<mrow>";
- for (const_iterator it = ar.begin(); it != ar.end(); ++it) {
- MathInset const * p = it->nucleus();
- if (MathScriptInset const * q = ar.asScript(it)) {
- q->mathmlize(p, os);
- ++it;
- } else
- p->mathmlize(os);
+ if (ar.size() == 0)
+ os << "<mrow/>";
+ else if (ar.size() == 1)
+ os << ar.begin()->nucleus();
+ else {
+ os << "<mrow>";
+ for (const_iterator it = ar.begin(); it != ar.end(); ++it) {
+ MathInset const * p = it->nucleus();
+ if (MathScriptInset const * q = ar.asScript(it)) {
+ q->mathmlize(p, os);
+ ++it;
+ } else
+ p->mathmlize(os);
+ }
+ os << "</mrow>";
}
- os << "</mrow>";
}
MathMLStream ms(os);
ms << "<equation><alt>";
int res = ascii(buf, ms.os_, 0);
- ms << "</alt>\n<mml>" << par_.nucleus() << "<mml></equation>";
+ ms << "</alt>\n<math>" << par_.nucleus() << "<math></equation>";
return res + 1;
}
}
-void MathDelimInset::octavize(OctaveStream & os) const
-{
- if (left_ == "|" && right_ == "|")
- os << "det(" << cell(0) << ")";
- else
- os << left_.c_str() << cell(0) << right_.c_str();
-}
-
-
void MathDelimInset::maplize(MapleStream & os) const
{
if (left_ == "|" && right_ == "|") {
os << left_.c_str() << cell(0) << right_.c_str();
}
+
+void MathDelimInset::mathmlize(MathMLStream & os) const
+{
+ os << "<fenced open=\"" << left_.c_str() << "\" close=\""
+ << right_.c_str() << "\">" << cell(0) << "</fenced>";
+}
+
+
+void MathDelimInset::octavize(OctaveStream & os) const
+{
+ if (left_ == "|" && right_ == "|")
+ os << "det(" << cell(0) << ")";
+ else
+ os << left_.c_str() << cell(0) << right_.c_str();
+}
///
bool isMatrix() const;
///
- void octavize(OctaveStream &) const;
- ///
void maplize(MapleStream &) const;
+ ///
+ void mathmlize(MathMLStream &) const;
+ ///
+ void octavize(OctaveStream &) const;
private:
///
int dw() const;
}
-void MathGridInset::octavize(OctaveStream & os) const
-{
- os << '[';
- for (row_type row = 0; row < nrows(); ++row) {
- if (row)
- os << ';';
- os << '[';
- for (col_type col = 0; col < ncols(); ++col)
- os << cell(index(row, col)) << ' ';
- os <<']';
- }
- os <<']';
-}
-
-
void MathGridInset::maplize(MapleStream & os) const
{
os << "array([";
os << "])";
}
+
+void MathGridInset::mathmlize(MathMLStream & os) const
+{
+ os << "<mtable>";
+ for (row_type row = 0; row < nrows(); ++row) {
+ os << "<mtr>";
+ for (col_type col = 0; col < ncols(); ++col)
+ os << cell(index(row, col));
+ os << "</mtr>";
+ }
+ os << "</mtable>";
+}
+
+
+void MathGridInset::octavize(OctaveStream & os) const
+{
+ os << '[';
+ for (row_type row = 0; row < nrows(); ++row) {
+ if (row)
+ os << ';';
+ os << '[';
+ for (col_type col = 0; col < ncols(); ++col)
+ os << cell(index(row, col)) << ' ';
+ os << ']';
+ }
+ os << ']';
+}
///
void setDefaults();
- ///
- void octavize(OctaveStream &) const;
///
void maplize(MapleStream &) const;
+ ///
+ void mathmlize(MathMLStream &) const;
+ ///
+ void octavize(OctaveStream &) const;
protected:
/// returns proper 'end of line' code for LaTeX
}
+void MathMatrixInset::mathmlize(MathMLStream & os) const
+{
+ MathGridInset::mathmlize(os);
+}
+
string MathMatrixInset::label(row_type row) const
{
///
MathInsetTypes getType() const;
+ ///
+ void mathmlize(MathMLStream &) const;
private:
///