From 2427c5bdd01d9c94abd3e887dd9d1cfcc3e2f5fc Mon Sep 17 00:00:00 2001 From: John Schember Date: Mon, 3 Jan 2011 20:53:41 -0500 Subject: [PATCH] FB2 Output: Fix bug #8172, Include cover page in output when it is not referenced in the oeb spine. --- src/calibre/ebooks/fb2/fb2ml.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py index f9ce9befb4..8d23a5f0b2 100644 --- a/src/calibre/ebooks/fb2/fb2ml.py +++ b/src/calibre/ebooks/fb2/fb2ml.py @@ -161,6 +161,17 @@ class FB2MLizer(object): text.append('
') self.section_level += 1 + # Insert the title page / cover into the spine if it is not already referenced. + title_name = u'' + if 'titlepage' in self.oeb_book.guide: + title_name = 'titlepage' + elif 'cover' in self.oeb_book.guide: + title_name = 'cover' + if title_name: + title_item = self.oeb_book.manifest.hrefs[self.oeb_book.guide[title_name].href] + if title_item.spine_position is None and title_item.media_type == 'application/xhtml+xml': + self.oeb_book.spine.insert(0, title_item, True) + for item in self.oeb_book.spine: self.log.debug('Converting %s to FictionBook2 XML' % item.href) stylizer = Stylizer(item.data, item.href, self.oeb_book, self.opts, self.opts.output_profile)