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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 30 16:46:06 UTC 2018


 sw/qa/extras/htmlexport/data/reqif-no-lang.odt |binary
 sw/qa/extras/htmlexport/htmlexport.cxx         |   11 +++++++++++
 sw/source/filter/html/wrthtml.cxx              |    3 ++-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 81fac013cb365d711ad78a566ee1b5b13480b013
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Thu Aug 30 15:08:36 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Thu Aug 30 18:45:42 2018 +0200

    sw XHTML export: xml:lang is not relevant for ReqIF
    
    I suppose if language is set, that happens in the wrapping ReqIF
    document, not in the XHTML fragments.
    
    Change-Id: I970c3810b7f02bbafc37dd85e095b254cc651330
    Reviewed-on: https://gerrit.libreoffice.org/59810
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/htmlexport/data/reqif-no-lang.odt b/sw/qa/extras/htmlexport/data/reqif-no-lang.odt
new file mode 100644
index 000000000000..c831921a42a4
Binary files /dev/null and b/sw/qa/extras/htmlexport/data/reqif-no-lang.odt differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index c83170752496..861054868ec1 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -646,6 +646,17 @@ DECLARE_HTMLEXPORT_TEST(testOleNodataReqIf, "reqif-ole-nodata.odt")
     CPPUNIT_ASSERT(!aSource.isEmpty());
 }
 
+DECLARE_HTMLEXPORT_TEST(testNoLangReqIf, "reqif-no-lang.odt")
+{
+    SvMemoryStream aStream;
+    wrapFragment(aStream);
+    xmlDocPtr pDoc = parseXmlStream(&aStream);
+    CPPUNIT_ASSERT(pDoc);
+
+    // Make sure that xml:lang is not written in ReqIF mode.
+    assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:h1", "lang");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 2f8dde26a3bd..53b57fc4ce33 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1339,7 +1339,8 @@ sal_uInt16 SwHTMLWriter::GetLangWhichIdFromScript( sal_uInt16 nScript )
 
 void SwHTMLWriter::OutLanguage( LanguageType nLang )
 {
-    if( LANGUAGE_DONTKNOW != nLang )
+    // ReqIF mode: consumers would ignore language anyway.
+    if (LANGUAGE_DONTKNOW != nLang && !mbReqIF)
     {
         OStringBuffer sOut;
         sOut.append(' ');


More information about the Libreoffice-commits mailing list