Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-27-2020, 10:56 AM   #1
hymie
Enthusiast
hymie began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Oct 2011
Device: iPhone
Create and use my Table of Contents

So let's say I use ebook-convert to convert a bunch of HTML files into an EPUB, and let's say the Table of Contents isn't correct. So I use ebook-edit to fix the TOC the way I want it, and I can capture my toc.ncx file.

Next time I use ebook-convert, how can I say "There is a file toc.ncx . Use it as the TOC" ?
hymie is offline   Reply With Quote
Old 03-27-2020, 12:13 PM   #2
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,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
it will do it automatically when you convert an epub with an ncx
kovidgoyal is offline   Reply With Quote
Old 03-27-2020, 12:53 PM   #3
hymie
Enthusiast
hymie began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Oct 2011
Device: iPhone
Quote:
Originally Posted by kovidgoyal View Post
it will do it automatically when you convert an epub with an ncx
It isn't. If it were doing it automatically, then I wouldn't be here asking the question.


Quote:
$ ebook-convert index_top.htm spacetechnology.epub \
--cover=pics/logo-750x250.jpg --preserve-cover-aspect-ratio
[...]
Merging user specified metadata...
Detecting structure...
Maximum TOC links reached, stopping.
Auto generated TOC with 50 entries.
hymie is offline   Reply With Quote
Old 03-27-2020, 03:06 PM   #4
ps67
Guru
ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.ps67 ought to be getting tired of karma fortunes by now.
 
Posts: 731
Karma: 7000000
Join Date: Aug 2017
Location: Italy
Device: Kindle Paperwhite, Kobo Elipsa, Pocketbook Color PB633, Inkpad Color
Quote:
Originally Posted by hymie View Post
It isn't. If it were doing it automatically, then I wouldn't be here asking the question.
You can enhance the Maximum TOC links in the conversion settings, at the voice "Table of Contents" (My calibre is in Italian so I am not sure about the exact English terminology)
ps67 is offline   Reply With Quote
Old 03-27-2020, 07:25 PM   #5
hymie
Enthusiast
hymie began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Oct 2011
Device: iPhone
Quote:
Originally Posted by ps67 View Post
You can enhance the Maximum TOC links in the conversion settings, at the voice "Table of Contents" (My calibre is in Italian so I am not sure about the exact English terminology)
I don't want it to generate a TOC at all. I want it to use the existing toc.ncx file.
hymie is offline   Reply With Quote
Old 03-27-2020, 08:01 PM   #6
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,393
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by hymie View Post
I don't want it to generate a TOC at all. I want it to use the existing toc.ncx file.
From your orignal post, it seems you want to use an external file to be used to replace the toc.ncx in the epub when converting an epub to epub. At best a horrible idea and likely to lead to having to rebuild the toc.ncx file. If nothing else, can you guarantee after conversion, that you will have the same number of text files with the same file names? And the "chapter names" will be the same?
DNSB is offline   Reply With Quote
Old 03-27-2020, 08:18 PM   #7
hymie
Enthusiast
hymie began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Oct 2011
Device: iPhone
Quote:
Originally Posted by DNSB View Post
From your orignal post, it seems you want to use an external file to be used to replace the toc.ncx in the epub when converting an epub to epub.
I use ebook-convert to convert a bunch of HTML files into an EPUB,
hymie is offline   Reply With Quote
Old 03-27-2020, 11:06 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: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I said when you convert *EPUB*.

ncx files are meaningless when you convert HTML. If you really want to convert a collection of HTML files, then make an OPF file that refers to them and convert that. The OPF file can also refer to an NCX in the usual way, though I dont recall if the HTML input plugin will actually use that or not. Probably will.
kovidgoyal is offline   Reply With Quote
Old 03-28-2020, 07:42 PM   #9
hymie
Enthusiast
hymie began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Oct 2011
Device: iPhone
Quote:
Originally Posted by kovidgoyal View Post
I said when you convert *EPUB*.
So you're answering the question you want to answer, and not the question I asked.

Quote:
Originally Posted by kovidgoyal View Post
ncx files are meaningless when you convert HTML. If you really want to convert a collection of HTML files, then make an OPF file that refers to them and convert that. The OPF file can also refer to an NCX in the usual way, though I dont recall if the HTML input plugin will actually use that or not. Probably will.
OK. I don't know what an OPF file is, but I see there is one in my EPUB. I'll see if I can figure out how to work that into my goals.
hymie is offline   Reply With Quote
Old 03-28-2020, 10:51 PM   #10
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,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by hymie View Post
So you're answering the question you want to answer, and not the question I asked.

