Hi, I am turning to you this time to ask for help with footnotes. I now have an article with php code in .txt format and I am editing it using Powershell. Everything has been successful except for the last thing. That is that I would need it to edit or add the following to each occurrence of <li> or <sup>: "<a id="note_X"> what should happen when X should increase by 1 after each replacement, i.e. for example the first one is found "<li>" and will be replaced by "<li><a id="note_1">", the next occurrence will be replaced by <li><a id="note_2"> and so on. I have tried these two solutions, but neither works:
if ($inFootnotesSection) {
if ($line -match "<li>") {
$line = $line -replace "(<li>)", "`$1<a id=`"note_$noteCounter`"></a>"
$noteCounter++
}
if ($line -match "<sup>") {
$line = $line -replace "(<sup>)", "<a id=`"note_$noteCounter`"></a>`$1"
$noteCounter++
}
}
if ($inFootnotesSection -and $line -match "<li>|<sup>") {
if ($line -match "<li>") {
$line = $line -replace "(<li>)", "`$1<a id=`"note_$noteCounter`"></a>"
}
if ($line -match "<sup>") {
$line = $line -replace "(<sup>)", "<a id=`"note_$noteCounter`"></a>`$1"
}
$noteCounter++
}
I’m still attaching the exact wording of the part of the text that doesn’t correct me:
... study.
</p>
<h1>Footnotes</h1>
<ol>
<li>Acknowledging the...
Would anyone know what to do about it? I can’t figure out what I’m doing wrong.