View Single Post
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