Page MenuHomePhabricator

Support for parser functions using "isHTML"?
Open, MediumPublic

Description

Esoteric flags like "isHTML" don't fly with Parsoid

https://github.com/wikimedia/mediawiki/blob/master/includes/parser/Parser.php#L4895

Currently, Parsoid expects parser functions to return wikitext during preprocessing. However, the presence of this "isHTML" flag means that some parser functions return html that the legacy parser armours for them. That's what is happening in T257344

Maybe they should do something that's more aware of the $parser->getOutputType()? That's what the patch in T257344 tries to do so that only wikitext is return when preprocessing.

Something to be aware of when designing Parsoid's setFunctionHook in T268144

Event Timeline

Arlolra triaged this task as Medium priority.Apr 1 2021, 6:23 PM
Arlolra moved this task from Needs Triage to Missing Functionality on the Parsoid board.

Change 676436 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/extensions/CategoryTree@master] Help Parsoid out by returning an ext tag when preprocessing

https://gerrit.wikimedia.org/r/676436

Change 676436 merged by jenkins-bot:

[mediawiki/extensions/CategoryTree@master] Return an extension tag when preprocessing a parser function

https://gerrit.wikimedia.org/r/676436

Looks like for wikimedia deployments, there are only 2 extensions that are impacted. CategoryTree (which Arlo has fixed up above) and WikimediaIncubator which needs fixing.

But, outside WMF, this feature is used heavily! So, the question is if we should try to fix this now OR after WMF switches over and we build Parsoid support for parser functions.

I did look into what is involved in fixing this. This will require a patch to Parser.php's insertStripItem to distinguish HTML strip items from others which is easy -- we can recover the isHTML flag from there.. It will also require us to change the DataAccess interface to pass through the 'isHTML' property all the way to TemplateHandler where we would need to wrap the output in a DocumentFragment, etc. just like ExtensionHandler.

Not too hard and doable.

But it may bew worth postponing this to post read views once we fix up WikimediaIncubator Extension as well. That extension is only used on incubatorwiki.

The infopage parser function which depends on this doesn't seem to be used as far as I can tell. So, for now, we can competely deprioritize this work till read views work on the wikimedia cluster is complete.

Change 904628 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/core@master] [DNM]: Use special strip markers for HTML from parser functions

https://gerrit.wikimedia.org/r/904628

Change 904628 abandoned by Subramanya Sastry:

[mediawiki/core@master] [DNM]: Use special strip markers for HTML from parser functions

Reason:

https://gerrit.wikimedia.org/r/904628