On 05/14/2021, at 14:04, Cooper Cavalier <[email protected] 
<mailto:[email protected]>> 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.


Hey Doug,

If I've understand correctly all footnote references are going to look like: 
_ftn18 and [18].

What think I would do is (without having seen the full scope of the problem):

A) Split off all of the footnotes into their own file.

B) Write a regular expression or a script to massage all of the footnotes into 
their new format.
     - Leaving the footnote reference as a prefix to the new reference.
     - Make sure each footnote is formatted such that they all may be easily 
read into an array.

C) Read the footnotes into an array (in Perl for me).

D) Iterate through the array and find the matching footnote ref in the body 
document.
     - Make the appropriate substitutions.


Another alternative (for me) would be to do the job with BBEdit and AppleScript 
using the same general methodology, except that I'd use the page of footnotes 
as the array.

Pros:

  - Easier to prototype and visualize.

Cons:

  - Much slower execution time.

--
Best Regards,
Chris
/

-- 
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/490C80DA-9C16-46CC-93A6-6CF919B207E8%40gmail.com.

Reply via email to