Page MenuHomePhabricator

Replace initial colon in (hash-prefixed) parser function invocation with vertical bar
Open, Needs TriagePublic

Description

AFAIK there's no good reason why the first (unnamed) argument in a parser function invocation is separated from the parser function name with a colon, rather than a vertical bar. We should try to make this uniform, at least when considering invocations with heredoc syntax T114432: [RFC] Heredoc arguments for templates (aka "hygienic" or "long" arguments).

Probably we just need to split on colon OR vertical bar during the initial parser function argument parsing, so that {{#tag:ext}} and {{#tag|ext}} are equivalent. Might require some linting to make sure this doesn't inadvertently break anything.

Related to T204370: Behavior switch/magic word uniformity and T204307: Parser Functions should support named parameters.

Event Timeline

cscott created this task.Sep 14 2018, 5:28 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 14 2018, 5:28 PM
cscott renamed this task from Replace initial colons in parser function invocation with vertical bar to Replace initial colon in parser function invocation with vertical bar.Sep 14 2018, 5:29 PM
cscott updated the task description. (Show Details)
Anomie added a subscriber: Anomie.Sep 14 2018, 5:57 PM

For hash-prefixed parser functions this should be fine. For those that can be used without the prefix though, doing this would hide a template with the same name.

That may or may not make a difference. For example, enwiki tends to create wrapper templates at the name that will invoke the parser function or magic word, but there are some cases where a template doesn't match the magic word such as Template:Subst, Template:Lc, Template:Uc, Template:Ns, Template:Plural, and Template:Gender. I have no idea what the situation might be on other wikis.

You might also have to be careful that you don't turn {{Project:Example}} from a transclusion of Project:Example into a transclusion of Template:Project passing "Example" as parameter 1.

cscott added a comment.EditedSep 14 2018, 6:18 PM

Yeah, there's a separate issue (T204370) which I think you've already seen which tries to ensure there is an equivalent hash-prefixed and pipe-separated form for each of the oddball magic words/parser functions. So I don't think I can/should/want to touch the "legacy" forms, if you want uniform syntax use the hash-prefixed alternatives.

cscott renamed this task from Replace initial colon in parser function invocation with vertical bar to Replace initial colon in (hash-prefiexed) parser function invocation with vertical bar.Sep 14 2018, 6:19 PM
cscott renamed this task from Replace initial colon in (hash-prefiexed) parser function invocation with vertical bar to Replace initial colon in (hash-prefixed) parser function invocation with vertical bar.