Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 08-06-2011, 08:23 PM   #1
lunixer
Addict
lunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-books
 
lunixer's Avatar
 
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" />
and adjust the split and filepos number. However, I am confused because it seems no matter what number I put in the filepos, it makes no difference to the book, both when I read it through Calibre/Sigil or on my K3. What exactly does this number do? Obviously the split number chooses which file in the book to look at, but I can't figure out the filepos. Thanks!
lunixer is offline   Reply With Quote
Advert
Old 08-06-2011, 08:35 PM   #2
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
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.
charleski is offline   Reply With Quote
Old 08-06-2011, 11:45 PM   #3
lunixer
Addict
lunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-bookslunixer has learned how to read e-books
 
lunixer's Avatar
 
Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
Quote:
Originally Posted by charleski View Post
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.
Thanks for the help! I've got a few more questions if you don't mind.

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!
lunixer is offline   Reply With Quote
Old 08-07-2011, 05:00 AM   #4
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
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.
charleski is offline   Reply With Quote
Old 08-07-2011, 06:19 AM   #5
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,063
Karma: 9175645
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by charleski View Post
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.
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.
Jellby is offline   Reply With Quote
Advert
Old 03-16-2017, 10:31 AM   #6
Oldeyes
Junior Member
Oldeyes began at the beginning.
 
Posts: 2
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!
Oldeyes is offline   Reply With Quote
Old 03-16-2017, 10:56 AM   #7
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: 15,845
Karma: 83613742
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Oldeyes View Post
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!
Correct. The id attributes that url fragments point to need only be unique to the html file they occur in, and not the entire book.

The two references you included ARE globally unique to the book (even though the fragments are identical).
DiapDealer is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 06:43 PM.


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