EDIT: Disregard this question, I solved it using regular expressions (I thought they wouldn't work in this scenario but they did)
I'm working on a translation of a text which is divided into short, numbered sections. It looks something like this:
Following his departure from Athens, the general decided to [...]
It was around this same time that the Egyptian king was assassinated, and the realm was thrown into chaos.
Now, these numbered sections are contained within their own
<p> tags, so these numbers are directly preceded by a
<p>, like so:
<p>55. Following the events of the Spring[...]</p>
I have a completed epub, comprised of 8 html files, each file containing roughly 150 sections numbered 1 through 150 and beginning again at number 1 in the next html file. The ebook itself is separated into chapters one through eight, corresponding with the numbers of the html files.
Now here's the catch: I have another translation. I would like to include this alternative translation in the same ebook, with the numbered sections containing a hyperlink to the alternative translation. This would be done by containing the numbers inside
<a href=""> tags which also link to the corresponding number in the alternative translation, like so:
<p>68. The king liked cats.</p>
<p><a href="[ALTERNATIVE LINK TO SECTION 68]">68.</a> The king liked cats.</p>
But after clicking the "68." link to read translation #2, it would be nice to have a link which circles back to translation #1, which will be contained in the second translation's "68."
So, effectively, I already have the necessary markers to designate the place and the contents of the
<a href=> tags, the only thing that I lack is a way to automate this process, since I have well over 1,000 numbered sections to link back and forth to each other. I'm a noob when it comes to ebooks so I'm not even sure if it's possible, I mainly mess around with Calibre and it seems like such a thing may be possible using the Python functions, but I have no idea where to start.