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 05-20-2010, 10:05 AM   #1
Corey.Langner
Junior Member
Corey.Langner began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
[Old Thread] calibre detects chapters, doesn't add to TOC

I have a .lit ebook that I want to convert to .mobi to read on my Kindle. The .lit ebook has 27 chapters, all of which show up in the TOC.

I have attempted to convert using both version 0.6.52 & 0.6.53 on Windows XP (service pack 3).

My .mobi output has "pagebreaks" and / or "rulers" at each chapter as would be expected. When I view the .mobi file, the chapters are perfectly detected.

I have looked at the four debug folders. calibre is correctly breaking the ebook into 28 distinct .htm files (named 000 throught 027). Each of these .htm files starts with <h1>Chapter X</h1> and contains the text of that chapter and that chapter only. The 000 .htm file appears to contain the TOC information.

However, I cannot get a TOC to generate to save my life. I have tried a number of combinations of xPath expressions in both the "Detect Chapters" box and the "Level 1 TOC" box.

I currently am using an xPath expression that says: //*[re:test(., "CHAPTER", "i")] for structure detection. I have tried copying that directly into the "Level 1 TOC" box with no success. I have tried //h:h1, and even //* but I cannot get it to create a TOC.

Any ideas?
Corey.Langner is offline   Reply With Quote
Old 05-20-2010, 10:25 AM   #2
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,786
Karma: 3973173
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"
Try setting your "Level 1 TOC" box to //h:h1
jackie_w is offline   Reply With Quote
Old 05-20-2010, 11:26 AM   #3
Corey.Langner
Junior Member
Corey.Langner began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
I had already tried that. I just tried it again and no luck.

Thanks.
Corey.Langner is offline   Reply With Quote
Old 05-20-2010, 01:09 PM   #4
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,931
Karma: 5036099
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
In MOBI files the tOC is in the metadata, not in the content of the book.
kovidgoyal is offline   Reply With Quote
Old 05-20-2010, 01:18 PM   #5
Corey.Langner
Junior Member
Corey.Langner began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
Ok. But, I cannot even get it to generate a TOC, wherever it resides.

I have never had a book that detects chapters correctly but won't generate TOC. That's where I am stuck.

Usually, if my xPath expressions won't detect chapters, I don't get a TOC. If I can detect chapters, the TOC has always been generated. Not this time.
Corey.Langner is offline   Reply With Quote
Old 05-20-2010, 03:50 PM   #6
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,786
Karma: 3973173
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"
Have you also tried ticking the "Force use of auto-generated TOC" on the [Convert]-[TOC} page? Just a thought.
jackie_w is offline   Reply With Quote
Old 05-20-2010, 04:23 PM   #7
Corey.Langner
Junior Member
Corey.Langner began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
Good thought. I just re-ran the conversion and it did the same thing.

I am at a loss.
Corey.Langner is offline   Reply With Quote
Old 05-20-2010, 04:33 PM   #8
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,931
Karma: 5036099
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
without either the original file or the conversion logs it's impossible to help you further
kovidgoyal is offline   Reply With Quote
Old 05-20-2010, 08:45 PM   #9
Corey.Langner
Junior Member
Corey.Langner began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
I would love some further help. I was hoping I simply was missing a setting or a technique.

I, however, have no idea how to provide the conversion logs.
Corey.Langner is offline   Reply With Quote
Old 05-20-2010, 09:13 PM   #10
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,786
Karma: 3973173
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"
Convert your file.

When it's finished, click on the Jobs box in the bottom right of the GUI.

Highlight the conversion job you've just run and click on the "Job Details" button.

Copy-paste the window contents here for someone more technical than me to have a look at.
jackie_w is offline   Reply With Quote
Old 05-20-2010, 09:26 PM   #11
Corey.Langner
Junior Member
Corey.Langner began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
Thanks jackie! I didn't know that information existed. Here is the first part of the conversion log.

