MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   Plugin for inserting endnotes in an epub 2.0 (https://www.mobileread.com/forums/showthread.php?t=265104)

elibrarian 09-11-2015 12:14 PM

[Plugin] Easy Footnote Insertion
 
3 Attachment(s)
Plugin for easy insertion of epub 2.0 style footnotes.

The text for the notes must be at the place in the surrounding text, where the reference should be inserted, surrounded by ^[ ... ] - same way as Pandoc inline-notes. Read more and see some screen captures in the attached pdf.

License: No formalized license as such - do whatever you like with my code, as long as you don't charge for it, and if you come up with any improvements, please share.

---

What's new?
  • 0.2.0: Plugin can be run on epubs with existing notes.
  • 0.2.0: If it finds any notes (in a known format), it will try to determine the highest reference number and continue from there, or the user can choose a higher number to start from. (E. g. if highest found is 59, then it might be convenient to start new numbers at 100, then the new notes wil be easy to find with a regex like \d\d\d or \d{3})
  • 0.2.0: If a footnote.css stylesheet file exists in the epub, it will not be overwritten, but user will get a warning to check the format of any newly inserted notes.
  • 0.2.0: Plugin autostarts.
  • 0.2.0 Now Python 3 only.

April 8. 2018: New version 0.2.1:
  • 0.2.1: Now doesn't insert multiple instances of the css-reference (thanks to BeckyEbook)
  • 0.2.1: Updated intro/userguide.

Future updates: Since I don't do epub version 2-books any more, this plugin will not be updated any further.

Update 18. dec. 2019: From my (admittedly not very extensive) tests of this plugin with non-standard epubs and Sigil 1.0, it still works as advertised.

Regards,

Kim

KevinH 09-11-2015 01:21 PM

Hi Kim,

Wonderful. Thanks for contributing to Sigil via your plugin. I am tied up at work right now, but I will add plugin to the official Sigil Plugin Index thread when I get a free moment this weekend. If you have any technical questions about plugin development, please don't hesitate to ask in the main plugin thread.

Thanks!

KevinH

theducks 09-11-2015 02:23 PM

Quote:

Originally Posted by KevinH (Post 3168890)
Hi Kim,

Wonderful. Thanks for contributing to Sigil via your plugin. I am tied up at work right now, but I will add plugin to the official Sigil Plugin Index thread when I get a free moment this weekend. If you have any technical questions about plugin development, please don't hesitate to ask in the main plugin thread.

Thanks!

KevinH

I added it, but for some reason the item spacing is off :o

DiapDealer 09-11-2015 03:30 PM

Did you really just make a pdf to document how to use an epub plugin? :D

PeterT 09-11-2015 04:16 PM

Quote:

Originally Posted by DiapDealer (Post 3168961)
Did you really just make a pdf to document how to use an epub plugin? :D

He's following the lead of a certain calibre plugin author...

elibrarian 09-11-2015 04:16 PM

Quote:

Originally Posted by DiapDealer (Post 3168961)
Did you really just make a pdf to document how to use an epub plugin? :D

Yup - I use Libreoffice and Snap8 all the time to make docs like this at work, so it was the easiest way for me instead of fiddling for hours with image placements in an epub ... :D

Regards

Kim

Pablo 09-14-2015 11:52 AM

Very nice plugin eLibrarian!

:thanks:

CalibUser 09-14-2015 03:14 PM

Thanks, eLibrarian. This will be useful for some ePubs that I am writing.

gipsy 09-29-2015 06:09 AM

@elibrarian

If the 2 ^[...] are near, the search find them as one
I solve it changing the
Code:

                found = re.search(r'\^\[.*\]',html)
to
Code:

                found = re.search(r'\^\[.*?\]',html)
EDIT: Doesn't work right. It delete the text till the last ] in those that are near
I try to figure out why

elibrarian 09-29-2015 09:17 AM

I've uploaded a new version to the first post of this thread. I think I've nailed the problem with deleting text too.

Regards,

Kim

gipsy 09-29-2015 10:04 AM

Thanks Kim, works fine now

Leonatus 09-30-2015 06:01 AM

A really useful tool! Thank you so much!

I'd use it principally for OCRing of scientific texts. In the original text of those, there usually appear footnotes. As I understand it, to make the tool run, I need to "cut" the footnote text and place it next to the corresponding "body" text first, right?

elibrarian 09-30-2015 08:40 AM

Quote:

Originally Posted by Leonatus (Post 3179739)
As I understand it, to make the tool run, I need to "cut" the footnote text and place it next to the corresponding "body" text first, right?

If I understand you correctly, then yes - see the first image in the pdf-intro, where "Mälaren" is the word you want to explain, and ^[En sø i Sverige - A lake in Sweden] is what is to become a note. Text between the [...] wil be moved to the note at the end of the file.

Just try it on any epub - as long as it is on a copy and/or you don't save, no harm is done :)

Regards,

Kim

Leonatus 10-01-2015 03:23 AM

Thank you, Kim,
the actual book I'm OCRing has some footnotes, so it's a good oportunity.

Leonatus 10-08-2015 12:50 PM

Kim, I tested it, and I'm overwhelmed! Really amazing!


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

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.