12-12-2013, 03:53 PM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2013
Device: Kindle Fire
|
Internal Linking in a MOBI file (Coding Help Needed)
I am a software developer and have added a MOBI export feature to one of my applications. This has worked well so far, but I'm wanting to add an index at the beginning so the document will be easier to navigate.
I am doing all of the coding myself, and am not relying on external tools like Kindlegen, Mobicreator, or Calibre. So I am hoping someone here has low level knowledge of the MOBI file format. I am attaching a sample file (recipes.mobi) that I have exported from my application. The index shows up, but the links don't do anything when you click them? I am also attaching the source (recipes.htm) document. This uses simple HTML linking such as Code:
<a href="#recipe1">Recipe 1</a> Code:
<a id="recipe1" /> The links work fine in the HTM source (in a web browser). If I use KindleGen to encode the Recipes.htm source, the links do work correctly. But if I use Unkindle in Calibre to unpack the MOBI file, the HTM doesn't look much different than my original source. I'm clearly missing something in the MOBI encoding. Any ideas what I need to do to get the internal links to work? Thanks, Anthony Watson |
12-12-2013, 06:14 PM | #2 | |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi,
Kindle mobi is a compiled format. It is not like other formats. It takes significant work and preprocessing to actually properly create a mobi. KindleUnpack does its best to decompile the format back into something that can be passed back into Kindlegen. If you use KindleUnpack you need to ask for the raw text to be dumped as well (it is a command line option). That raw text will give you an idea of how the compilation step is done in part. Note mobi 7 and mobi 8 versions handle links differently. KevinH Quote:
|
|
Advert | |
|
12-12-2013, 07:06 PM | #3 |
Wizard
Posts: 2,251
Karma: 3720310
Join Date: Jan 2009
Location: USA
Device: Kindle, iPad (not used much for reading)
|
Why on earth would you reinvent the wheel by trying to write your own program to create mobi files? Just use Kindlegen or Mobipocket Creator, or Calibre. It takes a lot of work to create a .mobi file.
|
12-12-2013, 11:56 PM | #4 | |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2013
Device: Kindle Fire
|
Quote:
I already have basic MOBI exporting working fine. External links even work great. It is only the internal links that are not working correctly. Thanks, Anthony |
|
12-13-2013, 07:10 AM | #5 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi,
Again, use KindleUnpack raw text option to see how filepos (offsets into the text file) are used in mobi 7 and base 32 encoded numbers are used in Mobi 8. Hope this helps. KevinH |
Advert | |
|
12-17-2013, 11:02 AM | #6 | |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2013
Device: Kindle Fire
|
Quote:
Take care, Anthony |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Conversion from mobi (to mobi, or epub) breaks internal links | bounder | Conversion | 1 | 10-09-2012 11:56 AM |
Update Mobi header/file metadata without doing a Mobi to Mobi conversion | RecQuery | Conversion | 2 | 06-30-2012 11:43 AM |
PDF with internal hyperlinks to MOBI | wlloydw | Conversion | 3 | 02-23-2011 04:33 PM |
What file system should the internal memory be? | rahulm | Sony Reader | 1 | 06-14-2010 01:23 PM |
Internal Plucker linking | rsperberg | Reading and Management | 0 | 11-20-2005 08:22 AM |