Quote:
Convert book 1 of 1 (Book Name)
Resolved conversion options
{'asciiize': False,
'author_sort': None,
'authors': None,
'base_font_size': 16.0,
'book_producer': None,
'change_justification': u'original',
'chapter': u'//*[re:test(., "CHAPTER", "i")]',
'chapter_mark': u'pagebreak',
'comments': None,
'cover': 'c:\\docume~1\\brandi~1\\locals~1\\temp\\calibre_0 .6.53_cl6zkp.jpeg',
'debug_pipeline': None,
'disable_font_rescaling': False,
'dont_compress': False,
'extra_css': None,
'font_size_mapping': u'12.0, 12.0, 14.0, 16.0, 18.0, 20.0, 22.0, 24.0',
'footer_regex': u'(?i)(?<=<hr>)((\\s*<a name=\\d+></a>((<img.+?>)*<br>\\s*)?\\d+<br>\\s*.*?\\s*)|(\\s* <a name=\\d+></a>((<img.+?>)*<br>\\s*)?.*?<br>\\s*\\d+))(?=<br>)' ,
'header_regex': u'(?i)(?<=<hr>)((\\s*<a name=\\d+></a>((<img.+?>)*<br>\\s*)?\\d+<br>\\s*.*?\\s*)|(\\s* <a name=\\d+></a>((<img.+?>)*<br>\\s*)?.*?<br>\\s*\\d+))(?=<br>)' ,
'input_encoding': None,
'input_profile': <calibre.customize.profiles.InputProfile object at 0x02C1B470>,
'insert_blank_line': True,
'insert_metadata': False,
'isbn': None,
'language': None,
'level1_toc': u'//*[re:test(., "CHAPTER", "i")]',
'level2_toc': u'//h:h3',
'level3_toc': None,
'line_height': 0.0,
'linearize_tables': False,
'margin_bottom': 5.0,
'margin_left': 5.0,
'margin_right': 5.0,
'margin_top': 5.0,
'max_toc_links': 50,
'no_chapters_in_toc': False,
'no_inline_navbars': True,
'no_inline_toc': False,
'output_profile': <calibre.customize.profiles.KindleOutput object at 0x02C1B750>,
'page_breaks_before': u"//*[name()='h1' or name()='h2']",
'personal_doc': u'[PDOC]',
'prefer_author_sort': True,
'prefer_metadata_cover': False,
'preprocess_html': False,
'pretty_print': False,
'pubdate': None,
'publisher': None,
'rating': None,
'read_metadata_from_opf': 'c:\\docume~1\\my docs\\locals~1\\temp\\calibre_0.6.53_t5wy73.opf',
'remove_first_image': False,
'remove_footer': False,
'remove_header': False,
'remove_paragraph_spacing': True,
'remove_paragraph_spacing_indent_size': 1.0,
'rescale_images': False,
'series': None,
'series_index': None,
'tags': None,
'timestamp': None,
'title': None,
'title_sort': None,
'toc_filter': None,
'toc_threshold': 6,
'toc_title': None,
'use_auto_toc': False,
'verbose': 2}
InputFormatPlugin: LIT Input running
on C:\Documents and Settings\My Documents\calibre library\book name.lit
Parsing all content...
Parsing book name_023.htm ...
Parsing Book name_003.htm ...

Parsing stylesheet.css ...
Property: Unknown Property name. [36:5: mso-style-link]
Property: Invalid value for "CSS Level 2.1" property: 468 [62:5: height]
Property: Invalid value for "CSS Level 2.1" property: 293 [63:5: width]
Property: Unknown Property name. [91:5: mso-style-link]
Parsing contents.xhtml ...
Parsing manglecase.css ...

