Can IndexMatic address both footnotes and endnotes?

An endnote text appears in a new frame (the endnote frame) at the end of the document or attached story. For the time being, IndexMatic does not manage this CC component. In the above example, the endnote frame (page 124) is in principle beyond the reach of the script.

So if you select the option Footnotes: All and run a query intended to capture some words in this French document —say /route|mer|marin|trésor|coffre/

Trying to get data from the notes…

then IndexMatic retrieves all it can from both the story and its footnotes, but nothing comes up from page 124, as shown below.

The endnote page is ignored (so far.)

However —call it a bug or a happy side effect!— there is a funny thing: tell IndexMatic to ignore anchored/inline blocks,

Make IndexMatic ignore anchored/inline blocks, and re-build your index…

and re-run your query in the same conditions. Now both footnotes (page 123) and endnotes (page 124) are scanned and reported in the index:

The endnote frame is magically seen!

There is no apparent link between anchored frames and endnote frames. (And in fact, there is no obscure link either!) This hidden access to endnotes is a pure accident, related to a technical optimization of the script:

a. In case IndexMatic is told to ignore anchored objects, it scans pages using a fast instruction — page.textFrames.everyItem() — which allows it to skip a critical test. Namely, it no longer has to check whether the considered object is a TextFrame instance. Luckily, endnote frames essentially work as basic text frames and are properly listed in the TextFrames collection of a page. So IndexMatic will treat those foreign objects as if they were regular text containers :-)

b. Conversely, when IndexMatic needs to explore anchored objects as well a regular frames, it uses a different strategy, based on the allPageItems collection. Then it filters out any component which is not a pure TextFrame, based on an explicit test of the form (myObj instanceof TextFrame). Then, EndnoteTextFrames are ignored :-(

This trick cannot deal with any document structure though. In particular, I have assumed that you don't want to capture text in actual anchored frames!