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

Miklos Vajna vmiklos at collabora.co.uk
Mon Nov 27 11:36:33 UTC 2017


 external/libepubgen/libepubgen-epub3.patch.1 |   64 +++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

New commits:
commit 50b1bbf6024f30616a3f2f77e5bb268fe35c5cf2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Nov 27 08:22:09 2017 +0100

    EPUB export: handle image wrap types
    
    Change-Id: If7ef8f8e72e68fb71285ddb0164f033f44c62a53
    Reviewed-on: https://gerrit.libreoffice.org/45309
    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 70a77b101a5c..d83521aa0b3d 100644
--- a/external/libepubgen/libepubgen-epub3.patch.1
+++ b/external/libepubgen/libepubgen-epub3.patch.1
@@ -3619,3 +3619,67 @@ index 2311e76..8414da5 100644
 -- 
 2.13.6
 
+From 3d47458738729c86992a1ed0002726cba5ec315c Mon Sep 17 00:00:00 2001
+From: Miklos Vajna <vmiklos at collabora.co.uk>
+Date: Fri, 10 Nov 2017 12:27:35 +0100
+Subject: [PATCH] EPUBImageManager: initial wrap type handling
+
+You could assume that the wrap is the opposide of clear, but given it's
+an attribute on the next element, they are the same at the end in case
+of left and right.
+---
+ src/lib/EPUBHTMLGenerator.cpp      | 24 ++++++++++++++++++++++++
+ src/test/EPUBTextGeneratorTest.cpp | 38 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 62 insertions(+)
+
+diff --git a/src/lib/EPUBHTMLGenerator.cpp b/src/lib/EPUBHTMLGenerator.cpp
+index d81a905..a90ac68 100644
+--- a/src/lib/EPUBHTMLGenerator.cpp
++++ b/src/lib/EPUBHTMLGenerator.cpp
+@@ -982,6 +982,7 @@ void EPUBHTMLGenerator::insertBinaryObject(const RVNGPropertyList &propList)
+                            propList["librevenge:mime-type"]->getStr());
+ 
+   RVNGPropertyList attrs;
++  RVNGString wrap;
+ 
+   if (!m_impl->m_framePropertiesStack.empty())
+   {
+@@ -995,12 +996,35 @@ void EPUBHTMLGenerator::insertBinaryObject(const RVNGPropertyList &propList)
+       attrs.insert("style", m_impl->m_imageManager.getImageStyle(frameProperties).c_str());
+       break;
+     }
++
++    if (frameProperties["style:wrap"])
++      wrap = frameProperties["style:wrap"]->getStr();
+   }
+ 
+   attrs.insert("src", path.relativeTo(m_impl->m_path).str().c_str());
+   // FIXME: use alternative repr. if available
+   attrs.insert("alt", path.str().c_str());
+   m_impl->output().insertEmptyElement("img", attrs);
++
++  // Emulate wrap type with a break after the image.
++  RVNGString brStyle;
++  if (wrap == "none")
++    brStyle = "clear: both;";
++  else if (wrap == "left")
++    // We want content on the left side, space on the right side, so the next
++    // element should clear on its left.
++    brStyle = "clear: left;";
++  else if (wrap == "right")
++    // Same here.
++    brStyle = "clear: right;";
++  else if (wrap == "parallel")
++    brStyle = "clear: none;";
++  if (!brStyle.empty())
++  {
++    attrs.clear();
++    attrs.insert("style", brStyle);
++    m_impl->output().insertEmptyElement("br", attrs);
++  }
+ }
+ 
+ void EPUBHTMLGenerator::insertEquation(const RVNGPropertyList & /* propList */) {}
+-- 
+2.13.6
+


More information about the Libreoffice-commits mailing list