Previous fix didn't work, it resulted in empty exerciselists
The core problem is that, before all the internal links are
resolved, they are sphinx.addnodes.pending_xref nodes. These are
used to record "this will be an internal reference", and are
resolved later, once all the pages are read in (since clearly, some
can't be resolved if the other pages are not yet read in)
After several other attempts, inserting the transform hook in a
different place (as a post_transform, not doctree-resolved), it
seems that I can insert the nodes before the cross-references get
resolved, and then things work.
Review: someone who knows sphinx internals could check it out, but
realistically that is just me. I will merge when I check the
results and hope for the best.
Previous fix didn't work, it resulted in empty exerciselists
The core problem is that, before all the internal links are resolved, they are sphinx.addnodes.pending_xref nodes. These are used to record "this will be an internal reference", and are resolved later, once all the pages are read in (since clearly, some can't be resolved if the other pages are not yet read in)
After several other attempts, inserting the transform hook in a different place (as a post_transform, not doctree-resolved), it seems that I can insert the nodes before the cross-references get resolved, and then things work.
Review: someone who knows sphinx internals could check it out, but realistically that is just me. I will merge when I check the results and hope for the best.