[Libreoffice-commits] core.git: external/libepubgen writerperfect/Module_writerperfect.mk

Miklos Vajna vmiklos at collabora.co.uk
Tue Jan 23 08:06:38 UTC 2018


 external/libepubgen/libepubgen-epub3.patch.1 |   68 +++++++++++++++++++++++++++
 writerperfect/Module_writerperfect.mk        |    2 
 2 files changed, 69 insertions(+), 1 deletion(-)

New commits:
commit 90ae1e1bbbce7be9b2ff7add75923b1891e65df6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jan 22 16:00:10 2018 +0100

    EPUB export, fxl: silence Page <N> toc entries when have chapter names
    
    The EPUB ToC is now on par with the PDF ToC.
    
    Change-Id: Iea714fdb68c825aa14345037e909c354bbd7cf00
    Reviewed-on: https://gerrit.libreoffice.org/48346
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/external/libepubgen/libepubgen-epub3.patch.1 b/external/libepubgen/libepubgen-epub3.patch.1
index bcec187b5218..f102eaefe7a6 100644
--- a/external/libepubgen/libepubgen-epub3.patch.1
+++ b/external/libepubgen/libepubgen-epub3.patch.1
@@ -355,3 +355,71 @@ index 8e88adb..38ddcdf 100644
 -- 
 2.13.6
 
+From b6081f659e3000d9f3d5851278d8abdd33448353 Mon Sep 17 00:00:00 2001
+From: Miklos Vajna <vmiklos at collabora.co.uk>
+Date: Mon, 22 Jan 2018 15:54:43 +0100
+Subject: [PATCH] fixed layout: avoid Page <N> entries when chapter names are
+ provided
+
+---
+ src/lib/EPUBHTMLManager.cpp        | 31 ++++++++++++++++++-------------
+ src/test/EPUBTextGeneratorTest.cpp | 16 ++++++++++++++++
+ 2 files changed, 34 insertions(+), 13 deletions(-)
+
+diff --git a/src/lib/EPUBHTMLManager.cpp b/src/lib/EPUBHTMLManager.cpp
+index d35bc3f..35d82e8 100644
+--- a/src/lib/EPUBHTMLManager.cpp
++++ b/src/lib/EPUBHTMLManager.cpp
+@@ -7,6 +7,7 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  */
+ 
++#include <algorithm>
+ #include <cassert>
+ #include <iomanip>
+ #include <sstream>
+@@ -91,24 +92,28 @@ void EPUBHTMLManager::writeTocTo(EPUBXMLSink &sink, const EPUBPath &tocPath, int
+ {
+   if (version >= 30)
+   {
++    bool hasChapterNames = std::find_if(m_paths.begin(), m_paths.end(), [](const EPUBPath &path)
++    {
++      return !path.getChapters().empty();
++    }) != m_paths.end();
+     for (std::vector<EPUBPath>::size_type i = 0; m_paths.size() != i; ++i)
+     {
+       const std::vector<std::string> &chapters = m_paths[i].getChapters();
+-      if (!chapters.empty())
++      for (const auto &chapter : chapters)
+       {
+-        for (const auto &chapter : chapters)
+-        {
+-          sink.openElement("li");
+-          librevenge::RVNGPropertyList anchorAttrs;
+-          anchorAttrs.insert("href", m_paths[i].relativeTo(tocPath).str().c_str());
+-          sink.openElement("a", anchorAttrs);
+-          std::ostringstream label;
+-          sink.insertCharacters(chapter.c_str());
+-          sink.closeElement("a");
+-          sink.closeElement("li");
+-        }
+-        continue;
++        sink.openElement("li");
++        librevenge::RVNGPropertyList anchorAttrs;
++        anchorAttrs.insert("href", m_paths[i].relativeTo(tocPath).str().c_str());
++        sink.openElement("a", anchorAttrs);
++        std::ostringstream label;
++        sink.insertCharacters(chapter.c_str());
++        sink.closeElement("a");
++        sink.closeElement("li");
+       }
++      if (hasChapterNames)
++        // Chapter names are provided for this document, so never write Page
++        // <N> entries.
++        continue;
+ 
+       sink.openElement("li");
+       librevenge::RVNGPropertyList anchorAttrs;
+-- 
+2.13.6
+
diff --git a/writerperfect/Module_writerperfect.mk b/writerperfect/Module_writerperfect.mk
index 6fa274bc8ce5..01f8a0dc5e59 100644
--- a/writerperfect/Module_writerperfect.mk
+++ b/writerperfect/Module_writerperfect.mk
@@ -40,7 +40,7 @@ $(eval $(call gb_Module_add_check_targets,writerperfect,\
 $(eval $(call gb_Module_add_slowcheck_targets,writerperfect,\
 	CppunitTest_writerperfect_calc \
 	CppunitTest_writerperfect_draw \
-	CppunitTest_writerperfect_epubexport \
+	$(if $(SYSTEM_EPUBGEN),,CppunitTest_writerperfect_epubexport) \
 	CppunitTest_writerperfect_import \
 	CppunitTest_writerperfect_impress \
 	CppunitTest_writerperfect_writer \


More information about the Libreoffice-commits mailing list