sw/qa/extras/htmlexport/data/tdf155871.fodt | 21 +++++++++++++++++++++ sw/qa/extras/htmlexport/htmlexport.cxx | 12 ++++++++++++ sw/source/filter/html/htmlnumwriter.cxx | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-)
New commits: commit 7244e7eb562fe95e1678b63a0950db9ed61c7ad8 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Jun 16 16:22:22 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Jun 16 20:13:01 2023 +0300 tdf#155871: don't forget to close li before starting next When closing a nested list, the previous condition failed to close the last li in case when the next item is numbered (i.e., will need another li). Indeed, if the next item is unnumbered, current last li should stay open. Change-Id: Iad7d83d50d2f02d6bd1d046804b7e23b59f9ce8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153179 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/qa/extras/htmlexport/data/tdf155871.fodt b/sw/qa/extras/htmlexport/data/tdf155871.fodt new file mode 100644 index 000000000000..97e29fbe69b8 --- /dev/null +++ b/sw/qa/extras/htmlexport/data/tdf155871.fodt @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:body> + <office:text> + <text:list> + <text:list-item> + <text:p>foo</text:p> + <text:list> + <text:list-item> + <text:p>bar</text:p> + </text:list-item> + </text:list> + </text:list-item> + <text:list-item> + <text:p>baz</text:p> + </text:list-item> + </text:list> + </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 c5e77ec662f9..3cdf01bf5174 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -2550,6 +2550,18 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ListsWithNumFormat) assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[4]", "type"); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf155871) +{ + createSwDoc("tdf155871.fodt"); + ExportToReqif(); + + SvMemoryStream aStream; + WrapReqifFromTempFile(aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); + // Without the fix in place, this would fail + CPPUNIT_ASSERT(pDoc); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index 8045fb5b1c02..1a4528506964 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -326,7 +326,7 @@ Writer& OutHTML_NumberBulletListEnd( SwHTMLWriter& rWrt, else aTag = OOO_STRING_SVTOOLS_HTML_orderlist; HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), Concat2View(rWrt.GetNamespace() + aTag), false ); - if (rWrt.mbXHTML && i != nNextDepth + 1) + if (rWrt.mbXHTML && (i != nNextDepth + 1 || (i != 1 && rNextInfo.IsNumbered()))) { // for all skipped sublevels, close a li HTMLOutFuncs::Out_AsciiTag(