[LyX/master] InsetTabular in XML: avoid outputting empty cells.

Thibaut Cuvelier <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 5f92d566c2d2919ed524400dee24324f8d7c96a8
Author: Thibaut Cuvelier <[email protected]>
Date:   Fri Mar 6 19:27:28 2026 +0100

    InsetTabular in XML: avoid outputting empty cells.
    
    Some tools don't like them.
---
 src/insets/InsetTabular.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index e7920a7cd8..edcbf60f92 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -4285,6 +4285,7 @@ void Tabular::xmlRow(XMLStream & xs, const row_type row, OutputParams const & ru
 
 		// Render the cell as either XHTML or DocBook.
 		xs << xml::StartTag(cell_tag, attr_str, true);
+		const pos_type xs_position_before_cell = xs.os().tellp();
 		if (output_format == XmlOutputFormat::XHTML) {
 			cellInset(cell)->xhtml(xs, runparams);
 		} else if (output_format == XmlOutputFormat::DOCBOOK) {
@@ -4294,6 +4295,10 @@ void Tabular::xmlRow(XMLStream & xs, const row_type row, OutputParams const & ru
 			rp.docbook_force_pars = true;
 			cellInset(cell)->docbook(xs, rp);
 		}
+		if (xs.os().tellp() == xs_position_before_cell) {
+			// Avoid empty cells.
+			xs << XMLStream::ESCAPE_NONE << "&#0160;";
+		}
 		xs << xml::EndTag(cell_tag);
 		xs << xml::CR();
 	}
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.