12-03-2018, 11:08 PM | #1 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Regrouping all footnotes in the same folder
Hi
This is a practical problem I am facing when I try to rebuild footnotes. It's quite easy to do it when all your footnotes definitions are grouped within the same folder, presumably at the end or near end of the book. Unhappily many times, the definitions are placed at the end of each chapter and are thus scattered through the book. And some books may have 100 chapters. Picking up manually all the footnotes and pasting them in a dedicated folder thus becomes a very tedious task. Even if this ancillary task cannot be totally automated, I wish a middle ground could be found which would make this process a bit easier. After all the Calibre editor can use powerful functions which maybe could be used for this purpose (?). Has somebody any idea how to improve this situation? Last edited by roger64; 12-04-2018 at 08:27 AM. |
12-04-2018, 04:06 AM | #2 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
I use a search/replace battery:
Code:
1- Search: <p>\[(\ d +)\] (or whatever may apply) Replace with: <p class="nota" id="n\1">[\1] 2- Search: (<p class="nota")>\[(\d +)\] Replace with this function: def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs): return match.group(1)+' id="n'+match.group(2)+'"><a href="../'+file_name+'#r'+match.group(2)+'">['+match.group(2)+']</a>' 3- Search: (<p class="nota".+?>.+?</p>) Replace with this function: def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs): notas = open('e:/Libros/Taller/En curso/notas.txt', 'a') texto = match.group()+'\n' notas.write(texto) return '' replace.file_order = 'spine' I manually create this last file, and make a copy/paste with the data of notas.txt. |
Advert | |
|
12-04-2018, 05:42 AM | #3 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Hi
Thank you very much for this helpful solution that I'll test quickly. As you probably know, there is a Sigil plugin named "FootnoteLinker" which creates (or recreates) the missing links in some few seconds using a semantically named single folder for definitions. This function should handily complement this above plugin. |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Reimport books from another folder to Calibre folder structure? | mendhak | Calibre | 2 | 10-11-2013 01:18 AM |
Footnotes | dicknskip | Sigil | 11 | 12-14-2012 12:51 AM |
Footnotes? | S Otteson | Sigil | 11 | 01-26-2011 10:14 PM |
sub-folder support for documents folder? | sark666 | Kobo Reader | 5 | 08-31-2010 05:35 AM |