Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-04-2023, 10:33 AM   #31
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: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
Manual updated

Quote:
Originally Posted by Qubert View Post
Would it be possible for you to update the user guide, Footnote manipulator v0.1.1.1.epub, to include a footnote?
Done - please see the updated user guide in the first post of this thread.
CalibUser is offline   Reply With Quote
Old 01-26-2024, 05:18 PM   #32
WiseGuru
More Wiserer
WiseGuru began at the beginning.
 
WiseGuru's Avatar
 
Posts: 9
Karma: 10
Join Date: Jan 2024
Device: Pocketbook Era (KOReader)
Thank you so much for making this plugin! I think it will help me on a project, but I'm having trouble and I hope I can get your help to better understand it.

Below is some background, but the tl;dr is: I want to use your plugin to programmatically change the formatting of footnotes by inserting the footnotes into the ebook main text, and then re-create the footnote documents in a way that updates their formatting. However, I don't know how to translate the existing HTML to the "Advanced Options" input table in your plugin. I am also open to better or alternative solutions if you have any for me.

Background:
I recently discovered KOReader can present a properly formatted footnote in an EPUB3 ebook at the foot of the current page instead of purely as a link. I just bought the entire collection of Terry Pratchett books, and I'm trying to "fix" their footnotes. The collection is mixed between EPUB2 and EPUB3, but I'm going to convert them all to EPUB3, which should make them all a little more similar.

For example, here's an (anonymized) footnote and link from the book "Sourcery":

Code:
<!--Inline text with numbered footnote link-->
<p class="para"><span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.277.1">This is some text that needs a footnote</span><a class="nounder" href="9780061807145_Footnote.xhtml#fn2" id="fn_2"><span class="sup"><span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.278.1">*</span></span></a></p>

<!-- Footnote content in a separate xhtml document, with appropriate headers etc.-->
<p class="footnotePara"><a class="nounder" href="9780061807145_Chapter_1.xhtml#fn_2" id="fn2"><span class="sup"><span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.3.1">*</span></span></a><span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.4.1"> This is the content of the footnote. </span></p>
Ideally, I think the final result should look something like this (just an example from the internet I modified for testing):

Code:
<!--Inline text with numbered footnote link-->
<p>This is some text that needs a footnote.<a href="FN_Section0001.xhtml#fn2" epub:type="noteref" id="fn_2">[1]</a></p>

<!-- Footnote content in a separate xhtml document, with appropriate headers etc.-->
<body>
<aside epub:type="footnote" id="fn2">
  <p><a href="9780061807145_Chapter_1_split_000.xhtml#fn_2">↩</a>This is the content of the footnote. </p>
</aside>
</body>
However, so far my attempts to make these changes programmatically have all but failed. If I manually copy/paste in the "correct" footnote code, it works fine, but if I try to tinker with the existing code to add the EPUB type, I struggle to get consistent results.

I want to use your plugin to identify footnotes, reintegrate the text to the main document, and then extract them back into the footnote.xhtml documents using into the appropriate format.

Assuming that your plugin works the way I think it does, here's the information I've used for the "Advanced Options":

1. The name of the xhtml footnote section
-I think this is where all the footnotes are written if in a single file.
-9780061807145_Footnote.xhtml
2. Footnote heading
-I'm not sure what this is, so I left it blank. I think, though, this would be something like this, right?
Code:
<title>Sourcery Footnotes</title>
3. The class name for the footnote heading
-Not sure what this would be either, so I would leave this as "Footer"
4. ID for each footnote
-I think this is the ID for the actual footnote, in the example above, fn2
-fn
5. Class name for each footnote
-I think this is the overall class name for the footnote, which I think is "footnotePara"
6. ID for each hyperlink
-I think this is the ID for the hyperlink to the footnote, in the example above, fn_2
-fn_
7. Class name for highlighting footnotes in the main body of the text
-either "nounder" or "sup", but unsure
8. Include epub:type elements
-I think I should turn this on to add the epub:type attributes.

I know I've got something wrong because whether I run "Insert footnotes" or "Reinstate footnotes," nothing happens. Any idea what I'm missing?


Anyway, thank you taking a look at this and for any help you can provide! I really appreciate it.
WiseGuru is offline   Reply With Quote
Advert
Old 01-27-2024, 10:04 AM   #33
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: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
Examining the text in your example that needs to be turned into a footnote I assume that all such text requiring a footnote has the following format in the sequence shown:

a number followed by quotes and a closing angular bracket >
The text that needs a footnote
html tags that include Footnote.xhtml#

Using your example, this is:
Code:
1">This is some text that needs a footnote</span><a class="nounder" href="9780061807145_Footnote.xhtml#fn2" id="fn_2">
A possible solution to using my plugin would be to use Find/Replace to find each occurrence of this sequence and insert the tag <span class="FNOTE">..</span>. Then you would be able to run my plugin to generate the footnotes.