Reading TOC from HTML...
Merging user specified metadata...
Detecting structure...
Detected chapter: Book name@page { margin-bottom: 5.000000pt;
Failed to mark chapter
Traceback (most recent call last):
File "site-packages\calibre\ebooks\oeb\transforms\structure.p y", line 93, in detect_chapters
File "lxml.etree.pyx", line 673, in lxml.etree._Element.addprevious (src/lxml/lxml.etree.c:31716)
TypeError: Only processing instructions and comments can be siblings of the root element

Detected chapter: CHAPTER 1My name is
Detected chapter: CHAPTER 1
Detected chapter: book name@page { margin-bottom: 5.000000pt;
Failed to mark chapter
Traceback (most recent call last):
File "site-packages\calibre\ebooks\oeb\transforms\structure.p y", line 93, in detect_chapters
File "lxml.etree.pyx", line 673, in lxml.etree._Element.addprevious (src/lxml/lxml.etree.c:31716)
TypeError: Only processing instructions and comments can be siblings of the root element
That same information repeats 27 times followed by a bunch of
Quote:
Property: Unknown Property name. [2:13023: panose-1]
Then,

Quote:
Transformed CSS selector .MsoNormal to .msonormal
Transformed CSS selector .MsoTitleCxSpFirst to .msotitlecxspfirst
Transformed CSS selector .Section to .section
Serializing markup content...
Compressing markup content...
Generating flat CTOC ...
CNCX utilization: 1 record, 0% full
Indexing navPoints ...
Generating INDX ...
Serializing images...
MOBI output written to c:\docume~1\locals~1\temp\calibre_0.6.53_kcvyiv.mo bi

Last edited by Corey.Langner; 05-20-2010 at 09:30 PM.
Corey.Langner is offline   Reply With Quote
Old 05-20-2010, 10:26 PM   #12
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,931
Karma: 5036099
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Your clue are these lines

Failed to mark chapter
Traceback (most recent call last):
File "site-packages\calibre\ebooks\oeb\transforms\structure.p y", line 93, in detect_chapters
File "lxml.etree.pyx", line 673, in lxml.etree._Element.addprevious (src/lxml/lxml.etree.c:31716)
TypeError: Only processing instructions and comments can be siblings of the root element

they indicate that your file has very poor markup, look for something like content outside the <html> tags
kovidgoyal is offline   Reply With Quote
Old 05-21-2010, 05:58 PM   #13
Corey.Langner
Junior Member
Corey.Langner began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
Thanks. I guess I lack the stomach to dig into that.

I will convert to .rtf, let Word change the Chapter marks to <H3> style and then convert to .mobi.

Thanks again for all the help.
Corey.Langner is offline   Reply With Quote
Old 09-25-2011, 12:59 AM   #14
AlisaC
Junior Member
AlisaC began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2011
Device: Nook for PC
I'm having the same problem, and I didn't understand what you asked Corey Langner to do. What do you mean by "content outside html tags"? I've seen multiple questions about this and the answers are all so technical, I'm like, yeah, whatever. Maybe I'll click "no toc" ...

Thanks -- Alisa
AlisaC is offline   Reply With Quote
Old 09-25-2011, 01:55 AM   #15
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,838
Karma: 12535517
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Welcome to Mobileread.

Quote:
Originally Posted by AlisaC View Post
I'm having the same problem, and I didn't understand what you asked Corey Langner to do. What do you mean by "content outside html tags"? I've seen multiple questions about this and the answers are all so technical, I'm like, yeah, whatever. Maybe I'll click "no toc" ...

Thanks -- Alisa
Since this thread is over a year old and 50+ versions out of date it is hard to know what your problem is in relation to this thread.

Start by reading this sticky post and if you still need help create a new thread and outline exactly what trouble you are having.
DoctorOhh 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
Unnamed chapters in toc AlisaC Calibre 0 09-24-2011 11:30 PM
TOC Chapters taraboom11 Calibre 4 03-03-2011 08:10 PM
Text to HTML (or any e-book format, really) program that detects chapters? JeremyR Workshop 11 02-10-2011 09:29 PM
azw to mobi: Not detecting chapters/page break at chapters and no TOC RachDvn Calibre 3 01-16-2011 09:53 AM
TOC not identifying all chapters shilpa Calibre 6 08-05-2009 11:29 AM


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


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