Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-16-2015, 05:00 PM   #1
barryem
Wizard
barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.
 
barryem's Avatar
 
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
barryem is offline   Reply With Quote
Old 07-16-2015, 05:13 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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
theducks is offline   Reply With Quote
Advert
Old 07-17-2015, 11:36 AM   #3
barryem
Wizard
barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.
 
barryem's Avatar
 
Posts: 2,459
Karma: 68781975
Join Date: Oct 2012
Location: Arkansas
Device: Paperwhite 4
Quote:
Originally Posted by theducks View Post
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
I haven't used REGEX in many years. I guess I can figure that out. What do I turn into an H3?

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
barryem is offline   Reply With Quote
Old 07-17-2015, 12:18 PM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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>
(where chapno is my house stylesheet entry for chapter numbering)

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 (
theducks is offline   Reply With Quote
Old 07-17-2015, 08:01 PM   #5
barryem
Wizard
barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.
 
barryem's Avatar
 
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
barryem is offline   Reply With Quote
Advert
Old 07-17-2015, 09:16 PM   #6
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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:
Originally Posted by barryem View Post
Again, thanks. I'll copy that answer into a text file and study it and see what I can come up with. REVISIT my code, there was a missing ( sorry

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
My purpose of my sig is to point folk in the direction to LEARN the reasons for the codes. Like using crib sheets at school, did they learn or just pass the tests.
theducks is offline   Reply With Quote
Old 07-18-2015, 07:21 PM   #7
barryem
Wizard
barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.barryem ought to be getting tired of karma fortunes by now.
 
barryem's Avatar
 
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
barryem is offline   Reply With Quote
Old 08-23-2015, 10:27 AM   #8
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 571
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by barryem View Post
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?
If you select a bunch of files, you can just right-click and select "bulk rename". You need to supply a prefix for the file name (default is "Chapter-") and the number to start from, and all your files will be renamed (e.g. Chapter-1, Chapter-2, or if you are doing this to 10+ files, Chapter-01, Chapter-02 and so on). The extensions and directory structure will not be changed. All references to the files will be updated automatically to use the new names.

I usually do this to make it easy to find which file to look at for a particular chapter while editing.
Phssthpok is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 05:08 PM.


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