So sorry I'll refrain from answering any of your questions in the future, better things to do with my time.
kovidgoyal is offline   Reply With Quote
Old 03-29-2020, 02:37 AM   #11
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,393
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by DNSB View Post
From your orignal post, it seems you want to use an external file to be used to replace the toc.ncx in the epub when converting an epub to epub.
Quote:
Originally Posted by hymie View Post
I use ebook-convert to convert a bunch of HTML files into an EPUB,
And again, the toc.ncx is not a one size fits all solution.. It is specific to the epub in which it is embedded. As I said, unless you can guarantee that all the filenames and the number of files in the epub are identical, your toc.ncx is useless. For example, the code below is the toc.ncx file file from an edition of "The Beast That Shouted Love at the Heart of the World", a collection of Harlan Ellison stores. A valid toc.ncx for this epub and this one only. If nothing else, are you planning on generating a collection of epubs with the same identifiers?

Spoiler:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
<head>
    <meta content="urn:uuid:c277af8f-256f-4c97-afd2-5e8746cd3f89" name="dtb:uid"/>
<meta content="1" name="dtb:depth"/>
<meta content="0" name="dtb:totalPageCount"/>
<meta content="0" name="dtb:maxPageNumber"/>
</head>
<docTitle>
<text>The Beast That Shouted Love At the Heart of the World</text>
</docTitle>
<navMap>
<navPoint id="navpoint-1" playOrder="1">
<navLabel>
<text>Cover</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_cov.html"/>
</navPoint>
<navPoint id="navpoint-2" playOrder="2">
<navLabel>
<text>Title Page</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_tit01.html#tit01"/>
</navPoint>

<navPoint id="navpoint-3" playOrder="3">
<navLabel>
<text>THE BEAST THAT SHOUTED LOVE AT THE HEART OF THE WORLD</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_fm1.html#fm1"/>
</navPoint>
<navPoint id="navpoint-4" playOrder="4">
<navLabel>
<text>Dedication</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ded01.html#ded01"/>
</navPoint>
<navPoint id="navpoint-5" playOrder="5">
<navLabel>
<text>Contents</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_con01.html#con01"/>
</navPoint>
<navPoint id="navpoint-6" playOrder="6">
<navLabel>
<text>FORWORD</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_fm01.html#fm01"/>
</navPoint>
<navPoint id="navpoint-7" playOrder="7">
<navLabel>
<text>INTRODUCTION</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_fm02.html#fm02"/>
</navPoint>
<navPoint id="navpoint-8" playOrder="8">
<navLabel>
<text>THE BEAST THAT SHOUTED LOVE AT THE HEART OF THE WORLD</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch01.html#ch01"/>
</navPoint>
<navPoint id="navpoint-9" playOrder="9">
<navLabel>
<text>ALONG THE SCENIC ROUTE</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch02.html#ch02"/>
</navPoint>
<navPoint id="navpoint-10" playOrder="10">
<navLabel>
<text>PHOENIX</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch03.html#ch03"/>
</navPoint>
<navPoint id="navpoint-11" playOrder="11">
<navLabel>
<text>ASLEEP: WITH STILL HANDS</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch04.html#ch04"/>
</navPoint>
<navPoint id="navpoint-12" playOrder="12">
<navLabel>
<text>SANTA CLAUS VS. S.P.I.D.E.R.</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch05.html#ch05"/>
</navPoint>
<navPoint id="navpoint-13" playOrder="13">
<navLabel>
<text>TRY A DULL KNIFE</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch06.html#ch06"/>
</navPoint>
<navPoint id="navpoint-14" playOrder="14">
<navLabel>
<text>THE PITLL PAWOB DIVISION</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch07.html#ch07"/>
</navPoint>
<navPoint id="navpoint-15" playOrder="15">
<navLabel>
<text>THE PLACE WITH NO NAME</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch08.html#ch08"/>
</navPoint>
<navPoint id="navpoint-16" playOrder="16">
<navLabel>
<text>WHITE ON WHITE</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch09.html#ch09"/>
</navPoint>
<navPoint id="navpoint-17" playOrder="17">
<navLabel>
<text>RUN FOR THE STARS</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch10.html#ch10"/>
</navPoint>
<navPoint id="navpoint-18" playOrder="18">
<navLabel>
<text>ARE YOU LISTENING?</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch11.html#ch11"/>
</navPoint>
<navPoint id="navpoint-19" playOrder="19">
<navLabel>
<text>S.R.O.</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch12.html#ch12"/>
</navPoint>
<navPoint id="navpoint-20" playOrder="20">
<navLabel>
<text>WORLDS TO KILL</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch13.html#ch13"/>
</navPoint>
<navPoint id="navpoint-21" playOrder="21">
<navLabel>
<text>SHATTERED LIKE A GLASS GOBLIN</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch14.html#ch14"/>
</navPoint>
<navPoint id="navpoint-22" playOrder="22">
<navLabel>
<text>A BOY AND HIS DOG</text>
</navLabel>
<content src="Text/beastthatshoutedloveattheheartoftheworldthe_ch15.html#ch15"/>
</navPoint>
<navPoint id="navpoint-23" playOrder="23">
<navLabel>
<text>Copyright Page</text>
</navLabel>
<content src="Text/backmatter.html"/>
</navPoint>
</navMap>
</ncx>


