diff --git a/src/calibre/ebooks/htmlz/oeb2html.py b/src/calibre/ebooks/htmlz/oeb2html.py index a0bbc4af18..12a4271290 100644 --- a/src/calibre/ebooks/htmlz/oeb2html.py +++ b/src/calibre/ebooks/htmlz/oeb2html.py @@ -44,6 +44,10 @@ class OEB2HTML(object): def oeb2html(self, oeb_book, opts): self.log.info('Converting OEB book to HTML...') self.opts = opts + try: + self.book_title = unicode(oeb_book.metadata.title[0]) + except Exception: + self.book_title = _('Unknown') self.links = {} self.images = {} self.base_hrefs = [item.href for item in oeb_book.spine] @@ -52,7 +56,10 @@ class OEB2HTML(object): return self.mlize_spine(oeb_book) def mlize_spine(self, oeb_book): - output = [u''] + output = [ + u'%s' % ( + prepare_string_for_xml(self.book_title)) + ] for item in oeb_book.spine: self.log.debug('Converting %s to HTML...' % item.href) self.rewrite_ids(item.data, item) @@ -330,8 +337,9 @@ class OEB2HTMLClassCSSizer(OEB2HTML): css = u'' else: css = u'' + title = u'%s' % prepare_string_for_xml(self.book_title) output = [u''] + \ - [css] + [u''] + output + [u''] + [css] + [title, u''] + output + [u''] return ''.join(output) def dump_text(self, elem, stylizer, page):