I suggest to extend the existing "format": "…" parameter of <templatedata> to not only accept inline and block but an actual format string (or add a new parameter for that). Typical format strings would look like these:
- |_=_ is the same as inline.
- | _ = _\n is the same as block.
- |_ = _\n does not add a space before the parameter name.
- |_ = _\n indents each parameter.
- |_______________ = _\n aligns all parameter names to that length. Or more if the parameter name is longer (it can not be cut, obviously), but will always have spaces before and after the equal sign.
- |\n_ = _ is a format with the pipe characters at the end of the previous line.
- |_ = _ is an inline style with much more spaces.
I'm currently using this format in my Auto-Formatter wikitext cleaner, see de:User:TMg/autoFormatter #Vorlagenformatierung for the documentation and de:User:TMg/autoFormatter.js for the (ugly) code. More examples can be found at the bottom of my de:User:TMg/common.js.
There are "magic" edge cases my tool considers:
- |_=_ is the minimum that must be in the format string. My tool adds missing elements. TemplateData should output an error if something is missing.
- If the format string ends with a newline, an extra newline is added between the template name and the first parameter.
- If there is a newline somewhere in the format string, the closing }} is always put on an extra line, no matter what the format string says. My tool makes sure to never create duplicate newlines.
- Spaces on line endings are allowed. For example, |_ = _\n means there will be a space at the end of the line when the parameter is empty.
- A single _ does not create an extra space when the parameter is empty.