On 14 May 2021, at 12:04, Cooper Cavalier wrote:
I have a text/html file which has thousands of endnotes. The file has
the
inline endnote reference as [1], [2], [3], etc. which correspond to
the
appropriate endnote. For the app publisher I am working for, the
endnotes
must be placed in line with specific coding.
I am totally stumped in finding a way either inside of Bbedit or using
a
Python script. I am doing this editing on a Mac.
Looks like a script would make a pass through the doc to find all the
inline links and match them to their endnotes (confirming, too, that the
end note exists and that every link has an endnote).
Perhaps the result of that first pass would be a lookup hash of the
relevant info for each citation instance, with the ref numbers as the
hash’s keys.
Then a second pass: regex matching on the overall pattern of the
citation link with a () capture of the ref number. The ref number is
then looked up in the hash, and the citation info stored there is
substituted for the original citation link verbiage.
I can’t guide you for doing this in Python, but I assume it has regex
etc capabilities to do the above; Perl, my preferred programming
language, wrote the book.
If the above possible approach still requires you to devote more time
than you have to expanding your scripting-fu, there are several
scripting adepts on this list who might offer scripts in Perl,
Applescript, Javascript, Python, and of course multi-step find/replace,
text factories, etc in BBEdit.
HTH
*Currently the inline link looks like this:*
<p>It has been estimated that about one-fifth of Jesus' teachings was
about
money matters.<sup><a href="#_ftn19" name="_ftnref19">[19]</a></sup>
*The endnote looks like this:*
<h3 pb_toc=index><a href="#_ftnref18" name="_ftn18"
title="">[18]</h3><sup>[18]</sup></a>See Werner G. Marx, "Money
Matters in Matthew," <i>Bibliotheca Sacra</i> 136:542 (April-June
1979):148-57.
*It needs to instead look like this:*
<p>It has been estimated that about one-fifth of Jesus' teachings was
about
money matters.<pb_endnote>See Werner G. Marx, "Money Matters in
Matthew," <i>Bibliotheca Sacra</i> 136:542 (April-June
1979):148-57.</pb_endnote>
Any help would be deeply appreciated since there is no way I can do
this
manually.
Thank you!
Doug
--
This is the BBEdit Talk public discussion group. If you have a feature
request or need technical support, please email
"[email protected]" rather than posting here. Follow @bbedit on
Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/5a5f865a-c7d9-4b55-8f2d-0fbdef43d406n%40googlegroups.com.
Thanks,
- Bruce
_bruce__van_allen__santa_cruz__ca
--
This is the BBEdit Talk public discussion group. If you have a feature request or need
technical support, please email "[email protected]" rather than posting here.
Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/4F4C96C5-C7B8-4493-89A0-C72B0F657B4B%40cruzio.com.