]> git.lyx.org Git - features.git/commitdiff
Fix equation number output for MathML+HTML.
authorRichard Heck <rgheck@comcast.net>
Tue, 11 Jan 2011 23:34:59 +0000 (23:34 +0000)
committerRichard Heck <rgheck@comcast.net>
Tue, 11 Jan 2011 23:34:59 +0000 (23:34 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37180 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h

index 8129508774b50f650424f646a49d7fba9b518c12..5a809e066fdc6f7e7262f8cdaaa044a2c60e487a 100644 (file)
@@ -1910,8 +1910,51 @@ int InsetMathHull::docbook(odocstream & os, OutputParams const & runparams) cons
 }
 
 
+// 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 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
                odocstringstream os;
                HtmlStream ms(os);
                try {
-                       InsetMathGrid::htmlize(ms);
+                       htmlize(ms);
                        success = true;
                } catch (MathExportException const &) {}
                if (success) {
index 6635d8be997ea41aeca44a57dc7a4288958b1f41..53062d329840f37a6a37f51cf1f38bdca8d83bd3 100644 (file)
@@ -130,6 +130,8 @@ public:
        docstring xhtml(XHTMLStream &, OutputParams const &) const;
        ///
        void mathmlize(MathStream &) const;
+       ///
+       void htmlize(HtmlStream &) const;
        /// 
        void toString(odocstream &) const;
        ///