Page MenuHomePhabricator

Parameter auto-detection picks up other syntax elements
Closed, ResolvedPublic1 Estimated Story PointsBUG REPORT


Example API call:

The API auto-detects two parameters: state, which is fine, and !}} style="border-spacing:1px;display:block;overflow:auto;width:100%;margin:0 !important"\n{{!}}- style="line-height:125%; vertical-align:top;"\n! style="text-align:right; width:3%; background:transparent" {{!}}. Yes, that's reported as the parameter name.

Detailed analysis

It is entirely impossible to use these sequences in a parameter name:

  • | separates different parameters. There is no way to escape this or any of the following in a parameter name.
  • = ends a parameter's name, and starts the value. At least when calling a template. The situation here is a little weird. It appears like attempting to use a parameter like {{{a=b}}} in a template is valid syntax. But it's impossible to call this parameter. Attempting to do so will create bad wikitext that calls a parameter a instead of a=b.
  • {{ and {{{ start another syntax element, and }} and }}} end one.

It appears like it's technically possible to use the following sequences in a parameter name:

  • Single { and }.
  • \n, i.e. the parameter name is a multi-line string.

However, this is extremely unlikely. We can pretty much guarantee there is something weird going on. Either the auto-detection made a mistake. Or the template is just broken. No sane template programmer would ever use curly braces in a parameter name. They would be constantly confused with syntax. Same with newlines in the middle of a parameter name. I have never seen anything like that in the 15+ years I deal with wikitext. And I touched a lot of templates, from a lot of users. Let's assume these are errors and not offer them as auto-detected parameters.

Event Timeline

thiemowmde set the point value for this task to 1.

Change 717276 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TemplateData@master] Fix parameter auto-detection picking up syntax elements

Change 717276 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] Fix parameter auto-detection picking up syntax elements