Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 09-06-2017, 02:57 AM   #1
jg56
Junior Member
jg56 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2017
Device: none
Newb is editing ToC code - Is filepos important in the href attribute?

Hi all,

Although I’ve never dealt with the internals of an eBook or Calibre, I’m helping a friend (who considers me more technically competent) to edit a Table-of-Contents that was missing a section.

Tools:Table of Contents:Edit Table of Contents was simple to use - just created a new entry and pointed it to the destination.

But there already was some sort of alternate ToC at the end of the e-book. I duplicated a block of ToC code (which pointed to a different section) and edited it as seemed appropriate. It apparently works but is missing one thing: filepos

source:
<a href="index_split_001.html#filepos1010”><span class="bold"> …
or
<a href="index_split_003.html#filepos6701”><span class="bold"> …

my edit:
<a href="index_split_002.html#"><span class="bold">

Seems to work, but is that numerical filepos important? Where can I find that position number for index_split_002.html? Or is that number just a comment, or redundant?

Thank you.
jg56 is offline   Reply With Quote
Old 09-06-2017, 04:15 AM   #2
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 72,511
Karma: 309063598
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
it's a reference to a position marked in the file. The 'filepos1010' is arbitrary - there's a matching destination in the file.

If your toc entries only need to point to the start of html files, then no # reference is needed.
pdurrant is offline   Reply With Quote
Advert
Old 09-06-2017, 04:41 AM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,443
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
if you remove filepos, remove the #
it is part of the link/anchor
Without the #filepos12345, it is just Top-o-File
theducks is online now   Reply With Quote
Old 09-06-2017, 10:44 AM   #4
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,085
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
But there already was some sort of alternate ToC at the end of the e-book.
I've found that if an ebook has been Calibre-converted (esp multiple times), there's often multiple TOCs are the end since there's a default conversion option to add a TOC at the end

I just delete them all the TOC HTMLs in the editor and add my own TOC using the editor Insert TOC based on Hx tags
phossler is offline   Reply With Quote
Old 09-07-2017, 01:39 AM   #5
jg56
Junior Member
jg56 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2017
Device: none
Thanks to everyone for the details of the href/#anchor (and re-assurances).

The (single) end-of-book ToC was rather complex and dense with code (I did not try the beautifier). Replacing it is certainly a thought. If I recall correctly when briefly toying with with Calibre's ToC generation, the result was a sparse, clean HTML page using li tags or maybe li class=.

Must confess my ignorance to the community. I had no idea e-books were commonly HTML-based. Just never thought about what was under the hood. Also have to admit the last time I made a web-page it was by hand and pre-CSS...

I think I'm going to try to find the time to get to know Calibre better. (Hope this forum wouldn't mind another question or two in future.)

Last edited by jg56; 09-07-2017 at 01:43 AM.
jg56 is offline   Reply With Quote
Advert
Old 09-07-2017, 05:05 AM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,402
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by phossler View Post
I've found that if an ebook has been Calibre-converted (esp multiple times), there's often multiple TOCs are the end since there's a default conversion option to add a TOC at the end

I just delete them all the TOC HTMLs in the editor and add my own TOC using the editor Insert TOC based on Hx tags
Why would anyone convert an eBook multiple times? That's just silly.
JSWolf is offline   Reply With Quote
Old 09-07-2017, 10:57 AM   #7
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,085
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by JSWolf View Post
Why would anyone convert an eBook multiple times? That's just silly.
Agree

But, there's a lot of PD books out there that have been run through Calibre multiple times over the years (I'm assuming by multiple people) to convert MOBI to EPUB to MOBI and EPUB and AZW3, etc., most probably in bulk

You can usually spot such books by how many TOC's there are at the end, by classes that start with .caliber....., and by how complicated/redundant the style sheets are
phossler is offline   Reply With Quote
Old 09-07-2017, 11:29 AM   #8
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,443
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by phossler View Post
Agree

But, there's a lot of PD books out there that have been run through Calibre multiple times over the years (I'm assuming by multiple people) to convert MOBI to EPUB to MOBI and EPUB and AZW3, etc., most probably in bulk

You can usually spot such books by how many TOC's there are at the end, by classes that start with .caliber....., and by how complicated/redundant the style sheets are
If the TOC was properly marked (semantics), it would have been replaced.
GIGO
[rant]
It astounds me, the number of coding flaws (and errors) in ebooks purported to have been professionally done. This includes BPH's.

I don't count messy code, as long as it is valid. I don't grade grammar.
I do count inconsistent style (CSS) usage (different chapters use different style names/values for the same type of content
[/rant]
theducks is online now   Reply With Quote
Old 09-07-2017, 11:34 AM   #9
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,402
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Most BPH's eBooks are coded using code like
Code:
<p class="CT" id="c01"><b>1</b></p>
Hardly any are coded using header tags for chapter headers.
JSWolf is offline   Reply With Quote
Old 09-07-2017, 04:17 PM   #10
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,443
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by JSWolf View Post
Most BPH's eBooks are coded using code like
Code:
<p class="CT" id="c01"><b>1</b></p>
Hardly any are coded using header tags for chapter headers.
But that is easy to adjust(if desired) with Diaps toolbox or a simple REGEX.
There is no need, if the NCX is correct. The HTML TOC is created from that.

I am talking about code that either fails to validate or does not work as the code implies.
theducks is online now   Reply With Quote
Reply

Tags
code, edit, filepos, table of contents, toc


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What does the filepos parameter do in an href? lunixer ePub 6 03-16-2017 11:56 AM
TOC attribute validation error curiousgeorge ePub 3 04-18-2013 05:07 PM
blank TOC page - attribute 'link' not declared for element 'body' wyatt650 Sigil 4 04-18-2013 02:41 PM
Editing code view in Sigil JJ Joseph Sigil 8 06-09-2012 02:30 AM
Use Regex to Code an Inline TOC, from an External TOC's .ncx File mostlynovels ePub 2 03-16-2011 01:15 PM


All times are GMT -4. The time now is 05:05 AM.


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