]> git.lyx.org Git - features.git/commitdiff
CALS tables: fix implementation of multirow/col.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Sat, 2 Apr 2022 00:54:12 +0000 (02:54 +0200)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Sat, 2 Apr 2022 01:34:33 +0000 (03:34 +0200)
src/insets/InsetTabular.cpp

index 478ecf1fa665d6ddc194d238e9d9a47824b08d42..77bb970db1713a70faa8727db121e54c5abb2588 100644 (file)
@@ -3731,6 +3731,7 @@ docstring Tabular::xmlRow(XMLStream & xs, row_type row, OutputParams const & run
 {
        docstring ret;
        const bool is_xhtml_table = is_xhtml || docbook_table_output == BufferParams::TableOutput::HTMLTable;
+       const bool is_cals_table = !is_xhtml && docbook_table_output == BufferParams::TableOutput::CALSTable;
 
        std::string const row_tag = is_xhtml_table ? "tr" : "row";
        std::string const cell_tag = is_xhtml_table ? (header ? "th" : "td") : "entry";
@@ -3758,16 +3759,21 @@ docstring Tabular::xmlRow(XMLStream & xs, row_type row, OutputParams const & run
 
                attr << getHAlignAsXmlAttribute(cell, false) << " " << getVAlignAsXmlAttribute(cell);
 
-               if (isMultiColumn(cell))
-                       attr << " colspan='" << columnSpan(cell) << "'";
-               else if (isMultiRow(cell))
-                       attr << " rowspan='" << rowSpan(cell) << "'";
-               else if (!is_xhtml && docbook_table_output == BufferParams::TableOutput::CALSTable)
-                       attr << " colname='c" << (c + 1) << "'"; // CALS column numbering starts at 1.
+               attr << getHAlignAsXmlAttribute(cell, false) << " " << getVAlignAsXmlAttribute(cell) << " ";
 
-               // All cases where there should be a line *below* this row.
-               if (!is_xhtml && docbook_table_output == BufferParams::TableOutput::CALSTable && row_info[row].bottom_space_default)
-                       attr << " rowsep='1'";
+               if (is_xhtml_table) {
+                       if (isMultiColumn(cell))
+                               attr << "colspan='" << columnSpan(cell) << "'";
+                       else if (isMultiRow(cell))
+                               attr << "rowspan='" << rowSpan(cell) << "'";
+               } else if (is_cals_table) {
+                       if (isMultiColumn(cell))
+                               attr << "namest='c" << c << " nameend='c" << (c + columnSpan(cell)) << "'";
+                       else if (isMultiRow(cell))
+                               attr << "morerows='" << rowSpan(cell) << "'";
+                       else if (!is_xhtml && docbook_table_output == BufferParams::TableOutput::CALSTable)
+                               attr << "colname='c" << (c + 1) << "'"; // CALS column numbering starts at 1.
+               }
 
                // Render the cell as either XHTML or DocBook.
                xs << xml::StartTag(cell_tag, attr.str(), true);