Page MenuHomePhabricator

Handle parser functions returning raw html
Closed, DuplicatePublic


Parsoid uses the expandtemplates API call to expand parser functions -- but some parser functions can return raw HTML.
In this case, a call to expand x{{#rawhtml2:<a href="">Mahalo</a>}}y'''z''' like:


will return:

    "expandtemplates": {
        "wikitext": "x<a href=\"\">Mahalo</a>y'''z'''",
        "modules": [],
        "modulescripts": [],
        "modulestyles": [],
        "jsconfigvars": {}

and this will be mangled by parsoid, since the return value is treated as wikitext and <a> is not valid wikitext.

We probably need to add a new core API specifically for "expand parser function" (not surrounded by wikitext), which can return the isHTML flag from the parser function.

See also: T178584: Remove insertStripItem workarounds from parser function implementations

Event Timeline

Arlolra triaged this task as Medium priority.Dec 11 2017, 10:56 PM

Even though this is older than T279094, I am closing this as a dupe of the other one because that other one has more activity and notes.