[LyX/master] DocBook: in a table, fix a typo in a condition.

Thibaut Cuvelier tcuvelier at lyx.org
Mon Feb 26 15:10:02 UTC 2024


commit baccce7d2de92dcf57eb2afa8492e56a4805b1af
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon Feb 26 16:09:26 2024 +0100

    DocBook: in a table, fix a typo in a condition.
    
    Before this patch, all table cells had a semicolon at the beginning of their style:
    
    <td style='; border-bottom:
    
    This unwanted behaviour is only due to a typo in a condition when concatenating two styles: the previous code was checking the second part of the style once the first was output, instead of the first one.
---
 autotests/export/docbook/basic.xml | 54 +++++++++++++++++++-------------------
 src/insets/InsetTabular.cpp        |  2 +-
 2 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/autotests/export/docbook/basic.xml b/autotests/export/docbook/basic.xml
index c03a26c12d..2248a2cbf4 100644
--- a/autotests/export/docbook/basic.xml
+++ b/autotests/export/docbook/basic.xml
@@ -153,31 +153,31 @@ I am no more code. </para>
 <caption>I am a table caption below the table.</caption>
 <tbody>
 <tr>
-<td align='center' valign='top'>
+<td style='border-bottom: 3.000000px double; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Table 1</para>
 </td>
-<td align='center' valign='top'>
+<td style='border-bottom: 3.000000px double; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Table 2</para>
 </td>
-<td align='center' valign='top'>
+<td style='border-bottom: 3.000000px double; border-right: 1px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Table 3</para>
 </td>
 </tr>
 <tr>
-<td align='center' valign='top'>
+<td style='border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Row 1</para>
 </td>
-<td align='center' valign='top'></td>
-<td align='center' valign='top'>
+<td style='border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'></td>
+<td style='border-right: 1px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Col 3, row 1</para>
 </td>
 </tr>
 <tr>
-<td align='center' valign='top'>
+<td style='border-bottom: 1.000000px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Row 2</para>
 </td>
-<td align='center' valign='top'></td>
-<td align='center' valign='top'>
+<td style='border-bottom: 1.000000px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'></td>
+<td style='border-bottom: 1.000000px solid; border-right: 1px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Col 3, row 2</para>
 </td>
 </tr>
@@ -187,31 +187,31 @@ I am no more code. </para>
 <caption>I am a table caption above the table.</caption>
 <tbody>
 <tr>
-<td align='center' valign='top'>
+<td style='border-bottom: 3.000000px double; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Table 1</para>
 </td>
-<td align='center' valign='top'>
+<td style='border-bottom: 3.000000px double; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Table 2</para>
 </td>
-<td align='center' valign='top'>
+<td style='border-bottom: 3.000000px double; border-right: 1px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Table 3</para>
 </td>
 </tr>
 <tr>
-<td align='center' valign='top'>
+<td style='border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Row 1</para>
 </td>
-<td align='center' valign='top'></td>
-<td align='center' valign='top'>
+<td style='border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'></td>
+<td style='border-right: 1px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Col 3, row 1</para>
 </td>
 </tr>
 <tr>
-<td align='center' valign='top'>
+<td style='border-bottom: 1.000000px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Row 2</para>
 </td>
-<td align='center' valign='top'></td>
-<td align='center' valign='top'>
+<td style='border-bottom: 1.000000px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'></td>
+<td style='border-bottom: 1.000000px solid; border-right: 1px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Col 3, row 2</para>
 </td>
 </tr>
@@ -220,31 +220,31 @@ I am no more code. </para>
 <informaltable>
 <tbody>
 <tr>
-<td align='center' valign='top'>
+<td style='border-bottom: 3.000000px double; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Table that has no caption 1</para>
 </td>
-<td align='center' valign='top'>
+<td style='border-bottom: 3.000000px double; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Table that has no caption 2</para>
 </td>
-<td align='center' valign='top'>
+<td style='border-bottom: 3.000000px double; border-right: 1px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Table that has no caption 3</para>
 </td>
 </tr>
 <tr>
-<td align='center' valign='top'>
+<td style='border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Row 1</para>
 </td>
-<td align='center' valign='top'></td>
-<td align='center' valign='top'>
+<td style='border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'></td>
+<td style='border-right: 1px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Col 3, row 1</para>
 </td>
 </tr>
 <tr>
-<td align='center' valign='top'>
+<td style='border-bottom: 1.000000px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Row 2</para>
 </td>
-<td align='center' valign='top'></td>
-<td align='center' valign='top'>
+<td style='border-bottom: 1.000000px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'></td>
+<td style='border-bottom: 1.000000px solid; border-right: 1px solid; border-left: 1px solid; border-top: 1.000000px solid' align='center' valign='top'>
 <para>Col 3, row 2</para>
 </td>
 </tr>
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 9b4f175f74..5242775e7f 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -3842,7 +3842,7 @@ docstring Tabular::xmlRow(XMLStream & xs, const row_type row, OutputParams const
 			const std::vector<std::string> styles = computeCssStylePerCell(row, c, cell);
 
 			std::string attr_str_prefix = "style='" + style.str();
-			if (!styles.empty())
+			if (!style.str().empty())
 				attr_str_prefix += "; ";
 			for (auto it = styles.begin(); it != styles.end(); ++it) {
 				attr_str_prefix += *it;


More information about the lyx-cvs mailing list