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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-16-2011, 07:09 AM   #1
RachDvn
Member
RachDvn has a complete set of Star Wars action figures.RachDvn has a complete set of Star Wars action figures.RachDvn has a complete set of Star Wars action figures.RachDvn has a complete set of Star Wars action figures.
 
RachDvn's Avatar
 
Posts: 24
Karma: 322
Join Date: Jan 2011
Device: Kindle
azw to mobi: Not detecting chapters/page break at chapters and no TOC

I'm trying to clean up a large batch of files for a friend who sent .docs (her own writing) to amazon for conversion. I'm using Calibre to convert them from .azw to .mobi and running into a wall for chapter detection. I've tried ticking and unticking the "Preprocess input file..." option, and there is no change. I've tried changing it from "pagebreak" to "both", and still no luck. My XPath expression for detecting chapters is default.

I also can't get a TOC to be generated. I've tried ticking and unticking "force use of TOC" and no change. I don't particularly WANT a TOC, but if it's necessary for creating page breaks between chapters, then fine, i'll take it. The main wish is just to have each chapter begin on a new page!

Any ideas why this is? Am I missing something? Is this a bug or is it connected to the orig format and I'm SOL? I tried to attatch a file for example, but it seems .azw can't be uploaded? Perhaps I could send a PM with an attachment to someone?

Thanks in advance!!

~Rach
RachDvn is offline   Reply With Quote
Old 01-16-2011, 07:19 AM   #2
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Preprocess doesn't work on mobi right now, but that should be coming soon. By itself it won't create a TOC anyway.

What you need is to look at the actual html of the mobi file using the debug output. In the conversion options specify a temp directory to send debug output to. Then run a conversion, this will populate that directory with a bunch of files, one of which will be the main file you need for figuring this out.

The file will be in the 'structure' folder, and it will be a large html file, the name may change based on the book - when you view this in a browser you'll see the raw text of your entire book. Open the file in a text editor, and find a chapter heading.

At this point it gets a bit more complicated, but your welcome to come back here for help. Once you've found the chapter heading you need to figure out what is unique about it, and then write an Xpath to use in the structure detection panel of the conversion options.

If Xpath is way over your head, just copy a few lines of text - a dozen or so above, below, and including the chapter heading, and paste that into a code block here. We should be able to help you with the xpath then.

Last edited by ldolse; 01-16-2011 at 07:33 AM.
ldolse is offline   Reply With Quote
Old 01-16-2011, 09:26 AM   #3
RachDvn
Member
RachDvn has a complete set of Star Wars action figures.RachDvn has a complete set of Star Wars action figures.RachDvn has a complete set of Star Wars action figures.RachDvn has a complete set of Star Wars action figures.
 
RachDvn's Avatar
 
Posts: 24
Karma: 322
Join Date: Jan 2011
Device: Kindle
Thanks Idolse! I can work with html and xpath a bit, but I'm lost on this one. Here's what surrounds a typical "chapter":

<p class="calibre_33"><font size="4"><span class="italic"><span class="bold">Chapter 2</span></span></font></p><p class="calibre_31">

Not too sure what to do with that...?

I've also used a program called fanfictiondownloader to create a mobi of this same story, pulling it direct from the site where the material is hosted rather than the azw created from my friends doc. In this case, the chapters ARE being detected and creating pagebreaks. The code surrounding those "chapter's" are:

<p class="calibre11"><span class="calibre5"><span class="bold">Chapter 2</span></span></p><p class="calibre11"><span class="italic">

Also, are you saying that you cannot create a TOC in an azw to mobi conversion?

I really appreciate the time and help!
~Rach
RachDvn is offline   Reply With Quote
Old 01-16-2011, 09:53 AM   #4
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Try giving this xpath a shot:
Code:
//*[((name()='span' or name()='h2') and re:test(., 'chapter|book|section|part\s+', 'i') and (@class = 'bold')) ]
If that doesn't work, the alternate approach is a bit convoluted. Convert from azw to epub using the following steps:
1. Enable the preprocess option under structure detection
2. Under epub output, change 'split files larger than' to 3048 (or larger if you book is really big)
3. Convert
4. rename the resulting epub from 'bookname.epub' to 'bookname.zip'
5. Edit the book metadata, formats etc in the edit book window
6. Add the bookname.zip file as a new format type
7. Now convert from zip to mobi, enable preprocess under structure detection - with the types of chapters you have the TOC should be automatically created.
ldolse is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Old Thread] calibre detects chapters, doesn't add to TOC Corey.Langner Calibre 17 09-25-2011 07:22 PM
How do I create chapters without a page-break between? bfollowell Sigil 22 01-02-2011 12:38 PM
Detecting Chapters in PDF -> ePub conversion jUgGsY Calibre 2 07-15-2010 04:53 AM
TOC not identifying all chapters shilpa Calibre 6 08-05-2009 11:29 AM
Detecting chapters Tibor Calibre 4 01-17-2009 01:25 PM


All times are GMT -4. The time now is 12:22 PM.


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