Related tdf#115376: generate ol and li tags for lists

+ change testList QA test accordingly

TODO: in this commit we always use ordered list (since it's the example of the bugtracker)
but we should find the way to know if we must use ordered or unordered list.

Change-Id: Ibcc5281a1fae869808af7054128e412a18bec3e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205853
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet
2026-05-31 09:11:44 +02:00
parent 9adbf98b7a
commit f3099242a3
5 changed files with 47 additions and 2 deletions
+3 -2
View File
@@ -496,9 +496,10 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testList)
xmlDocUniquePtr mpXmlDoc = parseExport(u"OEBPS/sections/section0001.xhtml"_ustr);
// This was "C", i.e. in-list content was ignored.
assertXPathContent(mpXmlDoc, "//xhtml:p[2]/xhtml:span", u"B");
assertXPathContent(mpXmlDoc, "//xhtml:ol[1]/xhtml:li[1]/xhtml:p[1]/xhtml:span", u"B");
// Test nested list content.
assertXPathContent(mpXmlDoc, "//xhtml:p[6]/xhtml:span", u"F");
assertXPathContent(
mpXmlDoc, "//xhtml:ol[2]/xhtml:li[1]/xhtml:ol[1]/xhtml:li[1]/xhtml:p[1]/xhtml:span", u"F");
}
CPPUNIT_TEST_FIXTURE(EPUBExportTest, testImage)
@@ -11,6 +11,8 @@
#include "XMLTextListItemContext.hxx"
#include "xmlimp.hxx"
using namespace com::sun::star;
namespace writerperfect::exp
@@ -28,6 +30,22 @@ rtl::Reference<XMLImportContext> XMLTextListContext::CreateChildContext(
return nullptr;
}
void XMLTextListContext::startElement(
const OUString& /*rName*/,
const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttribs*/)
{
// TODO we should find a way to know if we're in the case of ordered or unordered list
// in second case, we should call "openUnorderedListLevel"
GetImport().GetGenerator().openOrderedListLevel(librevenge::RVNGPropertyList());
}
void XMLTextListContext::endElement(const OUString& /*rName*/)
{
// TODO we should find a way to know if we're in the case of ordered or unordered list
// in second case, we should call "closeUnorderedListLevel"
GetImport().GetGenerator().closeOrderedListLevel();
}
} // namespace writerperfect::exp
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -22,6 +22,12 @@ public:
rtl::Reference<XMLImportContext>
CreateChildContext(const OUString& rName,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override;
void SAL_CALL
startElement(const OUString& /*rName*/,
const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttribs*/) override;
void SAL_CALL endElement(const OUString& rName) override;
};
} // namespace writerperfect::exp
@@ -12,6 +12,8 @@
#include "XMLTextListContext.hxx"
#include "txtparai.hxx"
#include "xmlimp.hxx"
using namespace com::sun::star;
namespace writerperfect::exp
@@ -31,6 +33,18 @@ rtl::Reference<XMLImportContext> XMLTextListItemContext::CreateChildContext(
return nullptr;
}
void XMLTextListItemContext::startElement(
const OUString& /*rName*/,
const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttribs*/)
{
GetImport().GetGenerator().openListElement(librevenge::RVNGPropertyList());
}
void XMLTextListItemContext::endElement(const OUString& /*rName*/)
{
GetImport().GetGenerator().closeListElement();
}
} // namespace writerperfect::exp
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -22,6 +22,12 @@ public:
rtl::Reference<XMLImportContext>
CreateChildContext(const OUString& rName,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override;
void SAL_CALL
startElement(const OUString& /*rName*/,
const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttribs*/) override;
void SAL_CALL endElement(const OUString& rName) override;
};
} // namespace writerperfect::exp