MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   FootnoteManipulator plugin for epub 2.0 publications (https://www.mobileread.com/forums/showthread.php?t=324637)

CalibUser 11-10-2019 06:12 AM

FootnoteManipulator plugin
 
2 Attachment(s)
FootnoteManipulator plugin

Recently I produced an ePub that contained a plethora of footnotes. As the ePub developed and went through several reviews, I found that I needed to add/delete footnotes and this became time consuming. Consequently, I developed the attached plugin with the following features:
  • Footnotes can be placed at the end of each xhtml section or all the footnotes can be placed together in one xhtml section;
  • All hyperlinks to the footnotes are numbered automatically in the form 1, 2, 3, etc. Text may be included for each numbered hyperlink (eg 'Note 1') and/or brackets can be placed around the hyperlink (eg [1]). In each of these examples the number is inserted automatically and is incremented for each separate footnote;
  • The hyperlink for each footnote can be set up as a superscript if required;
  • The hyperlink (backlink) in the footnote itself that takes the reader back to the main text may include a number that is incremented automatically in each footnote or text may be placed in the footnote without a number (eg 'Back'). Alternatively, both an automatically incremented number and specified text may be included in the backlink;
  • The hyperlink in the footnote itself that takes the reader back to the main text may be placed at either the start or the end of the footnote;
  • A css file to format the footnotes may be specified and this is imported into the ePub when the plugin runs. The sample css file in the manual also formats the text that is to be hyperlinked; this distinguishes the text for the footnote from that of the main text;
  • The settings for the plugin may be saved so that they may be used with other ePubs;
  • Footnotes can be moved back into the body of the text in the appropriate xhtml section; this is useful if it becomes necessary to add more footnotes later or delete some of the existing footnotes. Then, when the plugin is run to reinsert the footnotes, the notes will be inserted with updated numbers in the correct sequence;
  • Advanced users can specify the name of the ID for the footnote.

This plugin has been tested on epub 2.0 books and epub 3.0 using Sigil version 0.9.14 running on windows 10:).

Important: Please backup your epub before running this plugin.

How to install this plugin: See the manual.

Licence: See the manual.

Update to version 0.1.1.0
  • Bug fixed: The previous version looked for updates and froze if an update was found.
  • Bug fixed: When reinstating footnotes an extra space was introduced into the beginning of the reinstated footnote.
  • Feature added: An image for the plugin that can be included in the toolbar has been added (thanks to BeckyEbook).
  • Feature added: You can include the epub:type="footnote" in footnotes and you can include epub:type="noteref" in hyperlinks for ePub 3 ebooks.
  • Feature added: You can specify the names for classes, hyperlinks and IDs that are associated with footnotes.
  • Feature added: You can set the time interval between reminders for installing an update when an update becomes available.

Update to version 0.1.1.1
  • Bug fixed: HyperlinkID was used as the Footnote Class

BeckyEbook 11-10-2019 02:58 PM

1 Attachment(s)
The plugin works great.
I've been waiting for years for the footnote plugin, which will have the "Reinstate Footnotes" button. Thank you!

It is worth thinking about adapting the plugin to Sigil 1.0, because currently some paths are hardcoded (Text, Styles).

One suggestion (removing spaces before the text when calling reinstate, because repeated use of Insert-Reinstate causes the space to grow with each use):

Code:

FNtext=self.FNList[j][2].lstrip()  #Get the text for the footnote
I added a plug-in icon suggestion.

CalibUser 11-10-2019 04:03 PM

@BeckyEbook: Glad you find the plugin useful. Thank you for your suggestion and for providing an icon for the plugin. I will incorporate your suggestion and icon in the next update (I will wait a short while in case anybody else has any suggestions or reports any bugs).

BeckyEbook 11-13-2019 12:37 PM

I have some suggestions.

Let me list them below:

* Adaptation to Sigil 1.x
This should not be difficult, first of all you use an additional condition will detect whether this is version 0.9.991+
Code:

if bk.launcher_version() >= 20190927:
Next
Code:

bk.group_to_folders("Text")
and you get the path to the folder with Xhtml files, and
Code:

bk.group_to_folders("Styles")
gives you the path to the folder with styles. Then you only replace the harcoded in several places "Text" and "Styles" to variables.


* Additional options for names used in names of ids, files and styles (just as you can change FNID), it is worth giving the option to change:
class FNOTE
id FOOTNOTE
class Footer
name in footer FOOTNOTES
class Footnote
filename Footnotes.xhtml

It will be a nod towards non-English users :)

* Option to enable/disable the fragment with the footer (currently the footer is always added, although it is not necessary after all).

* The plugin does not take into account the situation when the file name is not necessary if it applies to the same file.
Then
Code:

<a href="../Text/Section001.xhtml#fnid1">
is saved in a shortened form:
Code:

<a href="#fnid1">
... and in this situation Reinstate does not work.

* It is true that it is dangerous when it is used on a file with errors, so I would add at the top of the plugin window such a bold inscription "Always work on a copy of the file – you may lose many hours of your work!"

Edit:
* Add the option to enable/disable adding epub:type="noteref" and epub:type="footnote"
Look here.

CalibUser 11-14-2019 12:20 PM

@BeckyEbook: Thank you for your suggestions. I am far from an expert in the structure of epubs so I need to look into the structures allowed by Sigil 1.0 - I have always used the older (standard?) structures. Your tips will be very useful.

Quote:

