Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 12-05-2011, 01:00 PM   #1
mimosawind
Member
mimosawind began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Sep 2011
Device: none
Sample of the required TOC

Curious if anyone has a sample of what the TOC looks like.
Not the toc.ncx but rather, I believe it would be, the xhtml.

I am currently in the process of converting 15 ePubs to mobi format and am using Calibre to auto-create the TOC required. I'd like to know what exactly it looks like on the back end so I don't have to go through Calibre/I can edit it as need be without having to redo everything prior to using Kindle Previewer to convert to mobi.

Make sense? Any questions - let me know.
I've been a bit scattered recently (my dad is in the hospital) so things I think make perfect sense don't!

Thanks!
mimosawind is offline   Reply With Quote
Old 12-05-2011, 01:35 PM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,568
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
It's just a collection of links to different anchor points in the (x)html document(s).
Code:
<h3>Contents</h3>

<a href="../Text/book.html#chap001">Chapter One</a>
<a href="../Text/book.html#chap002">Chapter Two</a>
<a href="../Text/acknowledgements.html">Acknowledgements</a>
.
.
.
etc.
And the anchors in the document (if you don't have separate documents for each TOC entry) would be something along the lines of:
Code:
<a id="chap001"></a>
or
Code:
<h3 id="chap002">Chapter Two</h3>
DiapDealer is offline   Reply With Quote
Advert
Old 12-05-2011, 03:20 PM   #3
mimosawind
Member
mimosawind began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Sep 2011
Device: none
Thanks DiapDealer!
I figured it was something like that and tried something along those lines, but it never turned out properly for me.
mimosawind is offline   Reply With Quote
Old 12-13-2011, 09:46 AM   #4
Boris4Perl
Junior Member
Boris4Perl began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Nov 2011
Device: none
internal links as toc?

Hello,

I'm searching this forums and the internet since quite a while now. My knowledge seems to increase... but I just keep on failing on the device with my tests

I think this thread here is appropriate for my question.

I am writing Perl-Code that generates mobi-files from scratch... well actually I'm using mobiperl's libraries for the most of the part. Until now I could solve most problems, everything is working fine... images and html are handled well. But I keep one failing including a table of content (TOC).

This Thread tells me, that there is a simple and a complex solution... since I'm doing it from scratch I would want to give the simple solution a try...
As far as I understand, the simple way of creating a TOC is to implement it with links and anchors. But if I try doing so, it's not working.

Ok, instead of talking more, I first show an example of how I think it should work. This is an example of HTML-data which is displaying fine on Kindle, apart that the TOC is working:

Code:
<body>
<a id="TOC"></a>
<h1>Table of Content</h1>
<p><a href="#start">Foreword</a></p>
<p><a href="#chap1">Chapter One</a></p>
<p><a href="#chap2">Chapter Two</a></p>
<mbp:pagebreak />
<a id="start"></a>
<h1>Foreword</h1>
<p>Some Text and a <a href="http://www.perl.org">hyperlink</a>.</p>
<mbp:pagebreak />
<a id="chap1"></a>
<h1>Chapter One</h1>
<p>Some Text...</p>
<mbp:pagebreak />
<a id="chap2"></a>
<h1>Chapter Two</h1>
<p>The end!</p>
</body>
(Here is the code rendered through browser as png -> Pic

The only difference to the post above is, that I don't use any path in the link, I just say "#ref" instead of "path#ref". But as far as I know I am storing all the content just in one block into the mobi file, and this data has nothing that I could call a "filename"... or does it?

If you test this example HTML code in a bowser it works very well. If I test it on the Linux-eBook-Reader "fbreader" it works well enough. But if I try it on Amazon-Kindle it doesn't work. When I move the cursor over the TOC-entries, nothing happens at all (if you do the same with a hyperlink the cursor changes to a hand-symbol).

So here comes my final question: Is my approach completely going into the wrong direction or is there just a small bug to fix which I I'm just blind for?

Thank you very much for any help.
Boris4Perl is offline   Reply With Quote
Old 12-16-2011, 11:38 AM   #5
Boris4Perl
Junior Member
Boris4Perl began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Nov 2011
Device: none
How a TOC in HTML looks inside the Mobi binary file...

Ok, I found "a solution" myself...
No idea if it is how it "should" be, but it works on my kindle.
This is ONLY useful if you are working with mobi-binary files directly! (So this is just for "coders")
This does not help you with any kind of generator-software.
I post my solution here, because I haven't found this at all at the internet.
I discovered this myself with the help of calibre, hexdump and a lot of try and error!

Here you go:
Code:
<html>
<head>
<guide>
<reference type="toc" title="Table of Contents" filepos="000114"/></guide>  
</head>
<body>
<h1>Table of Content</h1>
<p><a filepos="000284">Foreword</a></p>
<p><a filepos="000521">Chapter One</a></p>
<p><a filepos="000758">Chapter Two</a></p>
<mbp:pagebreak />
<h1>START</h1>
<p>000 0000 some text 0000 000000000 000000000</p>
<p>000 000000000 000000000 000000000 000000000</p>
<p>000 000000000 000000000 000000000 000000000</p>
<p>000 000000000 000000000 000000000 000000000</p>
<mbp:pagebreak />
<h1>Chap1</h1>
<p>111 1111 some text 1111 111111111 111111111</p>
<p>111 111111111 111111111 111111111 111111111</p>
<p>111 111111111 111111111 111111111 111111111</p>
<p>111 111111111 111111111 111111111 111111111</p>
<mbp:pagebreak />
<h1>Chap2</h1>
<p>222 2222 some text 2222 222222222 222222222</p>
<p>222 222222222 222222222 222222222 222222222</p>
<p>222 222222222 222222222 222222222 222222222</p>
<p>222 222222222 222222222 222222222 222222222</p>
</body>
</html>
So inside of the mobi-format there are no more <a href="#bla" /> and stuff... its all made trough "filepos".. and the number is the number of the char in the html file where you want to jump to...

Hope this helps somebody...
Boris4Perl is offline   Reply With Quote
Advert
Old 12-16-2011, 11:49 AM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,240
Karma: 129333566
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
I don't see this helping anyone (IMHO). You make the source like you would any other HTML file and left Calibre, Mobipocket Creator, or Kindlegen handle sorting it all out. And it does. Why use is knowing how the Mobipocket binary file looks (for the ToC) of any use to us?
JSWolf is offline   Reply With Quote
Old 12-16-2011, 04:03 PM   #7
Boris4Perl
Junior Member
Boris4Perl began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Nov 2011
Device: none
Lightbulb

Well... it was of use for me...
I was looking for help in this forums, since this seems to be the only place where there might be a chance of getting answers for such questions. It might happen that somebody else needs to know the same as I did? Is there anything nastier then finding only questions without answers when searching? That is why I post the answer

I needed to know this because I'm automating some tasks (transforming POD to Mobi), and I was asked to code them properly in one language (namely Perl). Thanks to mobiperl, I was able to create mobifiles very soon. But since I have no tool like Calibre or so (Calibre is not Perl) that does everything for me, I need to code it myself. So that is the reason.

Deeper knowledge is always good, isn't it?
Developers of tools for example need to know such things...

Hope I don't offend anybody by posting knowledge here, which I could not find anywhere else?
Regards
Boris4Perl is offline   Reply With Quote
Old 12-16-2011, 04:58 PM   #8
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,568
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Boris 4Perl
Hope I don't offend anybody by posting knowledge here, which I could not find anywhere else?
You absolutely didn't offend anyone. And feel free to post any further discoveries that you feel like sharing, as well.
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Generated TOC links back to TOC page in the book Caleb666 Sigil 7 08-17-2011 11:58 AM
Light Required Hughdal Which one should I buy? 51 06-19-2011 02:43 PM
Password Required Too Often? jangell2 Feedback 6 05-08-2011 11:02 AM
Making a TOC for LRFs? Issues with Calibre + LRF TOC editor not working Magitek LRF 0 05-06-2009 01:25 PM


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


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