Anyhow, I'm outta here.

To argue with a man who has renounced the use and authority of reason is like administering medicine to the dead, or endeavoring to convert an atheist by scripture.” —Thomas Paine, The American Crisis
DNSB is offline   Reply With Quote
Old 03-29-2020, 05:14 PM   #12
hymie
Enthusiast
hymie began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Oct 2011
Device: iPhone
Quote:
Originally Posted by DNSB View Post
As I said, unless you can guarantee that all the filenames and the number of files in the epub are identical, your toc.ncx is useless.
I'm completely confused by what you're trying to say here.

If I take five HTML files and generate an EPUB, the EPUB will have a Table of Contents and a toc.ncx. If I take the same five HTML files and re-generate the EPUB, why wouldn't I expect the TOC be the same?
hymie is offline   Reply With Quote
Old 03-29-2020, 07:01 PM   #13
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,393
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by hymie View Post
I'm completely confused by what you're trying to say here.

If I take five HTML files and generate an EPUB, the EPUB will have a Table of Contents and a toc.ncx. If I take the same five HTML files and re-generate the EPUB, why wouldn't I expect the TOC be the same?
You did not say you were converting the same 5 files over and over. I will admit that that is a rather strange work flow and I have to wonder why anyone would do so. You've already converted the HTML files to epub so why not edit the epub using calibre's editor?

To quote your original post:
Quote:
Next time I use ebook-convert, how can I say "There is a file toc.ncx . Use it as the TOC" ?
This reads as if you were planning on re-using the same toc.ncx file for multiple conversions. Toc.ncx is not a generic file and should not be re-used. The displayed TOC may look the same but the toc.ncx file will not be the same.

You might want to take the time to look at the documentation. Here's a link to the Open Packaging Format (OPF) 2.0.1 v1.0.1 Section 2.4.1.2 as a starter.

Last edited by DNSB; 03-29-2020 at 07:08 PM.
DNSB is offline   Reply With Quote
Old 03-29-2020, 11:30 PM   #14
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by hymie View Post
If I take five HTML files and generate an EPUB, the EPUB will have a Table of Contents and a toc.ncx. If I take the same five HTML files and re-generate the EPUB, why wouldn't I expect the TOC be the same?
The conversion generates the ToC from the book being converted. That is based on the files in the book and the contents of the files. This can build the ToC from the heading tags or class attributes or other things. The searches for each level can be specified in the conversion.

I rarely do conversions. But, when I edit a book, I make sure I can regenerate the ToC at any time and will get the desired result. I usually just use h1, h2 and h3 to do this. But, occasionally will use other tags if that is the best way to do it.

The only I can think of to use a prebuilt ToC is if the files are basically identical. And the simplest way I can think to use it would be to replace the ToC file after the conversion. But, I think that what I would really do is to make sure the input files and conversion parameters used would produce the result I desired.
davidfor is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I create subsections in Table of Contents SampleAndy Sigil 3 05-18-2017 05:42 PM
Can´t create an html table of contents on Sigil Danila Sigil 2 02-16-2017 03:29 PM
how to create Table of Contents? Small Elephant Amazon Kindle 2 11-17-2012 01:17 AM
Create a table of contents? RobLikesBrunch Amazon Kindle 13 03-09-2009 07:59 PM
Is there a way to create a table of contents for notes timezone iRex 0 08-03-2008 03:54 PM


All times are GMT -4. The time now is 06:20 PM.


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