We are adding a reliable argument quoting mechanism to {{...}} template syntax (T114432). For the sake of uniformity, it would be nice if all "macro insertion" syntactic constructs could be thought of as syntactic sugar for some invocation using the {{...}} syntax. This would reduce the number of strange and tricky argument-escape mechanisms needed: if you ever need to invoke a parser function/behavior switch/magic word/template/etc using reliable argument quoting (or need to serialize an edited instance of the same), then you can fall back to the {{...}} form. Some of these might be used infrequently enough that we can just deprecate the old forms; others are useful enough that they should remain as syntactic sugar.
Other tasks cover:
- [[File:...]] => {{#media:...}} (T90914: Provide semantic wiki-configurable styles for media display)
- <ext ...>...</ext> => {{#tag:...}} (T204283/T114432)
This task would be for the remaining cases, magic words and behavior switches:
- Behavior switches:
- __NOTOC__ => {{#notoc}} or {{#config|notoc}} or {{#set:notoc}} ?
- Variables: w/o arguments (probably low priority to migrate):
- {{CURRENTYEAR}} => {{#currentyear}} ? ({{#var...}} is already taken...)
- Many of these have "optional arguments" and so fall under either the "variables with arguments" or "parser functions" categories.
- Variables with arguments:
- {{PROTECTIONLEVEL:action}} => {{#protectionlevel|action}}
- {{PAGENAME:Template:Main Page}} => {{#pagename|Template:Main Page}}
- (These are already parser functions, they just need a hash-prefixed form.)
- Arguments and side effects:
- {{DISPLAYTITLE:title}} => {{#displaytitle|title}}
- {{DEFAULTSORT:sortkey|noerror}} => {{#defaultsort|sortkey|noerror}}
- Parser functions:
- {{PAGEID: page name }} => {{#pageid|page name}}
- {{urlencode:string|WIKI}} => {{#urlencode|string|WIKI}}
- {{padleft:xyz|strlen|char}} => {{#padleft|xyz|strlen|char}}
- {{int:message name}} => {{#int|message name}}
- {{:Title}} => {{#expand|Title}}
- Not sure where in the codebase this is actually handled?
- {{raw:Title}} => {{#raw|Title}} (also msg and msgnw)
- These are special cased in the parser; probably need a closer look
Note that the use of a colon to separate the first argument is especially problematic (see T204371: Replace initial colon in (hash-prefixed) parser function invocation with vertical bar). Also, from a readability perspective it would be nice if all of these used the leading # character to indicate to a human reader that these are special functions, not ordinary templates---but if we're feeling lazy those forms which don't take arguments and already use {{...}} syntax (albeit without a leading #) could probably be left alone without too much harm.
The goal being to allow all these weird special cases to use standard template/argument syntax, with reliable quoting for arguments, instead of having a weird collection of ad hoc mechanisms for allowing arguments. For example, this would Just Work:
{{#urlencode|<<< some weird [[ string ]] with | and = characters >>}}