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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-01-2019, 06:04 AM   #1
reinsley
Enthusiast
reinsley began at the beginning.
 
reinsley's Avatar
 
Posts: 40
Karma: 10
Join Date: Dec 2016
Location: France
Device: Kindle PaperWhite
How to automate the HTML links for footnotes - endnotes

Is Calibre able to automate the HTML links for footnotes - endnotes (back and forth) ?

I mean ... :

Into the text, links to the footnotes I place manually with such a tag :
<a id="note-001"><sup>[1]</sup></a>

In a single "notes" file, all endnotes are placed manually with such a tag :
<a id="ret-001">1.</a> blahblah

At this point I create the HTML links one by one with the Calibre built-in tool. It works fine.

Uh ! it's a bit fastidious : 250 go-links and 250 back-links.

I don't see a way to automate the links such as the Table of Matters. Calibres owns so many features, I may do an useless work.

I did a convert test epub to epub, the HTML link is not created. Same test for table of content, except that a button exists to do the job from <h1> tag.

Ladies, Gents, I would greatly appreciate any input from those who have done this already.
Calibre has so many hidden killer features. I want to be sure I have to do this work manually with the "chain plus " icon.

TIA, best regards
reinsley is offline   Reply With Quote
Old 06-01-2019, 07:23 AM   #2
Brett Merkey
Not Quite Dead
Brett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toys
 
Posts: 100
Karma: 5750
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Calibre does not have what you are probably hoping for, but you can do the job fairly easily with regex. In fact, with the Kindle Paperwhite, once you have the footnote referenced in the text, you are mostly done.

You have:
Quote:
<a id="note-001"><sup>[1]</sup></a>
The simplest regex would be:
Quote:
Search: <a id="(.*?)"><sup>(.*?)</sup></a>
Replace: <a id="\1" href="notes.html#\1"><sup>\2</sup></a>
You're done, since the PW does not need a back link from the footnote page back to the text. If you want to code back links, the simplest method is to combine all your html text files into one (except the notes.html file) so one regex in the notes.html file will suffice. When you tell Calibre to then separate that big file back into component html files, Calibre will edit the links automatically to keep the links good. Done.

Last edited by Brett Merkey; 06-01-2019 at 07:43 AM.
Brett Merkey is offline   Reply With Quote
Advert
Old 06-01-2019, 05:35 PM   #3
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 14,717
Karma: 12617294
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by reinsley View Post
Is Calibre able to automate the HTML links for footnotes - endnotes (back and forth) ?

I mean ... :

Into the text, links to the footnotes I place manually with such a tag :
<a id="note-001"><sup>[1]</sup></a>

In a single "notes" file, all endnotes are placed manually with such a tag :
<a id="ret-001">1.</a> blahblah

At this point I create the HTML links one by one with the Calibre built-in tool. It works fine.

Uh ! it's a bit fastidious : 250 go-links and 250 back-links.

I don't see a way to automate the links such as the Table of Matters. Calibres owns so many features, I may do an useless work.

I did a convert test epub to epub, the HTML link is not created. Same test for table of content, except that a button exists to do the job from <h1> tag.

Ladies, Gents, I would greatly appreciate any input from those who have done this already.
Calibre has so many hidden killer features. I want to be sure I have to do this work manually with the "chain plus " icon.

TIA, best regards
The Sigil editor has a couple of foot/end note related plugins that may be of use ==>> Sigil Plugin Index

BR
BetterRed is offline   Reply With Quote
Old 06-02-2019, 02:18 PM   #4
reinsley
Enthusiast
reinsley began at the beginning.
 
reinsley's Avatar
 
Posts: 40
Karma: 10
Join Date: Dec 2016
Location: France
Device: Kindle PaperWhite
@Brett,

Thank you for your help.
Regex is beyond my comfort zone.
I have to study this language. The examples you gave me are precious as well as your advice to guide me in the right direction.
The search syntax is perfect.
The replacement syntax does not work. I have to dig.
Err "no replace function exist..."

As soon as I paste the replace formula, impossible to search and I get the error. When the replace box is empty, the search is OK.


@BetterRed
Thank you for the tip.
I will test this alternate solution.I will choose the easiest way to build these HTML links.

Best regards
reinsley is offline   Reply With Quote
Old 06-02-2019, 04:03 PM   #5
Brett Merkey
Not Quite Dead
Brett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toysBrett Merkey shares his or her toys
 
Posts: 100
Karma: 5750
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
Regex is beyond my comfort zone.
I am not sure if regex is within the comfort zone of any human being. However, it has its attractions when you see how much tedious labor it can save. I admit that this particular regex is not the simplest but it is worth another try.

Quote:
no replace function exist...
The only way I know to get that error is that you are using the wrong selection in the Mode dropdown. Choose "Regex" instead of "Regex-function." Put in the Find and Replace as I suggested and click Find button to see if it finds the first instance and Replace if it does. To be sure, tick the checkboxes "Case sensitive" and "Wrap" and "Dot all" choices.

Yes, lots of little options, but I know the regex will work when you get those options right.
Brett Merkey is offline   Reply With Quote
Advert
Old 06-03-2019, 05:02 AM   #6
reinsley
Enthusiast
reinsley began at the beginning.
 
reinsley's Avatar
 
Posts: 40
Karma: 10
Join Date: Dec 2016
Location: France
Device: Kindle PaperWhite
Quote:
Originally Posted by Brett Merkey View Post
The only way I know to get that error is that you are using the wrong selection in the Mode dropdown. Choose "Regex" instead of "Regex-function."
You're right.
Waow ! It does it. Exactly as it is suppose to do.
The french translation of the mode is : expression rationnelle ( the other two : normal and Fonction-Regex). That did not help me a lot. Puzzle is taking form now. Probably in two or three passes I will fix it firing in burst.

Thank you again for your help, Brett.

I'll do the job with Calibre built-in tools to get rid of it, and I will redo it with the Sigil plug-in version.

Best regards
reinsley is offline   Reply With Quote
Old 08-26-2019, 07:48 AM   #7
reinsley
Enthusiast
reinsley began at the beginning.
 
reinsley's Avatar
 
Posts: 40
Karma: 10
Join Date: Dec 2016
Location: France
Device: Kindle PaperWhite
Just after the help provided in this topic I did the job with Calibre and regex.
A good training that is time consuming.
To compare, I did the job again with the Sigil automated plugin.
I had to correct my anchors by regex again.
I spent less than half an hour to discover and to link 115 notes and 115 rearnotes.
Once the syntax is correct the creation of the links is faster than it takes to blink.

Thanks to all helpers.

sigil plugin here:
https://www.mobileread.com/forums/sh...d.php?t=288193
reinsley is offline   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
footnotes (endnotes) font too small mark_e_h Conversion 0 12-28-2013 12:40 AM
Moving endnotes/footnotes alexul ePub 20 08-15-2012 04:52 AM
Footnotes and Endnotes Ken Irving Writer2ePub 2 01-02-2011 09:05 AM
Footnotes/Endnotes crutledge Sigil 17 07-17-2010 11:56 AM
How do endnotes/footnotes work? JSWolf ePub 4 04-22-2009 05:54 PM


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


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