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 2456bcee922851a7538d2a34e3bad9c4e05239b6 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Mar 2 16:15:16 2023 +0300 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Mar 3 10:36:12 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> (cherry picked from commit 74cd34d54d16cb68fbaf1e8cb9844b1048491965) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148097 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> 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 c04226e0f5c8..a8cc4d2cef04 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -2397,6 +2397,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 a1dee0f75333..fec5e4a10e31 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -1057,6 +1057,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 @@ -1183,6 +1184,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;