Greetings,
Thanks for the response!
In any case, it's likely that you're not entering the parser correctly. It should only be entered via one of the five entry points documented at the top of Parser.php: parse(), preSaveTransform(), preprocess(), cleanSig() and extractSections().
It's not entering the parser directly at all, the extension is just a function hook that returns:
return array($output, 'noparse' => false);
...and MW itself then sends the $output to the parser.
Anyway, since the failing code was within the section edit link generator, I figured the easiest way out was just to not generate section edit links for nodes that lack $this->title.
Maybe you just don't get what it is. This has an expansion depth of 3 but a frame depth of 0:
{{#if: {{#if: {{#if: x | y | z }} }} }}
If you had this:
[[Page]]: {{A}} [[Template:A]]: {{B}} [[Template:B]]: {{C}} [[Template:C]]: foo
then expanding [[Page]] would give you an expansion depth of 3 at "foo", and also a frame depth of 3.
That's fine -- we're importing structured content, so the #includes will be generated programmatically. As long as the recursive case (#2) works, and it does, we don't need to worry about the nested case (#1).
So the question remains: since the parser knows the expansion depth at any given point in time, can I check that depth from/expose that depth to the extension?
Cheers, -jani