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, 09: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: 201
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, 04: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, 09: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: 201
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, 12: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, 12: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: 35,498
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, 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
Reply


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 09:20 AM.


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