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

Miklos Vajna vmiklos at collabora.co.uk
Wed Aug 9 09:54:53 UTC 2017


 external/libepubgen/UnpackedTarball_libepubgen.mk  |    6 ++
 external/libepubgen/libepubgen-validation1.patch.1 |   49 +++++++++++++++++++++
 external/libepubgen/libepubgen-validation2.patch.1 |   34 ++++++++++++++
 external/libepubgen/libepubgen-validation3.patch.1 |   35 +++++++++++++++
 external/libepubgen/libepubgen-vc.patch.1          |   13 +++++
 writerperfect/source/writer/EPUBPackage.cxx        |    2 
 6 files changed, 138 insertions(+), 1 deletion(-)

New commits:
commit 12b739aa2bf1f664acbbb4c4c815b3348c912977
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Aug 9 10:53:11 2017 +0200

    libepubgen: backport 3 validation fixes
    
    A hello world ODT is now exported without validation errors.
    
    Change-Id: I2b160ee980f8ed9c80fd76945600d1edb1ee29bc
    Reviewed-on: https://gerrit.libreoffice.org/40908
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/external/libepubgen/UnpackedTarball_libepubgen.mk b/external/libepubgen/UnpackedTarball_libepubgen.mk
index cd4ec7d56e83..5525ca3b2ce7 100644
--- a/external/libepubgen/UnpackedTarball_libepubgen.mk
+++ b/external/libepubgen/UnpackedTarball_libepubgen.mk
@@ -8,6 +8,12 @@
 #
 
 epubgen_patches :=
+# Backport of <https://sourceforge.net/p/libepubgen/code/ci/96e9786f5aba1078251f36e58feefc8d953cdea0/>.
+epubgen_patches += libepubgen-validation1.patch.1
+# Backport of <https://sourceforge.net/p/libepubgen/code/ci/2e51fb9163bbc6b9a27fa524382c5aad9700dd0d/>.
+epubgen_patches += libepubgen-validation2.patch.1
+# Backport of <https://sourceforge.net/p/libepubgen/code/ci/9041ef42f9e0a5c4bc3b0a912d36683c4e10ca84/>.
+epubgen_patches += libepubgen-validation3.patch.1
 # Backport of <https://sourceforge.net/p/libepubgen/code/ci/49f6461d4751d3b16e32ab8f9c93a3856b33be49/>.
 epubgen_patches += libepubgen-vc.patch.1
 
