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

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 11-10-2019, 05:12 AM   #1
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
FootnoteManipulator plugin

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.2
  • Bug fixed: name 'ttk' is not defined

Update to manual
I have inserted a sample page to show how to use the footnote manipulator as requested.
Attached Files
File Type: zip FootnoteManipulator._v0.1.1.2.zip (17.3 KB, 683 views)
File Type: epub Footnote manipulator v0.1.1.2.epub (53.8 KB, 247 views)

Last edited by CalibUser; 05-04-2023 at 09:31 AM. Reason: Updated manual
CalibUser is offline   Reply With Quote
Old 11-10-2019, 01:58 PM   #2
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 680
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
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.
Attached Images
 

Last edited by BeckyEbook; 11-10-2019 at 02:05 PM.
BeckyEbook is offline   Reply With Quote
Old 11-10-2019, 03:03 PM   #3
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
@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).
CalibUser is offline   Reply With Quote
Old 11-13-2019, 11:37 AM   #4
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 680
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
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.

Last edited by BeckyEbook; 11-13-2019 at 11:49 AM. Reason: New suggestion
BeckyEbook is offline   Reply With Quote
Old 11-14-2019, 11:20 AM   #5
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
@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 View Post
* 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 is offline   Reply With Quote
Old 12-01-2019, 06:52 AM   #6
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
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 View Post
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 View Post

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 View Post
* 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.
CalibUser is offline   Reply With Quote
Old 12-01-2019, 06:16 PM   #7
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Thank you for your work.

Quote:
Originally Posted by CalibUser View Post
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.

Last edited by roger64; 12-01-2019 at 07:14 PM.
roger64 is offline   Reply With Quote
Old 12-01-2019, 07:23 PM   #8
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 680
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
Probable bug (five times in the plugin code):

Code:
<p class="'+self.prefs['HyperlinkID']
should be
Code:
<p class="'+self.prefs['FootnoteClass']
BeckyEbook is offline   Reply With Quote
Old 12-08-2019, 08:11 AM   #9
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
Quote:
Originally Posted by roger64 View Post
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 View Post
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.
CalibUser is offline   Reply With Quote
Old 12-08-2019, 04:15 PM   #10
BetterRed
null operator (he/him)
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: 20,532
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
This plugin doesn't have entry in the Sigil Plugin Index.

BR
BetterRed is offline   Reply With Quote
Old 12-08-2019, 04:26 PM   #11
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,532
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by BetterRed View Post
This plugin doesn't have entry in the Sigil Plugin Index.
Hmmm. Thanks for catching that.
DiapDealer is offline   Reply With Quote
Old 12-08-2019, 04:37 PM   #12
BetterRed
null operator (he/him)
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: 20,532
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
I have a suspicion it's not the only one.

BR
BetterRed is offline   Reply With Quote
Old 12-08-2019, 05:43 PM   #13
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,532
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by BetterRed View Post
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).
DiapDealer is offline   Reply With Quote
Old 12-08-2019, 06:26 PM   #14
BetterRed
null operator (he/him)
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: 20,532
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by DiapDealer View Post
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
BetterRed is offline   Reply With Quote
Old 12-08-2019, 07:43 PM   #15
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,532
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by BetterRed View Post
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.
DiapDealer 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
Copyright - posthumous publications GrannyGrump General Discussions 23 11-22-2012 08:11 AM
Double copies of news publications mark_e_h Calibre 2 02-10-2012 01:13 AM
Testing ePub publications with an Android emulator for OSX Giordano Galli Android Developer's Corner 0 09-08-2011 02:49 PM
Manning publications 35% to 50% off thinkpad Deals and Resources (No Self-Promotion or Affiliate Links) 0 11-23-2010 03:30 PM


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


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