From 9ae793c6070cf31acd2e8f531b184fd6fc4a9279 Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Mon, 9 Jan 2023 01:50:05 +0100 Subject: [PATCH] LyXHTML: avoid using v/align HTML attributes in tables, they are deprecated (like most attributes for td). Also implement alignment at character in CSS. --- src/insets/InsetTabular.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 265a0165f8..1ec96da115 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -3798,7 +3798,7 @@ docstring Tabular::xmlRow(XMLStream & xs, const row_type row, OutputParams const if (output_format == XmlOutputFormat::XHTML) { // In HTML5, prefer to use CSS instead of attributes for alignment // (align and valign). - style << getHAlignAsCssAttribute(cell) << " " + style << getHAlignAsCssAttribute(cell) << "; " << getVAlignAsCssAttribute(cell); } else { // In DocBook, both for HTML and CALS tables, stick to attributes. @@ -3825,9 +3825,11 @@ docstring Tabular::xmlRow(XMLStream & xs, const row_type row, OutputParams const if (is_xhtml_table) { const std::vector styles = computeCssStylePerCell(row, c, cell); - std::string attr_str_prefix = "style='" ; + std::string attr_str_prefix = "style='" + style.str(); + if (!styles.empty()) + attr_str_prefix += "; "; for (auto it = styles.begin(); it != styles.end(); ++it) { - attr << *it; + attr_str_prefix += *it; if (it != styles.end() - 1) attr_str_prefix += "; "; } -- 2.39.5