![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,459
Karma: 68781975
Join Date: Oct 2012
Location: Arkansas
Device: Paperwhite 4
|
Table of Contents...adding or fixing it
I don't know anything about XML and only the barest basics of HTML. I'm an old guy and I'm hoping I don't have to learn them to do what I want. Learning doesn't come easy these days.
Anyway I keep running into books without a table of contents or with a table of contents that doesn't contain links. I've used the setting in the conversion force a table of contents to be created and that often takes care of it, but sometimes it doesn't. I used Edit Book on an epub file and found in the file for each chapter the word "Chapter" in a book that had no table of contents. I manually added a number at the end of the line, but within the quotes with the word "Chapter", in each file. That seemed to fix it. It's a lot of work but chapters are important to me so it was worthwhile. I've run into 2 or 3 others since then with problems that aren't solved so easily. For example, a file with this just before the text in each file: <p class="MsoNormal1"></p></span>* <p class="MsoNormal1">*</p> <p class="MsoNormal">Chapter One</p> <p class="MsoNormal">Danny</p> followed by another <p </p> that has the text of the chapter. This shows up as a table of contents but there are no links. I found a file called content.opf that seems to list the files and another file called toc.ncx that I'm guessing is some sort of index but maybe not. I have no idea what any of this means. I realize that the correct solution to my dilemma is to learn xml, more HTML and the format of epub books. I'm a retired programmer, retired almost 2 decades ago, and when I was younger I'd have had no patience with a question like this but I'm asking anyway. What the heck do I do? I don't mind doing the work and I have enough technical background that I'm not afraid to dig a bit but I really don't know what I'm looking at with this stuff. Any suggestions will be appreciated. Barry |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Me, I REGEX those into a Heading Type (H3), then use the TOC tool:generate from Major Headings.
Beats typing in the titles, if you use 'from files' YMMV |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,459
Karma: 68781975
Join Date: Oct 2012
Location: Arkansas
Device: Paperwhite 4
|
Quote:
Frankly I didn't understand much of what you said so I just jumped into Calibre and tried to match it with things I could find there. In the editor I found the TOC tool, which I hadn't known about. I played a bit with that and sure enough, I was able to make it work for me. So I guess you've solved my problem, for which I thank you. I still have no idea what you're talking about though. ![]() Anyway you got me going in the right direction and I think I can figure it out from here. Barry |
|
![]() |
![]() |
![]() |
#4 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Barrym
I use the REGEX to find the chapter number/title string your case <p class="MsoNormal">Chapter One</p> Code:
<p class="MsoNormal">(Chapter .+?)</p> Code:
<h3 class="chapno">\1</h3> Create TOC from major Headings will use those H3's My general rules h1 for the odd times the Books title does not land on a h2 or h3 (I don't usually want a fully nested TOC at the books title level) h2 for Parts/Books/Stories(anthologies) h3 for Chapters (or on same level) Last edited by theducks; 07-17-2015 at 09:12 PM. Reason: Missing ( |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,459
Karma: 68781975
Join Date: Oct 2012
Location: Arkansas
Device: Paperwhite 4
|
Again, thanks. I'll copy that answer into a text file and study it and see what I can come up with.
By the way, I noticed that the file names in the editor are listed as text/part0000_split_000.html, with the final 4 0's before the extension being incremented with each file. The rest of the name doesn't change. Chapter 1 begins with part0000_split_003.html. Would I be wise to rename these in some way to make it easier for me to make the TOC without error, or is this something I should just leave alone? As for your giving tips, keywords, etc. and not doing the work for me, I appreciate that. This is probably more useful for me since I'll be doing this with other problem books down the road. If I have to figure out the details for myself it'll become easier in the future. Barry |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,459
Karma: 68781975
Join Date: Oct 2012
Location: Arkansas
Device: Paperwhite 4
|
I understand and I agree. I've always been one to dig in and learn the basics and now that's gotten difficult for me. So I'm cheating; getting just the information I need to do what I'm trying to do and not learn the why and how.
I'm a retired programmer. I began in the late 60's and early 70's, mostly as a systems programmer, writing drivers and patches and low level tools and occasionally applications. I stayed on that level till I retired nearly 20 years ago. Now I find it difficult to handle that sort of detail and new things come to me very slowly so this is how I can do it. The saving grace is that I don't have to do it now. I just enjoy fiddling from time to time. Barry |
![]() |
![]() |
![]() |
#8 | |
Age improves with wine.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 571
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
Quote:
I usually do this to make it easy to find which file to look at for a particular chapter while editing. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need help adding table of contents | ch13696 | Conversion | 6 | 05-08-2013 01:08 AM |
Fixing table of contents | emmett_brown | Conversion | 5 | 01-17-2013 03:52 AM |
Fixing a manual Table of Contents | Tango Mike | Sigil | 19 | 12-17-2011 05:48 PM |
adding table of contents to html files | jfs999 | Conversion | 2 | 09-30-2011 02:25 PM |
Adding Table of Contents | denmarks | Conversion | 4 | 08-14-2011 10:54 PM |