I was experimenting with using the
onOutputPageParserOutput hook [1]
(running based on the current skin) and think it might be a better
approach to run the transformations on smaller chunks of data. For
instance the table of contents is known to be in the lead section so
it seems like it would be more efficient to look for it there rather
than throughout the entire document. The solution is not complete but
provides an approach that I think would be more efficient on the long
term.
Not to nitpick, but in your particular example one can use the __TOC__ magic word you can
place the table of contents wherever you want in the document.[0]
At least in that case, parsing the entire document might be best.
/me goes back to lurking.
Thank you,
Derric Atzrott
[0]:
https://www.mediawiki.org/wiki/Help:Magic_words