Writing MediaWiki template code is tedious and error prone for all but the most simple cases (e.g. as soon you start to add some logic to a template).
Example: https://de.wikipedia.org/w/index.php?title=Vorlage:Denkmalliste_%C3%96sterreich_Tabellenzeile&action=edit
Current problems:
- spaces and line breaks in template code are partly propagated to the transclusion of the template and will eventually break the generated wiki-code. This is especially true in templates generating tables, having their own critical handling of spaces and line breaks. Prettyprinting the code ist almost impossible and readability of the code is a nightmare.
- there are no variables, so code often has to be duplicated
- a lot of curly braces (2 for the parser functions and 3 for the argument): {{#if: {{ {{PAGENAME}}{{{arg1|}}}}}}}. Makes it rather difficult to get the correct matching braces.
- there are interferences between template and table syntax (e.g. regarding the pipe)
- errors in heavy used templates can break a lot of pages
- replacing template code by Lua IMHO is not the solution, as we do not have that many lua programmers. And for private MediaWiki installations Lua might not even be activated.
- VisualEditor does not even try to support template code
It would be fine to have a syntax sensitive editor for MediaWiki template code (as we have one for various other languages like css, js, lua, ...) with at least:
- T261857 highlighting of matching braces, apostrophes, parser commands, template pipes vs. table pipes, more fancy stuff ...
- highlighting of syntax errors, warnings, infos,
- do automatically prettyprint the code when editing and remove such temporary formatting when saving the code.
- T30684 code folding / unfolding
- T95100 syntax based proposals when typing (e.g. parser commands, parser extensions, ...)
- integrated in the MediaWiki core as the standard editor for template code
Would make it easier to write better template code. And broaden the number of people willing to write template code.