The tag-style syntax:
```
<ext foo="bar">
baz
</ext>
```
can be mapped to template-style syntax:
```
{{#tag:ext|foo=bar|baz}}
```
This mapping plays very nicely with heredoc arguments (T114432):
```
{{#tag:ext|foo=<<<
bar
>>>|<<<
baz
>>>}}
```
...which allow the body of the extension tag to contain arbitrary text, but with improved escape mechanisms -- extension tags can be nested, for example.
Given this mapping, it would be useful for TemplateData to apply to extension tags as well, so that if, for example, the `caption` attribute of the `<gallery>` extension were parsed as full wikitext (instead of some strange almost-wikitext) it could be described on a page named (eg) `TemplateData:Ext:gallery` as:
```
<templatedata>
{
"params": {
"1": {
"label": "Gallery body",
"type": "string",
"required": true
},
"caption": {
"label": "Caption",
"type": "content",
"description": "The caption for the entire gallery"
}
},
"description": "Gallery extension"
}
</templatedata>
```
This would also guide/simplify serialization. For simple values of attributes (no newlines, no quotes), we'd use the `<ext attr="...">` syntax for the extension, but as soon as the attribute value got "complicated" we could switch to the `{{#tag:ext|attr=<<<...>>>}}` syntax.