Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 07-23-2014, 08:34 PM   #1
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Looking for suggestions for linking

I saw a nice technique (at least I thought it was pretty cool) to add an link in the text to an endnote and a backlink (?) from the endnote to the original text position.

I was able to get it to work using the [Insert Hyperlink] button but creating the IDs and the rest was tedious and pretty fiddly.

Text file

Code:
  <p>asd<sup id="cite_01"><a href="notes_file.xhtml#note_01">1</a></sup> sdf</p>
  <p>asdfasfasdf</p>
  <p>asd<sup id="cite_02"><a href="notes_file.xhtml#note_02">2</a></sup> sdf</p>
End note file

Code:
  <p><sup id="note_01"><a href="text_file.xhtml#cite_01">1</a></sup> This is note ONE</p>
  <p>asdfasfasdf</p>
  <p><sup id="note_02"><a href="text_file.xhtml#cite_02">2</a></sup> This is note TWO</p>
Is there any technique to automate this or at least make it a little easier?

Thanks
Attached Files
File Type: epub test.epub (2.1 KB, 227 views)
phossler is offline   Reply With Quote
Old 07-23-2014, 09:36 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
clips/macros.

Still on Kovid's TODO list.

Or put in the unique info and regex it into shape.
eschwartz is offline   Reply With Quote
Advert
Old 07-23-2014, 11:16 PM   #3
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,568
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@phossler - I do notes, citations, index etc in Word, which has tools to do all that. IIRC OO Writer has similar facilities to Word. Jutoh has some too. Calibre does a pretty good job of converting a DOCX and maintaining all the links etc.

Its hard to keep track of chapter (foot) and endnote numbering manually and a multilevel index is even harder. In a book with lots of notes, references and a solid index there's often almost as much markup as there is text

BR
BetterRed is offline   Reply With Quote
Old 07-24-2014, 08:51 AM   #4
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
@all -- thanks for the info.

What seems to be harder would be the back link (text --> note --> text --> ... ) to return to the original point in the text

I can add a few links in text to notes and manually add the 'back link' in the note, but adding the links and sup's and ID's etc. in both places and keeping them in sync can be pretty fiddely
phossler is offline   Reply With Quote
Old 07-24-2014, 06:13 PM   #5
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,568
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
This ==>> Edit Book Plug-ins could be the means for creating/editing chapter & end notes, references, indexes etc.

Kovid has posted that it'll be in today's release - 1.46.

BR

