From 224d35cb79f7f0d0edffbc08633809abafd3dd27 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 7 Jul 2019 09:11:59 +0530 Subject: [PATCH] EPUB Output: If there are no guide elements do not output an empty guide tag. Makes the asinine epubcheck happy. Fixes #1835560 [epub file fails at epub check](https://bugs.launchpad.net/calibre/+bug/1835560) --- src/calibre/ebooks/oeb/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 4cbf29d75e..24560c49d7 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -1486,6 +1486,8 @@ class Guide(object): return elem def to_opf2(self, parent=None): + if not len(self): + return elem = element(parent, OPF('guide')) for ref in self.refs.values(): attrib = {'type': ref.type, 'href': urlunquote(ref.href)}