Closed p-kleczek closed 7 months ago
The problem is caused by implicit note rendering instruction inserted at the end of each page that contains RN references (including the pages being included). So when rendering reaches the end of included page, there would be rendering of all notes from the included page but also all notes referenced by the "parent" page up to than moment.
The main idea for the fix is to disable implicit note rendering on the included pages, so that the parent page will take care of the note rendering for all references. The Include plugin actually does apply some sanitizing to the included page instructions for various plugins. So this issue could be partially fixed in the Include plugin by removing the implicit note rendering instructions before the included instructions are merged into the parent page.
But there is one more part to the puzzle. If parent page has no references, there will be no notes rendering on that page, and with notes rendering removed from the included pages there would be a bunch of dead links for references and no notes. So instead of relying on Include plugin, I'm trying to deal with includes in RefNotes by blocking implicit rendering inside the included sections and by adding implicit rendering if there were any includes.
This should address at least the basic use cases. If there are explicit note rendering blocks on included pages, they still will be rendered and may pick up references from the preceding part of the parent page. I didn't really test that, but it should be possible to keep them apart by carefully partitioning the references into separate namespaces.
Fixed by c34c58e.
The problem occurs when RefNotes are used in conjunction with "include" plugin.
Let's say we have two pages (A and B) and page B is include into page A as follows:
The problem is that references are rendered in multiple places on page A:
but in fact it's even more messed up :(
Here's a sort of MWE for this case:
Page A:
Page B: