|
|
View Full Version : "Start Reading" link in mobipocket
Jellby 09-14-2008, 11:10 AM Hi all,
Has anyone found out how the "Start Reading" link in mobipocket files is generated?
I know how to add items in the "guide", but if I add a "Start Reading" link there, it would be duplicated (i.e., there would be still another automatically generated "Start Reading").
I thought I could just add an anchor named "start_reading" wherever I want the "Start Reading" link to point to, as this seemed to work in some files, but now I've found it does not work in another file. Here I have a toc, then some text, then the first chapter, I wanted "Start Reading" to point to the beginning of the "some text", but it pointed to the beginning of the first chapter instead. I think that maybe the "Start Reading" is made to point to the first anchor that is also linked to in the text... or something like that.
Any other ideas/experiences?
(I think this "Start Reading" think is particular to the Cybook, at least I don't seem to find it in the desktop mobipocket reader).
tompe 09-14-2008, 12:47 PM Isn't the guide pointer just a filepos?
How did you generate the guide? I though I played around with this in MobiPerl but now I cannot fint it in the code...
HarryT 09-14-2008, 12:55 PM The "Start Reading" link is a guide item with a type of "other.ms-firstpage", whose value is simply an HTML anchor in the text.
Jellby 09-14-2008, 01:01 PM Isn't the guide pointer just a filepos?
How did you generate the guide? I though I played around with this in MobiPerl but now I cannot fint it in the code...
To generate the guide, I just included this in the HTML <HEAD>:
<guide>
<reference type="toc" title="Contents" href="#contents"></reference>
<reference type="text" title="Part One" href="#part1"></reference>
<reference type="text" title="Part Two" href="#part2"></reference>
</guide>
Then the "Go to" menu in the Cybook includes "Contents", "Part One" and "Part Two", but also a "Start Reading" item that I did not create.
HarryT 09-14-2008, 01:09 PM Try adding:
<reference type="other.ms-firstpage" title="Start Reading" href="#whatever"></reference>
and see what that does for you.
Jellby 09-14-2008, 01:13 PM The "Start Reading" link is a guide item with a type of "other.ms-firstpage", whose value is simply an HTML anchor in the text.
But it didn't work in my case (well, see next message)... What apparently did work was including a link to this "some text" in the TOC.
So, if the TOC is:
Chapter 1
Chapter 2
...
then "Start Reading" points to Chapter 1.
If the TOC is:
(Preface)
Chapter 1
Chapter 2
...
then "Start Reading" points to the (Preface). Note that the rest of the book is identical in both cases, what I called "(Preface)" is actually some text with no title, previous to Chapter 1, and there is an anchor at the beginning anyway.
HarryT 09-14-2008, 01:15 PM How very strange. It works fine for me, but I maintain the OPF file with Mobi Creator, rather than writing it by hand. I wonder if Mobi Creator is doing something else to the OPF file?
Jellby 09-14-2008, 01:22 PM Try adding:
<reference type="other.ms-firstpage" title="Start Reading" href="#whatever"></reference>
and see what that does for you.
I did, and I get a duplicated "Start Reading" entry. The worst thing is that one of them (the one automatically created by the Cybook) is translated if I change the UI language, but not the other (the guide one). In this case, both links point to the same (correct) point in the text, I think that is because adding the guide item, also added a valid "link" to the anchor, so that the automatic "Start Reading" recognized it as a valid first element... I hope I made myself clear.
When I said it didn't work, I was trying the <reference> with no "title"...
Edit: However, if I make the "Start Reading" guide item point to Chapter 2, then both entries actually point to Chapter 2... So maybe the logic of "first linked anchor" is only valid if there is no "other.ms-firstpage" guide item...
Jellby 09-14-2008, 01:53 PM To make testing easier, here is a simple file:
<html>
<head>
<guide>
<reference type="toc" title="Contents" href="#contents"></reference>
</guide>
</head>
<body>
<a name="contents"/>
<h1>CONTENTS</h1>
<a href="#chapter1">Chapter 1</a><br/>
<a href="#chapter2">Chapter 2</a><br/>
<mbp:pagebreak/>
<a name="preface"/>
<p>This is some text before the first chapter.</p>
<mbp:pagebreak/>
<a name="chapter1"/>
<h1>CHAPTER 1</h1>
<p>This is the first chapter.</p>
<mbp:pagebreak/>
<a name="chapter2"/>
<h1>CHAPTER 2</h1>
<p>This is the second chapter.</p>
</body>
</html>
If I've not made any error (I haven't yet tried with this file), if this is converted to mobipocket with html2mobi and then opened in the Cybook, the "Start Reading" menu entry will point to #chapter1.
If I want it to point to #preface, I have either to add a new guide entry with a title (which will not be affected by UI language), or add a link to it in the toc:
<reference type="other.ms-firstpage" title="Start Reading" href="#preface"></reference>
or
<h1>CONTENTS</h1>
<a href="#preface"/>
<a href="#chapter1">Chapter 1</a><br/>
<a href="#chapter2">Chapter 2</a><br/>
Note that this last option, with an empty link, actually seems to work, and when browsing the links in the toc with the up/down keys this "phantom" link is ignored. So, I think for the moment this is the best solution.
But if I want the "Start Reading" entry to point to "#chapter2", I think the only solution is adding a guide item... but I would probably add it with blank title:
<reference type="other.ms-firstpage" title="" href="#preface"></reference>
Does this make any sense?
HarryT 09-14-2008, 01:53 PM I get the duplicated "Start Reading" item too on the Gen3 - that seems to be a quirk of that device. On the Windows Desktop version of the Mobi Reader I only get the one "Start Reading" menu item. You can set the text to be anything you want - it's the "other.ms-firstpage" that actually creates the menu item. I think we're seeing the same behaviour.
Jellby 09-14-2008, 02:09 PM I get the duplicated "Start Reading" item too on the Gen3 - that seems to be a quirk of that device. On the Windows Desktop version of the Mobi Reader I only get the one "Start Reading" menu item. You can set the text to be anything you want - it's the "other.ms-firstpage" that actually creates the menu item. I think we're seeing the same behaviour.
Yes, I can set the text to whatever I want... but I don't want to set it to anything :D
I mean, the Cybook already shows a "Start Reading" entry with English interface, which becomes "Comenzar Lectura" in Spanish, "Débuter la Lecture" in French, etc. If I create a new one called "Start Reading", it will always be "Start Reading". I only want to change the target of the default "Start Reading"/"Comenzar Lectura" entry, not create a new one.
I know I'm a nitpicker, though.
comtrjl 09-14-2008, 02:45 PM The Mobi Dev Centre has just these few lines:
start: if the "start" type of subitem is present, the action defined in the onclick is performed whenever the ebook is opened. Use this in dictionaries to make the dictionary open on the first page every time instead of the last page read. The last page read is not very useful in a dictionary.
<guide> <reference type="start" title="Start here" href="starthere.html"/> </guide>
Doesn't look like it is always present, nor that it can't be made to point anywhere desired.
bob
tompe 09-14-2008, 03:21 PM You can always unpack the mobi file to raw html (--rawhtml) and see what the filepos pointers are to confirm that html2mobi do the correct thing.
wallcraft 09-14-2008, 03:55 PM The Mobi Dev Centre has just these few lines:
start: if the "start" type of subitem is present, the action defined in the onclick is performed whenever the ebook is opened. This is a different guide item than the one discussed here. In particular "start" over-rides the last page read, which isn't typically what you want.
|