Originally Posted by BeckyEbook (Post 3915630)
* Option to enable/disable the fragment with the footer (currently the footer is always added, although it is not necessary after all).

That's very annoying - I thought I had dealt with this issue as it had occured during testing.

My first priority will be to adapt the plugin for Sigil 1.0 then I will look at implementing your other suggestions.

CalibUser 12-01-2019 07:52 AM

Although I intended to adapt the plugin for Sigil 1.0 before making any other amends to this plugin, I decided to implement other changes first:

Quote:

Originally Posted by BeckyEbook (Post 3915630)
I have some suggestions.

Let me list them below:

* Additional options for names used in names of ids, files and styles (just as you can change FNID), it is worth giving the option to change:
class FNOTE
id FOOTNOTE
class Footer
name in footer FOOTNOTES
class Footnote
filename Footnotes.xhtml

It will be a nod towards non-English users :)

* Option to enable/disable the fragment with the footer (currently the footer is always added, although it is not necessary after all).

* The plugin does not take into account the situation when the file name is not necessary if it applies to the same file.
Then
Code:

<a href="../Text/Section001.xhtml#fnid1">
is saved in a shortened form:
Code:

<a href="#fnid1">
... and in this situation Reinstate does not work.

Edit:
* Add the option to enable/disable adding epub:type="noteref" and epub:type="footnote"
Look here.

Quote:

Originally Posted by BeckyEbook (Post 3914346)

One suggestion (removing spaces before the text when calling reinstate, because repeated use of Insert-Reinstate causes the space to grow with each use):

Code:

FNtext=self.FNList[j][2].lstrip()  #Get the text for the footnote
I added a plug-in icon suggestion.

I have implemented the above suggestions in the updated version of the plugin in the first post of this thread and have included your icon (Thanks for providing this).

I have also corrected a bug that caused the plugin to freeze when an update was posted.

Quote:

Originally Posted by BeckyEbook (Post 3915630)
* It is true that it is dangerous when it is used on a file with errors, so I would add at the top of the plugin window such a bold inscription "Always work on a copy of the file – you may lose many hours of your work!"

I decided not to include this warning as it is probably true of some other plugins and may discourage users from using this plugin.

I will look at updating the plugin to cope with Sigil 1.0 when I get some more time.

roger64 12-01-2019 07:16 PM

Thank you for your work.

Quote:

Originally Posted by CalibUser (Post 3914201)
FootnoteManipulator plugin

2. If you want a footnote plugin that allows you to change classnames and IDs for tags then see FootnoteLinker Sigil Plugin by Doitsu[/LIST]

As a long time user of the FootnoteLinker plugin, I think this is not a fitting description of what it does.

The FootnoteLinker plugin creates full footnote links (href + id) from scratch for ePub2 and ePub3 (with aside and relevant epub:type elements).

If need be (when footnotes definitions are scattered in various places) the FootnoteMover plugin can just collect them and put them together in the same file before the processing with FootnoteLinker takes place.

BeckyEbook 12-01-2019 08:23 PM

Probable bug (five times in the plugin code):

Code:

<p class="'+self.prefs['HyperlinkID']
should be
Code:

<p class="'+self.prefs['FootnoteClass']

CalibUser 12-08-2019 09:11 AM

Quote:

Originally Posted by roger64 (Post 3922553)
As a long time user of the FootnoteLinker plugin, I think this is not a fitting description of what it does.

The FootnoteLinker plugin had features that the first version of the FootnoteManipulator plugin lacked so I wanted to point users to the FootnoteLinker plugin if they needed those features. The original post was intended to merely highlight the differences between footnote plugins that were available and not give full descriptions of them all.

However, the latest version of the FootnoteManipulator plugin does provide the additional features of the FootnoteLinker plugin so I can see your point; the reference to the other footnote plugin is now redundant so I have decided to remove references to this and the other plugins from my first post.

Quote:

Originally Posted by BeckyEbook (Post 3922577)
Probable bug (five times in the plugin code):

Code:

<p class="'+self.prefs['HyperlinkID']
should be
Code:

<p class="'+self.prefs['FootnoteClass']

Thank you for pointing out this bug. I have posted an update in the first post for this thread.

BetterRed 12-08-2019 05:15 PM

This plugin doesn't have entry in the Sigil Plugin Index.

BR

DiapDealer 12-08-2019 05:26 PM

Quote:

Originally Posted by BetterRed (Post 3925678)
This plugin doesn't have entry in the Sigil Plugin Index.

Hmmm. Thanks for catching that. :thumbsup:

BetterRed 12-08-2019 05:37 PM

I have a suspicion it's not the only one.

BR

DiapDealer 12-08-2019 06:43 PM

Quote:

Originally Posted by BetterRed (Post 3925686)
I have a suspicion it's not the only one.

I'd be very surprised if there were more than a one or two (this one included).

BetterRed 12-08-2019 07:26 PM

Quote:

Originally Posted by DiapDealer (Post 3925703)
I'd be very surprised if there were more than a one or two (this one included).

Agreed - and I may have obsolete plugins or plugins from banned users in mind.

The problem with plugin index threads is that they don't go bold when they're changed - grumble, grumble :)

BR

DiapDealer 12-08-2019 08:43 PM

Quote:

Originally Posted by BetterRed (Post 3925710)
The problem with plugin index threads is that they don't go bold when they're changed - grumble, grumble :)

I lament that fact every time I add a new plugin to it. ;)


All times are GMT -4. The time now is 08:03 PM.

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