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)

This commit is contained in:
Kovid Goyal 2019-07-07 09:11:59 +05:30
parent 7f978f859c
commit 224d35cb79
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1486,6 +1486,8 @@ class Guide(object):
return elem return elem
def to_opf2(self, parent=None): def to_opf2(self, parent=None):
if not len(self):
return
elem = element(parent, OPF('guide')) elem = element(parent, OPF('guide'))
for ref in self.refs.values(): for ref in self.refs.values():
attrib = {'type': ref.type, 'href': urlunquote(ref.href)} attrib = {'type': ref.type, 'href': urlunquote(ref.href)}