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 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.
---
In theory this might also encourage tags like `<gallery>` to move more of their parameters into attributes, instead of writing their own bespoke parsers of the freetext body of the tag. So optionally instead of:
```
<gallery>
File:Detroit Publishing Co. - A Yeoman of the Guard (N.B. actually a Yeoman Warder), full restoration.jpg|1
File:Official_program_-_Woman_suffrage_procession_March_3,_1913_-_crop.jpg|2
File:Thurston, the famous magician - East Indian Rope Trick.jpg|3
File:Joseph Ferdinand Keppler - The Pirate Publisher - Puck Magazine - Restoration by Adam Cuerden.jpg|4
</gallery>
```
we might eventually see:
```
{{#tag:gallery
|<<<File:Detroit Publishing Co. - A Yeoman of the Guard (N.B. actually a Yeoman Warder), full restoration.jpg|1>>>
|<<<File:Official_program_-_Woman_suffrage_procession_March_3,_1913_-_crop.jpg|2>>>
|<<<File:Thurston, the famous magician - East Indian Rope Trick.jpg|3>>>
|<<<File:Joseph Ferdinand Keppler - The Pirate Publisher - Puck Magazine - Restoration by Adam Cuerden.jpg|4>>>
}}
```
...or ultimately something similar which let you specify the filename as `TemplateData` type `wiki-file-name` and the caption as `TemplateData` type `content`. But that would require varargs support in `TemplateData`.