summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-05-07 13:59:58 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-05-07 15:26:20 +0200
commite5834a3967b3b182d1b7b7a5b500aaea2ea423be (patch)
tree4851accd41dd0350d644cfdfc2fc331ce393e994
parentc0893305bf673bd706a8fec014eedfd104dbe88f (diff)
sw HTML export: ensure <li> is not closed before list item content
Seems to be a regression from commit c30cf5a3d7902018b0a752fa2060b8f2a2caafc2 (sw html: use HtmlWriter in htmlatr in some places, 2014-03-16). Change-Id: If03b77a43cb2f7d1c9c9c62da7eef9ee9c2b5e91 Reviewed-on: https://gerrit.libreoffice.org/53937 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--sw/qa/extras/htmlexport/data/list.html4
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx13
-rw-r--r--sw/source/filter/html/htmlatr.cxx3
3 files changed, 19 insertions, 1 deletions
diff --git a/sw/qa/extras/htmlexport/data/list.html b/sw/qa/extras/htmlexport/data/list.html
new file mode 100644
index 000000000000..867521155add
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/list.html
@@ -0,0 +1,4 @@
+<ul>
+ <li>foo</li>
+ <li>bar</li>
+</ul>
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index a582ac00b41a..f7aaec10a79b 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -529,6 +529,19 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2, "reqif-ole2.xhtml")
// exception of type com.sun.star.io.IOException was thrown.
}
+DECLARE_HTMLEXPORT_TEST(testList, "list.html")
+{
+ SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+ CPPUNIT_ASSERT(pStream);
+ pStream->Seek(STREAM_SEEK_TO_END);
+ sal_uInt64 nLength = pStream->Tell();
+ pStream->Seek(0);
+ OString aStream(read_uInt8s_ToOString(*pStream, nLength));
+ // This failed, it was <li/>, i.e. list item was closed before content
+ // started.
+ CPPUNIT_ASSERT(aStream.indexOf("<li>") != -1);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 3f10864aefd9..fffc6dcf320d 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -764,7 +764,8 @@ void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat,
rInfo.bOutLi = true;
}
else
- html.endAttribute();
+ // Finish the opening element, but don't close it.
+ html.characters(OString());
}
if( rHWrt.m_nDefListLvl > 0 && !bForceDL )