Last edited by BetterRed; 07-24-2014 at 06:33 PM.
BetterRed is offline   Reply With Quote
Advert
Old 07-24-2014, 09:55 PM   #6
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
@BR -- interesting, but the way I read that means that someone (CERTAINLY not me -- I know when I'm out of my depth) could write the plugin to make the links, etc.???
phossler is offline   Reply With Quote
Old 07-24-2014, 10:23 PM   #7
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,568
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by phossler View Post
@BR -- interesting, but the way I read that means that someone (CERTAINLY not me -- I know when I'm out of my depth) could write the plugin to make the links, etc.???
Maybe we can bribe someone

IIRC when the idea of editor plug-ins first came up, some folks wondered what they might be used for - this seems a possible candidate.

BR
BetterRed is offline   Reply With Quote
Old 10-16-2014, 10:48 AM   #8
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Sorry to resurrect an old post, but I recently had to fix a lot of broken links and it got me wondering again if there were any suggestions or ideas

The best convention I've come up so far is something like the to-from pairs below, BUT it's all manual, keeping track of current cite number, inserting the matching anchors / links, etc.

In the text file

Code:
blah blah blah blah blah blah blah blah blah.
<a class="cite" id="chap02_cite01" href="notes.xhtml#chap02_note01">[1]</a>
blah blah blah blah blah blah blah blah blah

In the Notes file

Code:
<p class="note" id="chap02_note01">
<a href="chapter_2.html#chap02_cite01">[1]</a>
blah blah blah.</p>

Thanks
phossler is offline   Reply With Quote
Old 10-17-2014, 09:35 AM   #9
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by BetterRed View Post
IIRC when the idea of editor plug-ins first came up, some folks wondered what they might be used for - this seems a possible candidate.
Well I have my own personal Java program I use to automatically renumber footnotes back/forth, although it is very buggy/finnicky.

It just goes through and looks for every "<sup>#</sup>" and begins counting up from 1 to end of chapter, creating links in this form:

Code:
<a href="#fn9" id="ft9">[9]</a>
Then it hits an "<hr />" which I place at the end of every chapter, right before every Footnote section. This signals for it to flip, and look for every "<sup>#</sup>" and begins creating links pointing in the other direction.

Code:
<a href="#ft9" id="fn9">[9]</a>
The features it needs + bugs are many though:
  • Doesn't take into account if there are a mismatching number of footnotes
    • Might generate 100 footnotes in the text, but 99 or 101 footnotes pointing back.
    • This is most likely an OCR error, OR, an actual mistake in the physical book.
  • It can't handle mathematical superscripts (think "x^2" or "x^(2x+b)")
    • I get around this by manually changing those to <span class="superscript">, run my program, and then fix those back to <sup>
  • If you have multiple non-numbers in a superscript, it only keeps the first character.
    • This is due to the way I crappily test/replace what is in the superscript
  • Can't handle symboled/lettered footnotes.
    • (*, †, ‡, §, ‖, ¶, **, ††, ...)
    • (a, b, c, d, e, ...)
      • There should also be a toggle to all footnotes (number + lettered + symbol) in the same renumbering flow, or all of them in a separate renumbering flow.
  • There should be a toggle to be able to point out when the footnote it is replacing it with does not match the actual text number
    • For example, if the text is "<sup>10</sup>", but my program reaches this and believes it should be replaced with a number 11. Either the text is wrong, or the program is wrong. It should be able to point this out, or allow manual intervention.
    • I work on a MASSIVE amount of OCR stuff, and these errors are quite common
      • Missing footnote number in the text
        • The actual text might have jumped from a superscript 3 to a superscript 5.
      • Missing footnotes at the bottom of the page
      • Accidental footnotes that have disappeared into thin air from the OCR
      • OCR missed the little tiny superscript.
      • Same footnote number showing in multiple places in the text
        • The text might have a superscript 3, followed by another superscript 3.
      • ...
  • Should be possible to feed it an array of "what the total number of footnotes per chapter SHOULD be"
    • If the program generates footnotes correctly, Chapter 1 should have 100 footnotes, Chapter 2 should have 50 footnotes, Chapter 3 should have 89 footnotes...
      • This is a step I have to manually do during the A/B comparison of EPUB/PDF.
  • Should have a toggle to either count from 1 -> end of chapter, or 1 -> end of book.
  • I always imagined it would be FANTASTIC to be able to see two arrays of the text side by side. The paragraph with the link to + the corresponding paragraph with the link from. So you can easily see if they match. (This would save me SO MUCH WORK on the A/B comparison with the PDF).
    • Currently, I just go through and take a random sampling of footnotes per chapter to see if they match.

I really should get around to programming it better, although I would rather focus my time on many other higher priority projects (or digitizing many more books). It works ok for me, and I am used to the bugs, so I get around them beforehand.

Quote:
Originally Posted by phossler View Post
The best convention I've come up so far is something like the to-from pairs below, BUT it's all manual, keeping track of current cite number, inserting the matching anchors / links, etc.
We had a huge footnote discussion in this thread. I gave real life examples, plus my reasoning for all of it:

https://www.mobileread.com/forums/sho...d.php?t=225045

The important thing is to be CONSISTENT.

(Of course, you can also expand upon it to make it more explicit):

Code:
<a href="../Text/01.xhtml#fn9" id="ft9">[9]</a>
<a href="../Text/01.xhtml#ft9" id="fn9">[9]</a>
or something like this:

Code:
<a href="../Text/01.xhtml#fn01.9" id="ft01.9">[9]</a>
<a href="../Text/01.xhtml#ft01.9" id="fn01.9">[9]</a>
That might help if you do a lot of splitting of HTML files, want to easily go from Footnotes to Endnotes, or want to make sure that tools like Calibre doesn't break the relative links if converting to format XYZ.

Last edited by Tex2002ans; 10-29-2014 at 03:48 PM.
Tex2002ans is offline   Reply With Quote
Old 10-19-2014, 10:03 AM   #10
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Great answer

I don't do any OCR stuff, mostly just try to clean up PD books to make them readable (to me at least). Usually just (mostly) involves cleaning a lot of CSS, but I've started importing a 'standard' style sheet for the basics and a font-specific (or two) style sheets.

Yea, not really footnotes, but more 'end of book' notes. I put them into a separate file just to be neat.

The usual problem is caused by a poorly converted book -- I can spot them because that have 3-5 Calibre inserted TOC files


Edit: I was trying to just make adding / correcting the 'back and forth' references to return to the source point after jumping to the endnote

Last edited by phossler; 10-19-2014 at 12:04 PM.
phossler is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking to an image EbookNoob ePub 9 05-12-2013 02:39 AM
linking between books? xmlgirl ePub 8 05-19-2012 04:23 PM
Linking to a website Rivka General Discussions 1 07-20-2011 06:41 PM
anyway of linking Mobipocket ratt1972 Calibre 4 07-09-2010 10:48 PM
What are you linking? gvtexas Lounge 14 02-29-2004 12:11 AM


All times are GMT -4. The time now is 01:06 AM.


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