cu-mkp/fieldnotes-restructuring

Update all URLs inside HTML files to reflect new folder structure

Opened this issue · 0 comments

With the new folder structure established in the mapping, it is necessary to update the <a> tag href links in every file to reflect the new locations of the files they point to.
I imagine the simplest algorithm to do this would be:

1. Iterate over the files in the second column of mapping.csv.
2. For each file, parse the HTML content for <a> tags with href attributes pointing to any string in the first column of mapping.csv.
3. For each of those tags, replace the href attribute value with the corresponding new value implied by mapping.csv.

The biggest question is how to parse and update the HTML safely, quickly, and elegantly.