View Single Post
Old 11-27-2021, 12:15 PM   #6
lomkiri
Groupie
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
Posts: 167
Karma: 1497966
Join Date: Jul 2021
Device: N/A
Well, if all your note-anchors and note-bodies are on the same form, those two regexes will do the job:
Code:
Note-anchors:
class="noteref">\K(\d+)(</a>)
note bodies:
\[<a href=[^#]+#back_note_\d+" title="\d+" class="calibre\d+">←\K(\d+)(</a>\])
The function is still the same for both form.

Although it's possible (and not difficult) to adapt the numbers inside the tags (back_note_3, note_3), for the sake of simplicity I didn't touch to them, only to the displayed numbers. When you'll add your own note, e.g. 80, put 80a as numbers in the tags, to avoid duplicated links:
<a id="back_note_80a" href="notes.html#note_80a" title="80a" class="noteref">80</a>

Don't forget to:
1) back-up you book first
2) change the value of "start_at" in the function
3) See the differences after a replace all, to check if it went as you were expecting
4) Check the book with the bug-icon or with F7
5) Check some notes liink to see if they are still working properly
lomkiri is offline   Reply With Quote