FragmentHandlers define a domToSource method (see T250530 / https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/747211) but it is not currently invoked. We use the default html2wt handling, which seems sufficient for now.
Description
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Open | None | T388786 Follow up from Parsoid Fragment support | |||
| Open | None | T390343 Implement html2wt support for FragmentHandlers |
Event Timeline
From https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/1087277/75/src/Ext/FragmentHandler.php:
I'm not 100% sure what this should look like. This should reconstruct all of the arguments (including the first one for "body content" in the case of <ext> syntax) given the DOM, but (a) ideally leave it up to WTS to properly wikitext-escape those arguments for the given tag syntax, and (b) provide a way to delegate attribute serialization to parsoid. Eg:
{{#tag:ext|{{foo}}|name=<b>"bar"</b>}}Assuming that the two arguments showed up literally in the output of the parser function, we would delegate those two subtrees to core to yield '{{foo}}' and '<b>bar</b>' but this handler would package them as arguments 0 and 'name' and return it to parsoid to put the final {{#tag}} wikitext together, or apply the proper escaping if the alternate syntax was desired:
<ext name="<b>"bar"</b>">{{foo}}</ext>That is, the extension author's ::domToSource() method shouldn't care about which syntax was used, or the precise escaping rules needed to get a particular wikitext string into the arguments.