Jump to content

Topic on Talk:Parsoid/Extension API

"styles" (and other modules)

4
Summary by SSastry (WMF)

Clarified the language to avoid confusion.

Anomie (talkcontribs)

Why are styles being declared via getConfig()? It seems unlikely that there will actually be styles that need to be added to every page.

I'd expect that styles would be added added as needed when the wikitext is processed, much as how DataAccess::parseWikitext() or ::preprocessWikitext() currently include 'modules', 'modulescripts', and 'modulestyles' as part of their returned data.

SSastry (WMF) (talkcontribs)

I don't fully understand your comment. But, when Parsoid processes an <ext> tag, how would it know what modules to add? ... ah, are you saying since we are using the same extension.json mechanism as core, the modules will be handled by the DataAccess interface that Parsoid uses?

Anomie (talkcontribs)

Maybe I misunderstood.

It sounds to me like the document is currently saying that all modules added have to be declared up front, and will be added whether or not the <ext> tag actually appears in the wikitext. "When Parsoid process the <ext> tag" is exactly how I'd think modules should be added. The specific mechanism (DataAccess or something else) doesn't matter to me.

Tgr (WMF) (talkcontribs)

I'd imagine if the extension tag does not appear Parsoid never invokes the hooks for that extension and does not add any modules. But yeah, I can easily imagine cases where the modules need to be selected dynamically (TemplateStyles would have been an example, had head styles been considered more performant than body styles).