Skip to content

Commit

Permalink
Bug fix. If you had footnotes like ^1 and ^10 the former would be use…
Browse files Browse the repository at this point in the history
…d for the latter.
  • Loading branch information
breck7 committed May 7, 2023
1 parent 6e040f3 commit 01f85bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion grammar/aftertext.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ abstractAftertextParser
replaceNotes(originalText) {
this.root.footnotes.forEach((note, index) => {
const needle = note.firstWord
if (originalText.includes(needle)) originalText = originalText.replace(needle, `<a href="#${note.anchorId}" class="scrollNoteLink" id="${note.linkBack()}"><sup>${note.noteId}</sup></a>`)
const {linkBack} = note
if (originalText.includes(needle)) originalText = originalText.replace(new RegExp("\\" + needle + "\\b"), `<a href="#${note.anchorId}" class="scrollNoteLink" id="${linkBack}"><sup>${note.noteId}</sup></a>`)
})
return originalText
}
Expand Down
2 changes: 1 addition & 1 deletion grammar/footnotes.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ footnoteDefinitionParser
// In the future we could allow common practices like author name
return this.noteIndex
}
linkBack() {
get linkBack() {
return `noteUsage${this.noteIndex}`
}
get text() {
Expand Down

0 comments on commit 01f85bc

Please sign in to comment.