From 2d9f59f4dca37c030a0015636bdb98720caf144a Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Thu, 15 Jan 2009 12:07:29 -0500 Subject: [PATCH] Better handling for Mobipocket //guide/references --- src/calibre/ebooks/mobi/writer.py | 18 ++++++++++++++---- src/calibre/ebooks/oeb/base.py | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/calibre/ebooks/mobi/writer.py b/src/calibre/ebooks/mobi/writer.py index 9c5e2ad35d..11391c56b5 100644 --- a/src/calibre/ebooks/mobi/writer.py +++ b/src/calibre/ebooks/mobi/writer.py @@ -117,11 +117,15 @@ class Serializer(object): buffer.write('') for ref in self.oeb.guide.values(): path, frag = urldefrag(ref.href) - if hrefs[path].media_type not in OEB_DOCS or \ - not ref.title: + if hrefs[path].media_type not in OEB_DOCS: continue - buffer.write('') @@ -148,6 +152,12 @@ class Serializer(object): def serialize_body(self): buffer = self.buffer buffer.write('') + # CybookG3 'Start Reading' link + if 'text' in self.oeb.guide: + href = self.oeb.guide['text'].href + buffer.write('') spine = [item for item in self.oeb.spine if item.linear] spine.extend([item for item in self.oeb.spine if not item.linear]) for item in spine: diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 8ff6b6c1ff..2c171f3490 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -547,7 +547,7 @@ class Guide(object): ('epigraph', 'Epigraph'), ('foreword', 'Foreword'), ('loi', 'List of Illustrations'), ('lot', 'List of Tables'), ('notes', 'Notes'), ('preface', 'Preface'), - ('text', 'Begin Reading')] + ('text', 'Main Text')] TYPES = set(t for t, _ in _TYPES_TITLES) TITLES = dict(_TYPES_TITLES) ORDER = dict((t, i) for (t, _), i in izip(_TYPES_TITLES, count(0)))