diff --git a/external/libepubgen/libepubgen-validation1.patch.1 b/external/libepubgen/libepubgen-validation1.patch.1
new file mode 100644
index 000000000000..18707e76205d
--- /dev/null
+++ b/external/libepubgen/libepubgen-validation1.patch.1
@@ -0,0 +1,49 @@
+From 96e9786f5aba1078251f36e58feefc8d953cdea0 Mon Sep 17 00:00:00 2001
+From: Miklos Vajna <vmiklos at collabora.co.uk>
+Date: Tue, 8 Aug 2017 16:54:24 +0200
+Subject: [PATCH 1/3] EPUBGenerator: fix validation error with empty
+ dc:identifier element
+
+<http://www.idpf.org/epub/31/spec/epub-packages.html#sec-opf-dcidentifier>
+"3.4.3.2.1 The identifier Element" says that the character content is
+not optional, so write it.
+---
+ configure.ac              |  3 +++
+ src/lib/EPUBGenerator.cpp | 14 +++++++++++++-
+ 2 files changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/EPUBGenerator.cpp b/src/lib/EPUBGenerator.cpp
+index 0d0f866..507eb14 100644
+--- a/src/lib/EPUBGenerator.cpp
++++ b/src/lib/EPUBGenerator.cpp
+@@ -7,6 +7,10 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  */
+ 
++#include <boost/uuid/uuid.hpp>
++#include <boost/uuid/uuid_generators.hpp>
++#include <boost/uuid/uuid_io.hpp>
++
+ #include "EPUBCSSSink.h"
+ #include "EPUBHTMLGenerator.h"
+ #include "EPUBGenerator.h"
+@@ -193,7 +197,15 @@ void EPUBGenerator::writeRoot()
+ 
+   RVNGPropertyList identifierAttrs;
+   identifierAttrs.insert("id", uniqueId);
+-  sink.insertEmptyElement("dc:identifier", identifierAttrs);
++  identifierAttrs.insert("opf:scheme", "UUID");
++  sink.openElement("dc:identifier", identifierAttrs);
++  // The identifier element is required to have a unique character content.
++  std::stringstream identifierStream("urn:uuid:");
++  boost::uuids::uuid uuid = boost::uuids::random_generator()();
++  identifierStream << uuid;
++  std::string identifierCharactrs = identifierStream.str();
++  sink.insertCharacters(identifierCharactrs.c_str());
++  sink.closeElement("dc:identifier");
+ 
+   sink.openElement("dc:title");
+   sink.closeElement("dc:title");
+-- 
+2.12.3
+
diff --git a/external/libepubgen/libepubgen-validation2.patch.1 b/external/libepubgen/libepubgen-validation2.patch.1
new file mode 100644
index 000000000000..a1807f33841b
--- /dev/null
+++ b/external/libepubgen/libepubgen-validation2.patch.1
@@ -0,0 +1,34 @@
+From 2e51fb9163bbc6b9a27fa524382c5aad9700dd0d Mon Sep 17 00:00:00 2001
+From: Miklos Vajna <vmiklos at collabora.co.uk>
+Date: Tue, 8 Aug 2017 17:23:38 +0200
+Subject: [PATCH 2/3] EPUBGenerator: don't write empty guide element
+
+<http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6> "2.6:
+Guide" requires:
+
+	Within the package there may be one guide element, containing one or
+	more reference elements.
+
+Given that we never wrote reference child-elements, just don't write the
+guide element at all, especially seeing that it's deprecated in OPF3.
+---
+ src/lib/EPUBGenerator.cpp | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/src/lib/EPUBGenerator.cpp b/src/lib/EPUBGenerator.cpp
+index 507eb14..9dbccac 100644
+--- a/src/lib/EPUBGenerator.cpp
++++ b/src/lib/EPUBGenerator.cpp
+@@ -225,9 +225,6 @@ void EPUBGenerator::writeRoot()
+   m_htmlManager.writeSpineTo(sink);
+   sink.closeElement("spine");
+ 
+-  sink.openElement("guide");
+-  sink.closeElement("guide");
+-
+   sink.closeElement("package");
+ 
+   sink.writeTo(*m_package, "OEBPS/content.opf");
+-- 
+2.12.3
+
diff --git a/external/libepubgen/libepubgen-validation3.patch.1 b/external/libepubgen/libepubgen-validation3.patch.1
new file mode 100644
index 000000000000..b543e5a96e38
--- /dev/null
+++ b/external/libepubgen/libepubgen-validation3.patch.1
@@ -0,0 +1,35 @@
+From 9041ef42f9e0a5c4bc3b0a912d36683c4e10ca84 Mon Sep 17 00:00:00 2001
+From: Miklos Vajna <vmiklos at collabora.co.uk>
+Date: Tue, 8 Aug 2017 17:39:18 +0200
+Subject: [PATCH 3/3] EPUBHTMLManager: fix value of <navPoint playOrder"...">
+
+<http://www.niso.org/workrooms/daisy/Z39-86-2005.html#NCXplay> "8.4.3
+playOrder Attribute" says:
+
+	playOrder is a positive integer; the first playOrder value in a document
+	shall be 1.
+
+So instead of writing an empty attribute, write the same number that's
+already used for <navPoint id="...">.
+---
+ src/lib/EPUBHTMLManager.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/EPUBHTMLManager.cpp b/src/lib/EPUBHTMLManager.cpp
+index e5add82..03dbf21 100644
+--- a/src/lib/EPUBHTMLManager.cpp
++++ b/src/lib/EPUBHTMLManager.cpp
+@@ -75,7 +75,9 @@ void EPUBHTMLManager::writeTocTo(EPUBXMLSink &sink, const EPUBPath &tocPath)
+     id << "section" << (i + 1);
+     navPointAttrs.insert("id", id.str().c_str());
+     navPointAttrs.insert("class", "document");
+-    navPointAttrs.insert("playOrder", "");
++    std::ostringstream playOrder;
++    playOrder << (i + 1);
++    navPointAttrs.insert("playOrder", playOrder.str().c_str());
+     sink.openElement("navPoint", navPointAttrs);
+     sink.openElement("navLabel");
+     sink.openElement("text");
+-- 
+2.12.3
+
diff --git a/external/libepubgen/libepubgen-vc.patch.1 b/external/libepubgen/libepubgen-vc.patch.1
index d14b122f9575..4c929ed47a86 100644
--- a/external/libepubgen/libepubgen-vc.patch.1
+++ b/external/libepubgen/libepubgen-vc.patch.1
@@ -41,6 +41,19 @@ diff -Naur a/configure b/configure
  
  #error "This is not a C++11 compiler"
  
+diff --git a/src/lib/EPUBGenerator.cpp b/src/lib/EPUBGenerator.cpp
+index 9dbccac..3357cf2 100644
+--- a/src/lib/EPUBGenerator.cpp
++++ b/src/lib/EPUBGenerator.cpp
+@@ -7,6 +7,8 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  */
+ 
++#include <sstream>
++
+ #include <boost/uuid/uuid.hpp>
+ #include <boost/uuid/uuid_generators.hpp>
+ #include <boost/uuid/uuid_io.hpp>
 -- 
 2.12.3
 
diff --git a/writerperfect/source/writer/EPUBPackage.cxx b/writerperfect/source/writer/EPUBPackage.cxx
index d3b51d4848da..7818f584b76f 100644
--- a/writerperfect/source/writer/EPUBPackage.cxx
+++ b/writerperfect/source/writer/EPUBPackage.cxx
@@ -125,7 +125,7 @@ void EPUBPackage::insertRule(const librevenge::RVNGString &rSelector, const libr
 
     aStream << "}\n";
     std::string aString = aStream.str();
-    uno::Sequence<sal_Int8> aData(reinterpret_cast<const sal_Int8*>(aString.c_str()), aString.size());
+    uno::Sequence<sal_Int8> aData(reinterpret_cast<const sal_Int8 *>(aString.c_str()), aString.size());
     mxOutputStream->writeBytes(aData);
 }
 


More information about the Libreoffice-commits mailing list