Author: rgheck
Date: Wed Jan 12 00:34:59 2011
New Revision: 37180
URL: http://www.lyx.org/trac/changeset/37180

Log:
Fix equation number output for MathML+HTML.

Modified:
   lyx-devel/trunk/src/mathed/InsetMathHull.cpp
   lyx-devel/trunk/src/mathed/InsetMathHull.h

Modified: lyx-devel/trunk/src/mathed/InsetMathHull.cpp
==============================================================================
--- lyx-devel/trunk/src/mathed/InsetMathHull.cpp        Wed Jan 12 00:18:56 
2011        (r37179)
+++ lyx-devel/trunk/src/mathed/InsetMathHull.cpp        Wed Jan 12 00:34:59 
2011        (r37180)
@@ -1910,8 +1910,51 @@
 }
 
 
+// FIXME XHTML
+// We need to do something about alignment here.
+//
+// This duplicates code from InsetMathGrid, but
+// we need access here to number information,
+// and we simply do not have that in InsetMathGrid.
+void InsetMathHull::htmlize(HtmlStream & os) const
+{
+       bool havenumbers = false;
+       for (size_t i = 0; i != numbered_.size(); ++i) {
+               if (numbered_[i]) {
+                       havenumbers = true;
+                       break;
+               }
+       }
+       bool const havetable = havenumbers || nrows() > 1 || ncols() > 1;
+
+       if (!havetable) {
+               os << cell(index(0, 0));
+               return;
+       }
+
+       os << MTag("table", "class='mathtable'");
+       for (row_type row = 0; row < nrows(); ++row) {
+               os << MTag("tr");
+               for (col_type col = 0; col < ncols(); ++col) {
+                       os << MTag("td");
+                       os << cell(index(row, col));
+                       os << ETag("td");
+               }
+               if (havenumbers) {
+                       os << MTag("td");
+                       docstring const & num = numbers_[row];
+                       if (!num.empty())
+                               os << '(' << num << ')';
+                 os << ETag("td");
+               }
+               os << ETag("tr");
+       }
+       os << ETag("table");
+}
+
+
 // this duplicates code from InsetMathGrid, but
-// we need access here to label and number information,
+// we need access here to number information,
 // and we simply do not have that in InsetMathGrid.
 void InsetMathHull::mathmlize(MathStream & os) const
 {
@@ -1984,7 +2027,7 @@
                odocstringstream os;
                HtmlStream ms(os);
                try {
-                       InsetMathGrid::htmlize(ms);
+                       htmlize(ms);
                        success = true;
                } catch (MathExportException const &) {}
                if (success) {

Modified: lyx-devel/trunk/src/mathed/InsetMathHull.h
==============================================================================
--- lyx-devel/trunk/src/mathed/InsetMathHull.h  Wed Jan 12 00:18:56 2011        
(r37179)
+++ lyx-devel/trunk/src/mathed/InsetMathHull.h  Wed Jan 12 00:34:59 2011        
(r37180)
@@ -130,6 +130,8 @@
        docstring xhtml(XHTMLStream &, OutputParams const &) const;
        ///
        void mathmlize(MathStream &) const;
+       ///
+       void htmlize(HtmlStream &) const;
        /// 
        void toString(odocstream &) const;
        ///

Reply via email to