08-06-2011, 08:23 PM | #1 |
Addict
Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
|
What does the filepos parameter do in an href?
I found a few books in my library in which the TOC (table of contents) is off by exactly one chapter in every selection, so I am manually going through using Sigil and adjusting the TOC so that it is correct. However, this always leaves exactly one link at the end of the TOC which I have to create manually, as there is no other chapter that is incorrectly associated with this link.
For example, in Book A the TOC might look like this Chapter 1 Chapter 2 Chapter 3 The chapter 2 link points to chapter 1, the chapter 1 link points nowhere, and the chapter 3 link points to chapter 2. I can move the first two links, but I have to make a link to point to chapter 3. When I do this I simply take something from another chapter, such as: Code:
<p class="calibre2"><a class="calibre3" href="../Text/Last_Argument_Of_Kings_split_062.html#filepos1583884"><span class="bold calibre4 underline">The Beginning</span></a></p><br class="calibre5" /> |
08-06-2011, 08:35 PM | #2 |
Wizard
Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
The 'filepos' is just an example of a fragment identifier. It needs to start with a letter and can't include certain characters, but it's really just a marker that identifies a specific place in a file. The target of the link needs to have an identifier with the same text.
i.e. File1.xhtml: <p><a href="File2.xhtml#Target">Click here</a></p> File2.xhtml: <p id="Target">This is where you end up</p> You probably don't see any difference in this case because the targets in the table of contents they all point to are all elements on the same displayed page. |
08-06-2011, 11:45 PM | #3 | |
Addict
Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
|
Quote:
1) I'm not quite sure what you mean by "all elements on the same displayed page." The page with the inline TOC or the page that I am linking to? I went back through and checked it out and it seems that you are correct. In the links that I did not make in the TOC, the place where it links to has an ID that matches the filepos tag in the TOC. Of course the tags I made don't match, since I picked the numbers at random. 2) Could it be because they always link to the top of a page? (That is, in the books I am working with the chapter breaks are always a new split_## file.) 3) But anyway, if the books work fine I shouldn't have any problem, correct? 4) If they are built this way, is the filepos even necessary or could the links just be done by identifying a file without a target? 5) Would there be problems with other file formats (eg mobi, pdb) if it was done that way? Also, while I have your attention, I've noticed that in a number of the files in my library, the entire inline TOC is off by exactly one chapter. Is there anything that you can think of that could cause this? You seem pretty knowledgeable about this stuff. It's just odd because the books come from multiple publishers, are converted using the same settings in Calibre, and I always have to go through and do the exact same thing, manually moving the chapters. It just seems a little odd. Thanks for the help! |
|
08-07-2011, 05:00 AM | #4 |
Wizard
Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
If you have a page with the following items
<p id="t1">...</p> <p id="t2">...</p> <p id="t3">...</p> <p id="t4">...</p> Then a link to any of those targets will produce the same displayed page. This may change if you increase the font size so much that the later elements get shuffled off onto the next page or if the ToC is long enough to stretch over several pages. The use of a fragment merely ensures that the result of a link will display the page in the file that contains the target to which it refers. If you omit the fragment identifier then the link will always point to the first page in the file. I don't know why you're having this problem, but it sounds like a problem with the settings you use for conversion, or maybe a bug in calibre. |
08-07-2011, 06:19 AM | #5 |
frumious Bandersnatch
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
That is so in the ADE implementation, where the "pages" are sort of pre-computed, but there are conceivably other ePUB readers that will place the target always on top of the page, or in the middle of the page... so the displayed page could be different.
|
03-16-2017, 10:31 AM | #6 |
Junior Member
Posts: 3
Karma: 10
Join Date: May 2015
Device: Sony,Apple,Android
|
Discussion creates a few questions
Howdy, apologies for arriving late to this party. Just looking for a little clarification on this topic.
1. Are these "filepos" placemarks only referenced in the ebook's Table Of Contents and/or Index (or other places as well)? 2. Suppose I created a "filepos=chapter", same id in every chapter, and in the Table of Contents referenced them as: chapt01.xhtml#chapter chapt02.xhtml#chapter ..... Would that work? In other words, they don't have to be globally unique within the book? Thanks! |
03-16-2017, 10:56 AM | #7 | |
Grand Sorcerer
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
The two references you included ARE globally unique to the book (even though the fragments are identical). |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ebook-convert doesn't recognize base-font-size parameter | dracodoc | Calibre | 6 | 12-25-2009 10:26 PM |