+ if (havetable)
+ os << MTag("mtr");
+ for (col_type col = 0; col < ncols(); ++col) {
+ idx_type const i = index(row, col);
+ if (cellinfo_[i].multi_ != CELL_PART_OF_MULTICOLUMN) {
+ col_type const cellcols = ncellcols(i);
+ ostringstream attr;
+ if (havetable && cellcols > 1)
+ attr << "colspan='" << cellcols << '\'';
+ os << MTag(celltag, attr.str());
+ os << cell(index(row, col));
+ os << ETag(celltag);
+ }
+ }
+ if (havetable)
+ os << ETag("mtr");
+ }
+ if (havetable)
+ os << ETag("mtable");
+}
+
+
+// FIXME XHTML
+// We need to do something about alignment here.
+void InsetMathGrid::htmlize(HtmlStream & os, string attrib) const
+{
+ bool const havetable = nrows() > 1 || ncols() > 1;
+ if (!havetable) {
+ os << cell(index(0, 0));
+ return;
+ }
+ os << MTag("table", attrib);
+ for (row_type row = 0; row < nrows(); ++row) {
+ os << MTag("tr");
+ for (col_type col = 0; col < ncols(); ++col) {
+ idx_type const i = index(row, col);
+ if (cellinfo_[i].multi_ != CELL_PART_OF_MULTICOLUMN) {
+ col_type const cellcols = ncellcols(i);
+ ostringstream attr;
+ if (cellcols > 1)
+ attr << "colspan='" << cellcols << '\'';
+ os << MTag("td", attr.str());
+ os << cell(index(row, col));
+ os << ETag("td");
+ }
+ }
+ os << ETag("tr");