Use the following to do this:
Code:
Find: (\d)">(.*?)<(.*?)Footnote.xhtml#(.*?)>
Replace: \1"><span class="FNOTE">\2<\3Footnote.xhtml#\4
Make sure that you select Regex as the search mode.

This will leave the section href="9780061807145_Footnote.xhtml#fn2" id="fn_2" in place in case it is needed by other links in the book eg the contents page, if any. If you do not need this then you could modify the search criteria to remove this. section too.

After doing the search and replace run the plugin and it will produce the footnotes in its standard format.

You will need to do another search and replace to remove the unwanted existing footnotes.

I hope this helps to resolve the issue.
CalibUser is offline   Reply With Quote
Old 01-29-2024, 01:05 AM   #34
WiseGuru
More Wiserer
WiseGuru began at the beginning.
 
WiseGuru's Avatar
 
Posts: 9
Karma: 10
Join Date: Jan 2024
Device: Pocketbook Era (KOReader)
Thank you! Sorry, I didn't see that you'd responded; I did some work on it this weekend and I discovered that the formatting between the ebooks is super varied, so it's going to be a longer road than I anticipated. Thank you again!
WiseGuru is offline   Reply With Quote
Old 01-29-2024, 01:08 AM   #35
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,573
Karma: 157444380
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by WiseGuru View Post
Thank you! Sorry, I didn't see that you'd responded; I did some work on it this weekend and I discovered that the formatting between the ebooks is super varied, so it's going to be a longer road than I anticipated. Thank you again!
That is pretty much the usual. Everybody seems to have their own ideas about formatting, styling, etc. And then we have the idiots who decide that using <div> is better than <p> for wrapping paragraphs or that inline styles are the only way to fly.
DNSB is offline   Reply With Quote
Advert
Old 08-05-2024, 11:13 AM   #36
ruychi
Junior Member
ruychi began at the beginning.
 
ruychi's Avatar
 
Posts: 1
Karma: 10
Join Date: Aug 2024
Location: Portugal, Europe
Device: Kindle Scribe, Kindle Oasis
Changing Code to (optionally) support <aside>

Hi,
I have been using this plugin, it is fantastic, but there are ate least on my perspective two caveats.

1. It allows a style to be defined for the FOOTNOTE, if it is placed in the current xhtml section, BUT, in case the option is to place it in a new xhtml section, that style (class name for footnote heading) is not respected. We end up with a new xhtml section with a heading not respecting what is defined in the CSS ?!!

My simple suggestion: allow for different heading styles selection (and footnote/endnote heading names) in case of selecting "current xhtml" or "new xhtml".

2. Following what [QUOTE=WiseGuru;4392512] mentioned, in what respects having in ePUB3 with pop-up footnote using the <aside> element, I would also suggest to change the way the footnote is built, or a selectable option for having footnotes built with the the <aside> element.

Code:
<!-- Footnote content with appropriate headers for aside.-->
<aside epub:type="footnote" id="fn2">
  <p><a href="9780061807145_Chapter_1_split_000.xhtml#fn_2">↩</a>This is the content of the footnote. </p>
</aside>
Please note that for my own use of the plugin, I just modified the python script at line 689 for the following, and it works perfectly:

Code:
FootNote='<aside id="'+self.prefs['FootnoteID'] + Ref +'"'+self.eTypeFootnote+'><p class="'+self.prefs['FootnoteClass']+'"><a href="../' + self.textCurrentSection +'#'+self.prefs['HyperlinkID']+Ref+'">'+self.entryPrefixFooter.get() + insertRef+self.entrySuffixFooter.get()+'</a>' + " " +FN+'</p></aside>'
In my humble opinion, it would be just including an option in "Advanced Options" to have "ePub3 Pop-Up via <aside> element".

Cheers.
ruychi is offline   Reply With Quote
Old 08-10-2024, 10:18 AM   #37
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: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
@ruychi: I'm glad that you find the plugin useful. In response to your comments:

1. The "style (class name for footnote heading) is not respected".
The style for the footnote heading is applied from the stylesheet named Footnotes.css. This stylesheet is not generated by the plugin but has to be supplied by the user. If you use the style sheet provided in the manual and you use different class names (eg for the footnote heading) then you will need to change the names of the relevant styles in your style sheet.

2. "I would also suggest ... selectable option for having footnotes built with the <aside> element."

I have implemented your suggestion in the updated version of the plugin in the first post of this thread. Clicking the Advanced button on the main dialog and then selecting the box Include epub 3 types? builds footnotes with the <aside> tag.
CalibUser is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copyright - posthumous publications GrannyGrump General Discussions 23 11-22-2012 09:11 AM
Double copies of news publications mark_e_h Calibre 2 02-10-2012 02:13 AM
Testing ePub publications with an Android emulator for OSX Giordano Galli Android Developer's Corner 0 09-08-2011 03:49 PM
Manning publications 35% to 50% off thinkpad Deals and Resources (No Self-Promotion or Affiliate Links) 0 11-23-2010 04:30 PM


All times are GMT -4. The time now is 11:28 PM.


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