Topic on Manual talk:Extension.json/Schema

ParserFunctions in extension.json

3
Emwiemaikel (talkcontribs)

My extensions provides a couple of new parser functions. I would expect, that it should be possible to specifiy this in extension.json. Currently I still have to add

$parser->setFunctionHook( 'example', [ self::class, 'renderExample' ] );

in sth. that gets called by onParserFirstCallInit.

Is it only me, or is there a real reason why not to support ParserFunction registrations directly in extension.json?

Legoktm (talkcontribs)

No one had ever really asked and the ParserFirstCallInit hook is more expressive and flexible than what can be done in JSON. It doesn't really eliminate much boilerplate mostly because you need a PHP/Hooks file anyways for the actual parser function/tag.

What do you think the advantage would be in registering directly in JSON?

Emwiemaikel (talkcontribs)

Of course you are right, we need PHP classes to implement the parser function. But the same holds for special pages, which can be registered in extension.json.

I was just wondering if I overlooked something or if there actually is a difference. Thanks for confirming.

Reply to "ParserFunctions in extension.json"