[LyX/master] CALS tables: fix implementation of multirow/col.

Thibaut Cuvelier tcuvelier at lyx.org
Sat Apr 2 01:00:27 UTC 2022


commit 8b9c162f515c9666a8a4c5ca26052d710b15d89b
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Apr 2 02:54:12 2022 +0200

    CALS tables: fix implementation of multirow/col.
---
 src/insets/InsetTabular.cpp |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 478ecf1..77bb970 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -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);


More information about the lyx-cvs mailing list