On Wed, Mar 4, 2015 at 10:34 AM, Rusty Burchfield <[email protected]>
wrote:
> In short, the extension adds a tag which displays a table of all the
> invocations of a given template.
>
That could be a **lot**.
> Currently this is implemented by fetching the text for each page a
> template is referenced on and searching for braces (eg. {{ }}).
>
> I was thinking that running the text through the parser and hooking
> all the template expansions to grab the params would be more robust.
>
It would also change behavior: with the old method you won't detect
invocations of one template that are invoked from inside another template,
while you will with the new method.
Unless the old method is already being recursive, I suppose.
> 1. Any opposition to adding a hook in the parser called every time a
> template is expanded (with the template name and parameters as args)?
>
Template expansion happens a lot, so adding a hook in there might have a
measurable impact on page parse times even when nothing implements the hook.
> 2. Any hints as to where in the parser would be a good place to add that
> hook?
>
Parser::braceSubstitution() is about your only option, near the call to
$this->getTemplateDom().
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l