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

Miklos Vajna vmiklos at collabora.co.uk
Tue Mar 20 17:36:05 UTC 2018


 sw/qa/extras/htmlexport/htmlexport.cxx |    9 ++++++---
 sw/source/filter/html/wrthtml.cxx      |    6 ++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit f74d9ba2190426b974ca3d56da58919ac233a5d3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Mar 20 14:58:19 2018 +0100

    sw XHTML import: write <div> wrapper in ReqIF mode
    
    ReqIF says the XHTML fragment must be of type xhtml.BlkStruct.class,
    which is either a <p> or a <div> element (a single one).
    
    Just write this wrapper unconditionally, as we ignore it on import
    anyway, and it could be skipped only in the single-paragraph-doc case.
    
    Change-Id: I3051008866c4a28ce54413c73071bd4a5ced8b87
    Reviewed-on: https://gerrit.libreoffice.org/51646
    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 fcb073cbcd8b..6a7b5e7774e4 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -341,7 +341,8 @@ DECLARE_HTMLEXPORT_TEST(testReqIfParagraph, "reqif-p.xhtml")
     sal_uInt64 nLength = pStream->Tell();
     pStream->Seek(0);
 
-    OString aExpected("<reqif-xhtml:p>aaa<reqif-xhtml:br/>\nbbb</reqif-xhtml:p>" SAL_NEWLINE_STRING);
+    OString aExpected("<reqif-xhtml:div><reqif-xhtml:p>aaa<reqif-xhtml:br/>\nbbb"
+                      "</reqif-xhtml:p>" SAL_NEWLINE_STRING);
 
     // This was '<table' instead.
     aExpected += "<reqif-xhtml:table";
@@ -462,8 +463,10 @@ DECLARE_HTMLEXPORT_TEST(testReqIfTable, "reqif-table.xhtml")
     htmlDocPtr pDoc = parseHtml(maTempFile);
     CPPUNIT_ASSERT(pDoc);
 
-    assertXPath(pDoc, "/html/body/table/tr/th", 1);
-    OUString aStyle = getXPath(pDoc, "/html/body/table/tr/th", "style");
+    // <div> was missing, so the XHTML fragment wasn't a valid
+    // xhtml.BlkStruct.class type anymore.
+    assertXPath(pDoc, "/html/body/div/table/tr/th", 1);
+    OUString aStyle = getXPath(pDoc, "/html/body/div/table/tr/th", "style");
     CPPUNIT_ASSERT(aStyle.indexOf("background") != -1);
     // This failed, there were 2 style attributes, so as a best effort the
     // parser took the value of the first.
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index a2b8a8d811bc..5a01534ff141 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -452,6 +452,9 @@ ErrCode SwHTMLWriter::WriteStream()
         OutNewLine();
         HTMLOutFuncs::Out_AsciiTag( Strm(), GetNamespace() + OOO_STRING_SVTOOLS_HTML_html, false );
     }
+    else if (mbReqIF)
+        // ReqIF: end xhtml.BlkStruct.class.
+        HTMLOutFuncs::Out_AsciiTag(Strm(), GetNamespace() + OOO_STRING_SVTOOLS_HTML_division, false);
 
     // delete the table with floating frames
     OSL_ENSURE( !m_pHTMLPosFlyFrames, "Were not all frames output?" );
@@ -1076,6 +1079,9 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
 
         Strm().WriteChar( '>' );
     }
+    else if (mbReqIF)
+        // ReqIF: start xhtml.BlkStruct.class.
+        HTMLOutFuncs::Out_AsciiTag(Strm(), GetNamespace() + OOO_STRING_SVTOOLS_HTML_division);
 
     return pPageDesc;
 }


More information about the Libreoffice-commits mailing list