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 02-01-2009, 03:22 AM   #1
MacZap
Member
MacZap began at the beginning.
 
Posts: 11
Karma: 12
Join Date: Mar 2008
Device: iLiad, Cybook, Palm T|X, iPod Touch
Help on TOC creation

Hi all,

I've problem to understand ho to automatically create the Table of Contents with Calibre.
I wish to start from an OpenOffice .odt file, with chapter marked with standard styles Header 1, Header 2 and so on.
Then, i convert it to mobipocket o epub files (I don't use .lrf) but no TOC is created.

I tried to change the regular expression formula in Chapter detection option, but with no results.

How can I do it?

thanks

MZ
MacZap is offline   Reply With Quote
Old 02-01-2009, 05:22 AM   #2
mtravellerh
book creator
mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.mtravellerh ought to be getting tired of karma fortunes by now.
 
mtravellerh's Avatar
 
Posts: 9,635
Karma: 3856660
Join Date: Oct 2008
Location: Luxembourg
Device: PB360°
Could you post your RegEX expression, please (as zip or rar)?

There is a tool in OO to create a TOC, btw. You could use that and link the chapters to that TOC.

If you use Calibre, you can use Calibre to create a TOC with XPath (works largely like RegEx) You use a tag, class, or even recurring word to create those. Instructions can be found in the Calibre manual (online at Kovid's site)
mtravellerh is offline   Reply With Quote
Old 02-01-2009, 01:56 PM   #3
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: 43,780
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
unzip your epub file, look at the xhtml files in it. Identify what tags are used to mark headings.

Then read the XPath tutorial in the User Manual to figure out what XPath expression will match those tags
kovidgoyal is online now   Reply With Quote
Old 02-03-2009, 04:59 PM   #4
MacZap
Member
MacZap began at the beginning.
 
Posts: 11
Karma: 12
Join Date: Mar 2008
Device: iLiad, Cybook, Palm T|X, iPod Touch
ok, I start by uncompress and analyze a .odt file. The file that contains data is called content.xml. In this file are present the tags surrounding the styles.

The tag that identifies the chapter heading is:

<text:h text:style-name="Heading_20_1" textutline-level="1">
</text:h>

I wish to build a TOC (in Mobi or Epub files) by creating a Xpath expression that recognize these tags.

Unfortunately I'm not able to write a working expression.

Do you have some suggestion?

Thanks
MacZap is offline   Reply With Quote
Old 02-03-2009, 06:28 PM   #5
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
Quote:
Originally Posted by MacZap View Post
I wish to build a TOC (in Mobi or Epub files) by creating a Xpath expression that recognize these tags.
For formats like OpenOffice documents, calibre first converts the file to XHTML. Your XPath expression needs to be in terms of the XHTML calibre generates. To look at that XHTML and figure out the expression you need, create an EPUB file, then unzip it and look at the HTML it contains. (The EPUB container is just a ZIP file, so you can unzip it with the tool of our choice.)
llasram is offline   Reply With Quote
Old 02-03-2009, 06:37 PM   #6
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: 43,780
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by llasram View Post
For formats like OpenOffice documents, calibre first converts the file to XHTML. Your XPath expression needs to be in terms of the XHTML calibre generates. To look at that XHTML and figure out the expression you need, create an EPUB file, then unzip it and look at the HTML it contains. (The EPUB container is just a ZIP file, so you can unzip it with the tool of our choice.)
Or use the --extract-to option to any2epub
kovidgoyal is online now   Reply With Quote
Old 02-04-2009, 12:11 AM   #7
MacZap
Member
MacZap began at the beginning.
 
Posts: 11
Karma: 12
Join Date: Mar 2008
Device: iLiad, Cybook, Palm T|X, iPod Touch
Oh, my God! It's working... It's simplest that I figure...
Thanks for your support, now the mobi creation from OOo files is almost perfect!

Just one more question. What about ticket #1730 ? The mobi (and epub, too) files creation, ignoring the line and page breaks. Using other tools like Mobicreator, the page and line breaks are retained, but not with Calibre. This generate a less readeble mobi (and epub too) files.

Thanks again
MacZap is offline   Reply With Quote
Old 02-04-2009, 12:43 AM   #8
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
Quote:
Originally Posted by MacZap View Post
Just one more question. What about ticket #1730 ?
Mea culpa. Every time I start to take a look at it I get distracted by something else. I'll see if I can sort it out tonight.
llasram 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
TOC Creation Problem penguintri Calibre 8 10-06-2010 08:36 PM
TOC Creation & Calibre vs. MobiPocket Themus Calibre 8 05-15-2010 11:32 AM
TOC Creation - simplifying suggestion Fredom Calibre 1 04-21-2010 08:29 PM
Making a TOC for LRFs? Issues with Calibre + LRF TOC editor not working Magitek LRF 0 05-06-2009 01:25 PM
Chapter or TOC Creation help needed gandor62 Calibre 4 04-15-2009 02:18 PM


All times are GMT -4. The time now is 03:11 AM.


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