Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 01-05-2012, 08:24 PM   #1
addressee
Member
addressee began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2011
Device: iPod Touch 4g
Unique MOBI to EPUB conversion TOC results

I am having an interesting result in attempting to convert a MOBI file to EPUB format for reading on an iPod.

The Table Of Contents from the MOBI file, when viewed in Calibre's E-book viewer, is fine both from the in-text TOC links and the sidebar TOC for both first- and second-level destinations. That is, using either of them navigates precisely to the correct place in the book whether to a first-level or second-level section of the book.

In a converted EPUB file each TOC top-level link navigates to the last page *before* the TOC section desired. Second-level links navigate to the correct page. (Other hyperlinks from text to chapter end notes and back also function normally.) So the problem appears to be related to the structure or coding at the first level chapters or sections only.

I've tried tweaks to the conversion process from the 'Default Input Profile' to use 'Kindle' and 'Mobipocket' settings = no change. I'm not sure where to proceed from here without going down alleys of trial-and-error or dropping to use Sigil to hand edit the converted file. I've seen this result before, so I'm hopeful to learn of some Calibre tweak that makes these conversions easy and automated.

Using the Search/Regex Builder tool from the Calibre Conversion utility I have been able to extract the following code sample. This describes, from the original MOBI format file, the structure shown further below. (Line breaks have been added for readability.)
Code:
<pagebreak id="filepos56214">

<div class="mbp_pagebreak"/><p class="calibre_1119"><font size="6"><span class="italic"><span class="bold"><font color="#000">PART ONE</font></span></span></font></p><br/><p class="calibre_1119"><font size="6"><span class="italic"><span class="bold"><font color="#000">SECOND LINE OF FIRST-LEVEL TOC TEXT</font></span></span></font></p><br/>

<pagebreak id="filepos56501">

<div class="mbp_pagebreak"/>

<p class="calibre_1665"><font size="5"><span class="italic"><span class="bold"><font color="#000">CHAPTER 1</font></span></span></font></p><br/><p class="calibre_1665"><font size="5"><span class="italic"><span class="bold"><font color="#000">SECOND LINE OF FIRST-LEVEL TOC TEXT</font></span></span></font></p><br/>

<p class="calibre_1665"><font size="5"><span class="italic"><span class="bold"><font color="#000">THIS IS THE FIRST PARAGRAPH IN THE CHAPTER TEXT</font></span></span></font></p><br/><p class="calibre_1703"><font size="4"><span class="italic"><span class="bold"><font color="#000">THIS IS THE SECOND PARAGRAPH IN THE CHAPTER TEXT</font></span></span></font></p><br/><p class="calibre_1125"><font color="#000">THIS IS THE THIRD PARAGRAPH IN THE CHAPTER TEXT</font></p><br id="filepos59142"/>

<p class="calibre_30"><font size="5"><span class="bold"><font color="#000">THIS IS THE SECOND-LEVEL TOC TEXT</font></span></font></p><br/>

<p class="calibre_1125"><font color="#000">TEXT IN THE BOOK CONTINUES...
(An observation about the code given above and the structure given below:The content-TOC and the metadata-TOC both read as "Part One: This is The First Part" or "Chapter One: This is The First Chapter" -- with semi-colons. The code sample above does *not* include these semi-colons; I have included them in the structure sample below for readability only.)

This results in a navigation as below for the MOBI file, but the converted EPUB file ends up with first-level TOC navigation to the page prior to the intended destination.

Code:
		some sort of page break

		PART ONE: SECOND LINE OF FIRST-LEVEL TOC TEXT

		some sort of page break
		
		CHAPTER 1: SECOND LINE OF FIRST-LEVEL TOC TEXT
		
			THIS IS THE FIRST PARA IN THE CHAPTER TEXT
			THIS IS THE SECOND PARA IN THE CHAPTER TEXT
			THIS IS THE THIRD PARA IN THE CHAPTER TEXT	
			
				THIS IS THE SECOND-LEVEL TOC TEXT

				TEXT IN THE BOOK CONTINUES...
So .... is there some conversion tweak that can be used to correct the errors that cause first-level navigation to go awry while leaving the working second-level items intact?

Thx!
addressee is offline   Reply With Quote
Old 01-05-2012, 08:59 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 35,983
Karma: 17083916
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Get the Kindle app and side load the mobi. Then you don't have to convert.
JSWolf is offline   Reply With Quote
Old 01-06-2012, 08:01 PM   #3
addressee
Member
addressee began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2011
Device: iPod Touch 4g
Quote:
Originally Posted by JSWolf View Post
Get the Kindle app and side load the mobi. Then you don't have to convert.
Thanks for replying, but I'm not a fan of Kindle (and other things Amazon), and see no reason to be forced to using multiple reader apps. Also, this file will be read by several people - force everyone to use Kindle? Not really a solution at all.
addressee is offline   Reply With Quote
Old 01-06-2012, 08:06 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 35,983
Karma: 17083916
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Take the ePub, load it into Sigil, delete the internal ToC page and edit ToC.ncx to fix any links that don't won't. That's your easiest solution to fix the ToC.
JSWolf is offline   Reply With Quote
Old 01-06-2012, 09:33 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,280
Karma: 4961457
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre's conversion code has heuristics to detect this situation (anchor just before pagebreak) and fix it automatically. This particular MOBI file is breaking that heuristic by using a custom tag <pagebreak> for the anchor. I'd say editing with Sigil is your best bet.
kovidgoyal is online now   Reply With Quote
Old 01-08-2012, 11:11 PM   #6
addressee
Member
addressee began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2011
Device: iPod Touch 4g
Thanks to both of you for your instruction. Sigil was, indeed, the only way to resolve this.

Fortunately we have Sigil to help correct these anomalies.

Unfortunately, I am becoming all too familiar with Sigil, as I've been seeing this type of issue more frequently on conversions from MOBI. In this book - since I had it open in Sigil anyway! - I chose to clean up several other things that weren't very cleanly made in the original file.

Cheers,
addressee is offline   Reply With Quote
Old 01-09-2012, 03:42 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,280
Karma: 4961457
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It may be possible to tweak the heuristic to auto-detect and correct more of these scenarios. If you open a bug report and attch a few mobi files that have this problem, I'll take a look.
kovidgoyal is online now   Reply With Quote
Old 01-09-2012, 12:39 PM   #8
addressee
Member
addressee began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2011
Device: iPod Touch 4g
I'll start keeping a list. THX
addressee is offline   Reply With Quote
Reply

Tags
conversion to epub, mobi source, toc creation

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ePUBs multilevel TOC gets flattened in conversion to MOBI damnated Conversion 14 09-02-2011 02:25 PM
ePub TOC to mobi TOC edmnddntes Conversion 5 01-24-2011 02:56 AM
Calibre comic conversion yields poor results when target is epub; looks fine on LRF acidzebra Calibre 2 08-17-2009 10:54 AM
Preserving TOC upon conversion from Lit to Mobi mobelby Calibre 0 07-31-2009 07:59 AM
TOC no longer works after Mobi -> LRF conversion... rroberrto Calibre 3 07-07-2009 01:22 AM


All times are GMT -4. The time now is 11:02 PM.


MobileRead.com is a privately owned, operated and funded community.