diff --git a/src/calibre/ebooks/mobi/debug/headers.py b/src/calibre/ebooks/mobi/debug/headers.py index 1d2c5b78b9..1799d403f1 100644 --- a/src/calibre/ebooks/mobi/debug/headers.py +++ b/src/calibre/ebooks/mobi/debug/headers.py @@ -327,7 +327,7 @@ class MOBIHeader(object): # {{{ self.primary_index_record, = struct.unpack(b'>I', self.raw[244:248]) - if self.file_version >= 8: + if self.length >= 248: (self.sect_idx, self.skel_idx, self.datp_idx, self.oth_idx ) = struct.unpack_from(b'>4L', self.raw, 248) self.unknown9 = self.raw[264:self.length] @@ -414,7 +414,7 @@ class MOBIHeader(object): # {{{ self.has_indexing_bytes, self.has_uncrossable_breaks )) ans.append('Primary index record (null value: %d): %d'%(NULL_INDEX, self.primary_index_record)) - if self.file_version >= 8: + if self.length >= 248: i('Sections Index', self.sect_idx) i('SKEL Index', self.skel_idx) i('DATP Index', self.datp_idx) diff --git a/src/calibre/manual/conversion.rst b/src/calibre/manual/conversion.rst index c37c1eafdb..f6fe04dd90 100644 --- a/src/calibre/manual/conversion.rst +++ b/src/calibre/manual/conversion.rst @@ -573,6 +573,18 @@ There is a Word macro package that can automate the conversion of Word documents generating the Table of Contents much simpler. It is called BookCreator and is available for free at `mobileread `_. +An easy way to generate a Table of Contents when converting a Word document is: + + 1. Mark your Chapters and sub-Chapters in the doc file with one of the MS built-in styles called 'Heading 1', 'Heading 2', ..., 'Heading 6'. 'Heading 1' equates to the HTML tag

, 'Heading 2' to

etc + + 2. Save the doc as Webpage-filtered (rather than Webpage) and import the html file into |app| + + 3. When you convert in |app| you use what you did in step 1 to set the box called 'Detect chapters at' on the Convert - Structure Detection page. For example: + + * If you mark Chapters with style 'Heading 2' then set the 'Detect chapters at' box to //h:h2 This will give you a proper external metadata TOC in the converted epub. + * A slightly more complex example...if your book has Sections and Chapters and you want a 2-level nested metadata TOC. Mark the doc Sections with style 'Heading 2' and the Chapters with style 'Heading 3'. When you convert set the 'Detect chapters at' box to //h:h2|//h:h3. On the Convert - TOC page set the 'Level 1 TOC' box to //h:h2 and the 'Level 2 TOC' box to //h:h3. + + Convert TXT documents ~~~~~~~~~~~~~~~~~~~~~~