sw/qa/extras/htmlexport/data/TableWithIndent.fodt |   22 ++++++++++++++++++++++
 sw/qa/extras/htmlexport/htmlexport.cxx            |   14 ++++++++++++++
 sw/source/filter/html/htmltabw.cxx                |   10 ++++++++++
 3 files changed, 46 insertions(+)

New commits:
commit 74cd34d54d16cb68fbaf1e8cb9844b1048491965
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Mar 2 16:15:16 2023 +0300
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Mar 2 15:31:17 2023 +0000

    tdf#153923: close 'dd' tag properly
    
    Change-Id: I4ae3b23c616fc2ea40a5fdf8640bf5db0bb371ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148122
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/qa/extras/htmlexport/data/TableWithIndent.fodt 
b/sw/qa/extras/htmlexport/data/TableWithIndent.fodt
new file mode 100644
index 000000000000..5daaa75e8e24
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/TableWithIndent.fodt
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:automatic-styles>
+  <style:style style:name="Table1" style:family="table">
+   <style:table-properties style:width="14cm" fo:margin-left="3cm" 
table:align="left"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:body>
+  <office:text>
+   <table:table table:name="Table1" table:style-name="Table1">
+    <table:table-column/>
+    <table:table-row>
+     <table:table-cell office:value-type="string">
+      <text:p/>
+     </table:table-cell>
+    </table:table-row>
+   </table:table>
+   <text:p/>
+  </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index ea5ef60e3ddc..c99f6d4b23a8 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2464,6 +2464,20 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf114769)
                          getXPath(pHtmlDoc, "/html/body/p[5]/a", "href"));
 }
 
+CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf153923)
+{
+    createSwDoc("TableWithIndent.fodt");
+    save("HTML (StarWriter)");
+
+    // Parse it as XML (strict!)
+    xmlDocUniquePtr pDoc = parseXml(maTempFile);
+    // Without the fix in place, this would fail
+    CPPUNIT_ASSERT(pDoc);
+
+    // The 'dd' tag was not closed
+    assertXPath(pDoc, "/html/body//dd");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmltabw.cxx 
b/sw/source/filter/html/htmltabw.cxx
index c1ba9a248d68..835c80900e72 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -1058,6 +1058,7 @@ Writer& OutHTML_SwTableNode( Writer& rWrt, SwTableNode & 
rNode,
         if( rHTMLWrt.m_bLFPossible )
             rHTMLWrt.OutNewLine();
         HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), 
Concat2View(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_dd) );
+        rHTMLWrt.IncIndentLevel();
     }
 
     // eFlyHoriOri and eTabHoriOri now only contain the values of
@@ -1184,6 +1185,15 @@ Writer& OutHTML_SwTableNode( Writer& rWrt, SwTableNode & 
rNode,
     // move Pam behind the table
     rHTMLWrt.m_pCurrentPam->GetPoint()->Assign( *rNode.EndOfSectionNode() );
 
+    if (nNewDefListLvl)
+    {
+        rHTMLWrt.DecIndentLevel();
+        if (rHTMLWrt.m_bLFPossible)
+            rHTMLWrt.OutNewLine();
+        // close the dd element
+        HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), 
Concat2View(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_dd), false);
+    }
+
     if( bPreserveForm )
     {
         rHTMLWrt.m_bPreserveForm = false;

Reply via email to