Page MenuHomePhabricator

Add a generic extension registration mechanism
Closed, ResolvedPublic

Description

We need a way to register custom extensions from localsettings.js. These should provide handlers that work on the token stream (by emitting tokens) or on the DOM (by converting the extension tag into an HTML DOM), and in the serializer (to convert an extension node back to wikitext).

The details are hashed out in https://www.mediawiki.org/wiki/Parsoid/Extension_registration_interface.


Version: unspecified
Severity: normal

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
OpenNone
ResolvedEAkinloose
Resolvedmatmarex
ResolvedNone
ResolvedNone
Resolvedmatmarex
Resolvedmatmarex
Resolvedssastry
OpenNone
ResolvedArlolra
ResolvedEsanders
OpenFeatureNone
OpenFeatureNone
ResolvedArlolra
OpenNone
OpenNone
ResolvedArlolra
ResolvedArlolra

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:58 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz53874.
Arlolra set Security to None.

Most extensions (both tag extensions and parser functions) operate independently and directly return the expected content. This enables parallel processing, caching and fairly straightforward preview of individual invocations in VE.

In the WMF projects the only exception to this rule is Cite, which needs to collect all citations in a page. I would caution against supporting general global content processing from extensions beyond Cite unless there is a really good reason to do so. In most cases I think it would be preferable to directly return the expected content from the parser function or tag extension.

Change 256171 had a related patch set uploaded (by Arlolra):
WIP: Add a generic extension registration mechanism

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

Change 256171 merged by jenkins-bot:
Add a generic extension registration mechanism

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

The mechanism exists ... but documenting the exposed API and determining the appropriate helpers will come as we iterate on a few use cases.