[Libreoffice-commits] core.git: sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Apr 11 18:25:33 UTC 2018


 sw/qa/extras/htmlexport/htmlexport.cxx |    3 +++
 sw/source/filter/html/htmlatr.cxx      |   13 ++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit b6f7a4908d1c3fc610440a1cbbbc1673a53da8b6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Apr 11 18:17:14 2018 +0200

    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 at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

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 )
     {


More information about the Libreoffice-commits mailing list