Old

convertNoteRefASTV2 {

}
convertNoteRefASTV2 {

    noteRefs = gatherNoteRefs

    ...

    fname := link
    note := fname
    ...
    processRef(note)
}


processRef(note) {
    if shouldApplyPublishRules && !canPublish { return }
    body = note.body

    convertNoteRefHelperAST(body)
}

convertNoteRefHelperAST {

    noteRefProc = new proc
    bodyAST = noteRefProc.parse(note.body)

    footnotes = extractFootnoteDefs(bodyAst)
    prepareNoteRefIndices(bodyAST)
    data = noteRefProc.runSync

}