Parsoid has its own extension API - see https://www.mediawiki.org/wiki/Parsoid/Extension_API.
In this first phase, we are targeting tag-hook extensions for migration.
The TemplateStyles extension needs an update to work directly with Parsoid.
Description
Description
Event Timeline
Comment Actions
Ok, here's are two Parsoid incompatibilities in TemplateStyles:
- TemplateStyles uses a MapCacheLRU hung off of a dynamic property attached to the Parser object. This isn't really compatible with Parsoid since we may create a new legacy Parser object for every extension tag, but it's *also* incompatible with PHP 8.2: T314099: PHP 8.2: Dynamic property creation is deprecated. This was "fixed" in T324890 but only by allowing dynamic properties temporarily. This cache also uses the ParserClearState hook, also not really supported in Parsoid (discussed in T250444) but also not needed since we don't have a global parser object we clear and reuse but instead create new parser objects when needed. The good news is that all of this cruft is just a "performance hack", so Parsoid technically works fine without any of it. The cache *should* be a separate standalone service injected with DI, not hung off the Parser.
- TemplateStyles has some language dependencies which (probably?) don't play nicely with the ParserCache. It appears that the intention is to render things in the ContentLanguage (not the user language), for example ::formatTagError, but the flip property uses $parser->getTargetLanguage() and $parser->getContentLanguage() and then compares their directionality. I'm not positive this even works correctly (getTargetLanguage() doesn't always do what you'd think) and even less certain that this is set up correctly on the legacy parser object created by Parsoid to handle extensions.
The actual <style> tag is stuffed into strip state, and then deduplicated in a post-processing pass. Pretty sure this part works fine with both parsoid and the legacy parser at least.