sw/qa/extras/htmlexport/data/ul_with_disc.fodt |   23 ++++++++++++++++
 sw/qa/extras/htmlexport/htmlexport.cxx         |   14 ++++++++++
 sw/source/filter/html/htmlnumwriter.cxx        |   35 +++++++++++++------------
 3 files changed, 56 insertions(+), 16 deletions(-)

New commits:
commit eecd78825061fb1ad51528b44cae96e559e88da8
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Nov 22 13:38:08 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Nov 22 11:24:30 2024 +0100

    ReqIF: avoid 'type' attribute in 'ul' elements
    
    Change-Id: I028737cac0b89344be5df55f9b60046230603979
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176987
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/htmlexport/data/ul_with_disc.fodt 
b/sw/qa/extras/htmlexport/data/ul_with_disc.fodt
new file mode 100644
index 000000000000..b41da841cf61
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/ul_with_disc.fodt
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:automatic-styles>
+  <text:list-style style:name="L1">
+   <text:list-level-style-bullet text:level="1" text:bullet-char="•"/>
+   <text:list-level-style-bullet text:level="2" text:bullet-char=""/>
+  </text:list-style>
+ </office:automatic-styles>
+ <office:body>
+  <office:text>
+   <text:list text:style-name="L1">
+    <text:list-item>
+     <text:list>
+      <text:list-header>
+       <text:p>list header</text:p>
+      </text:list-header>
+     </text:list>
+    </text:list-item>
+   </text:list>
+  </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index a20b11ec41ef..8dbb4cff6a14 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -1581,6 +1581,20 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqifEmbedJPGShapeDirectly)
     assertXPath(pXmlDoc, 
"//reqif-xhtml:p/reqif-xhtml:object/reqif-xhtml:object", "type",
                 u"image/png");
 }
+
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifNoTypeInUL)
+{
+    // Given a document with an unordered list:
+    createSwDoc("ul_with_disc.fodt");
+
+    // When exporting to XHTML:
+    ExportToReqif();
+
+    // Check that 'ul' element has no 'type' attribute
+    xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile();
+    // Without the accompanying fix in place, this test would have failed
+    assertXPathNoAttribute(pXmlDoc, 
"//reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:ul", "type");
+}
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/html/htmlnumwriter.cxx 
b/sw/source/filter/html/htmlnumwriter.cxx
index 046747754a38..7f09fd8ce8cc 100644
--- a/sw/source/filter/html/htmlnumwriter.cxx
+++ b/sw/source/filter/html/htmlnumwriter.cxx
@@ -187,24 +187,27 @@ SwHTMLWriter& OutHTML_NumberBulletListStart( 
SwHTMLWriter& rWrt,
             // unordered list: <UL>
             sOut += OOO_STRING_SVTOOLS_HTML_unorderlist;
 
-            // determine the type by the bullet character
-            const char *pStr = nullptr;
-            switch( rNumFormat.GetBulletChar() )
+            if (!rWrt.mbReqIF) // No 'type' attribute in ReqIF
             {
-            case HTML_BULLETCHAR_DISC:
-                pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_disc;
-                break;
-            case HTML_BULLETCHAR_CIRCLE:
-                pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_circle;
-                break;
-            case HTML_BULLETCHAR_SQUARE:
-                pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_square;
-                break;
-            }
+                // determine the type by the bullet character
+                const char* pStr = nullptr;
+                switch (rNumFormat.GetBulletChar())
+                {
+                    case HTML_BULLETCHAR_DISC:
+                        pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_disc;
+                        break;
+                    case HTML_BULLETCHAR_CIRCLE:
+                        pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_circle;
+                        break;
+                    case HTML_BULLETCHAR_SQUARE:
+                        pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_square;
+                        break;
+                }
 
-            if( pStr )
-            {
-                sOut += OString::Concat(" " OOO_STRING_SVTOOLS_HTML_O_type 
"=\"") + pStr + "\"";
+                if (pStr)
+                {
+                    sOut += OString::Concat(" " OOO_STRING_SVTOOLS_HTML_O_type 
"=\"") + pStr + "\"";
+                }
             }
         }
         else if( SVX_NUM_BITMAP == eType )

Reply via email to