diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-11 18:17:14 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-11 20:24:48 +0200 |
commit | b6f7a4908d1c3fc610440a1cbbbc1673a53da8b6 (patch) | |
tree | 7329d9e82056bc85b44664b61b5f0a26de548496 /sw | |
parent | 8094fa17207729c119f7a1fa399286919dd1a8a3 (diff) |
sw XHTML export: properly write <li>...</li> around paragraphs
HTML allows just writing <li>, but XHTML really insist on an explicit
end element for list items.
Change-Id: Ia4aef95c290800d6dc2f6559e7b7bfa3a4213376
Reviewed-on: https://gerrit.libreoffice.org/52734
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/htmlexport/htmlexport.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/html/htmlatr.cxx | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index f659eba0b1c8..bafe6798c8c4 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -489,6 +489,9 @@ DECLARE_HTMLEXPORT_TEST(testReqIfList, "reqif-list.xhtml") // This failed, the 'style' attribute was written, even if the input did // not had one. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), aStream.indexOf(" style=\"")); + + // This failed <li> was only opened, not closed. + CPPUNIT_ASSERT(aStream.indexOf("</reqif-xhtml:li>") != -1); } DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2, "reqif-ole2.xhtml") diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 1f3dc216c0e4..779b93aa7af0 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -207,6 +207,7 @@ struct SwHTMLTextCollOutputInfo bool bParaPossible; // a </P> may be output additionally bool bOutPara; // a </P> is supposed to be output bool bOutDiv; // write a </DIV> + bool bOutLi = false; // write a </li> SwHTMLTextCollOutputInfo() : bInNumBulList( false ), @@ -757,7 +758,13 @@ void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat, html.start(OOO_STRING_SVTOOLS_HTML_li); if( USHRT_MAX != nNumStart ) html.attribute(OOO_STRING_SVTOOLS_HTML_O_value, OString::number(nNumStart)); - html.endAttribute(); + if (rHWrt.mbXHTML) + { + rWrt.Strm().WriteCharPtr(">"); + rInfo.bOutLi = true; + } + else + html.endAttribute(); } if( rHWrt.m_nDefListLvl > 0 && !bForceDL ) @@ -1008,6 +1015,10 @@ void OutHTML_SwFormatOff( Writer& rWrt, const SwHTMLTextCollOutputInfo& rInfo ) rHWrt.m_bLFPossible = true; } + if (rInfo.bOutLi) + HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rHWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_li, + false); + // if necessary, close a bulleted or numbered list if( rInfo.bInNumBulList ) { |