View Single Post
Old 02-12-2020, 06:02 PM   #30
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,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by thymesnewroman View Post
I've uploaded chapter one (aka index_split_006.xhtml).
Thanks for the attachment.

I say go full nuclear. Wipe out all the crap links, substitute with good ones.

(I tested this on your "index_split_006.xhtml" and it worked perfectly on all footnotes in that chapter.)

Full Nuclear Option (For This Book)

1. In Sigil, press Ctrl+F to pop up the Find/Replace.

Make sure you set Mode: Regex.

Click image for larger version

Name:	Sigil.Find.Replace.Regex.png
Views:	164
Size:	5.0 KB
ID:	177103

2. Once you have it set to Regex...

These will wipe out all the busted links and substitute them with the number in brackets:

Search: <a class="[^"]+" href="[^"]+"><span class="[^"]+">(\d+)</span></a>
Replace: <a href="#fn\1" id="ft\1">[\1]</a>

and then these 3 will wipe out the broken anchors and fix the Footnotes:

Search: (<p class="[^"]+">)<span class="[^"]+" id="[^"]+"></span>
Replace: \1

Search: (<p class="[^"]+">)<a class="[^"]+" href="[^"]+"><span class="[^"]+"></span></a>
Replace: \1

Search: (<p class="[^"]+">)<a href="#fn[0-9]+" id="ft[0-9]+">\[([0-9]+)\]</a>
Replace: \1<a href="#ft\2" id="fn\2">[\2]</a>

(Completely Optional) If you want to throw away the other anchor code:

Search: <a class="[^"]+" href="[^"]+"><span class="[^"]+"></span></a>
Replace: ***[Blank] PUT NOTHING***

3. After you're done, make sure to go back to Case Sensitive Mode.

Last edited by Tex2002ans; 02-12-2020 at 06:17 PM.
Tex2002ans is offline   Reply With Quote