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 08-21-2016, 09:01 PM   #1
bookart
Junior Member
bookart began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Aug 2016
Device: none
Automatic endnote renumbering after insert

I searched around quite a bit on this forum and elsewhere and haven't come across any clear solution to a problem I am facing.

I have an e-book in .mobi format and .epub format. I can edit the .epub file with calibre no problem. I have added endnotes, and though it takes a bit of doing with getting the links correct and all, it works okay. However, the inserted endnotes are not in numerical sequence with the ones before and after, which is what I want to have.

Is there any simple way (or any reasonable way other than having to renumber hundreds of endnotes by hand) to renumber the endnotes automatically to get them into sequential order? If I need to custom code a program to parse and replace text, that is possible (though certainly not ideal), but the .epub file seems to be gibberish and so I do not know how to parse it for xml tags and such.

Any suggestions would be a great help for me and I would guess others too. It would be great if Calibre had this feature, but it does not seem to.

Thanks in advance!
bookart is offline   Reply With Quote
Old 08-22-2016, 02:52 AM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by bookart View Post
Is there any simple way (or any reasonable way other than having to renumber hundreds of endnotes by hand) to renumber the endnotes automatically to get them into sequential order?
I've created a simple incremental ids plugin for Sigil that allows you to add consecutive ids to user-selected tags.
If you're familiar with regular expressions, you could first add consecutive ids to all footnote tags and than use the ids to replace the existing footnote numbers.

BTW, Calibre Editor also has a Function Mode that might allow you to do the same thing.
Doitsu is offline   Reply With Quote
Old 08-23-2016, 04:04 PM   #3
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,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
@Doitsu --

Quote:
If you're familiar with regular expressions, you could first add consecutive ids to all footnote tags and than use the ids to replace the existing footnote numbers.

Does this mean that there's a RE way to somehow get incrementing numbers into a 'Replace With' expression?
phossler is offline   Reply With Quote
Old 08-23-2016, 04:14 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
No, there is not a regex way. But using a python function, you can.

See the Editor documentation for Function Mode: https://manual.calibre-ebook.com/function_mode.html
Specifically, the "Auto numbering sections" part.

If you need help getting the exact replacement function you need, we will have to see samples of the endnotes HTML. But I'd be happy to help you with it, so feel free to ask.

Last edited by eschwartz; 08-23-2016 at 04:17 PM.
eschwartz is offline   Reply With Quote
Reply

Tags
automatic, endnote, insert, mobi, renumbering


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Endnote Renumbering Problem GeorgeH Conversion 2 12-31-2013 10:02 AM
Endnote renumbering kerliza Sigil 4 11-02-2013 05:15 PM
Footnotes renumbering automatically emslondon ePub 4 01-15-2013 12:50 PM
ToC renumbering JSWolf Sigil 21 01-27-2012 07:01 PM
renumbering a pdf pimpoum PDF 1 04-30-2009 03:03 AM


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


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