Page MenuHomePhabricator

TemplateData: Be able to specify a "no parameters accepted" definition
Open, MediumPublic1 Estimated Story PointsFeature

Description

Some (many) templates do not use any parameters (e.g., hundreds of templates like https://en.wikipedia.org/wiki/Template:Stub). However, if you add those templates, VisualEditor will ask you for parameters, just like it does for any other template. It would be nice to have a TemplateData setting for "no parameters here, so don't bother asking".


Version: unspecified
Severity: enhancement

Details

Reference
bz62417

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:52 AM
bzimport added a project: TemplateData.
bzimport set Reference to bz62417.
  • This bug has been marked as a duplicate of bug 51429 ***

I think I wasn't quite clear earlier. T53429 is about saying (nicely) that no parameters have been listed in TemplateData. I'm glad that we made that improvement, but that's not what I want here. Instead of a nice message, I want to define, in TemplateData, that this template actually does not accept or use any parameters. This is "no parameters in the template", not "no parameters currently typed into the TemplateData".

When a template is so marked, I'd also like VisualEditor disable the 'field name' search box, so that people can't insert any made-up or invalid parameters. I want TemplateData to be able to stop editors from trying to add pointless parameters.

So maybe something like a "This TemplateData definition is complete, don't allow any undocumented parameters." (not necessarily restricted to an empty array of parameters).

I'm not sure this is a direction we want to go in though - IIRC we want to allow for TemplateData being wrong and therefore able to be overridden inside VE.

Maybe something like that, although I'd be happy to to restrict it to an empty array (=the case when it is least likely to be wrong).

Even a "warning" note would be an improvement. We could probably reduce confusion if we could have it display a sentence that says, "This template uses no parameters. It is technically possible to add parameters here, but they will be ignored by the template".

I don't think we should have a property specifically to indicate that there are no parameters. I agree there needs to be room for TemplateData being wrong or outdated and VisualEditor's advanced transclusion editor would always allow for parameters to be added.

However I think it'd be fine to remove the ability to add parameters from the simple editor that loads by default in VisualEditor - for cases where TemplateData data did exist but had no parameters specified.

But @Krinkle why shouldn't we have a way to signal that there are no parameters in the template?

Yes, it could be wrong. There could also be incorrectly incomplete TemplateData blocks added (probably far more common, actually).

I'm not saying that you'd have to prevent the addition of parameters. But could you just tell me that adding a parameter to {{France-university-stub}} is probably a bad idea? Just a friendly note, not something that's going to break the workflow if the TemplateData is wrong. Just a note that says something like "According to the template documentation, this template doesn't normally use any parameters."

Here's another example for the list of use cases: The sole contents of
{{userboxbottom}} is the table-closing wikitext code |}. There are
dozens of similar templates on enwiki. Adding parameters to these is
pointless at best.

Deskana lowered the priority of this task from High to Medium.Oct 11 2017, 9:30 PM
Deskana moved this task from TR0: Interrupt to Freezer on the VisualEditor board.
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 12:23 PM

As part of the WMDE-Templates-FocusArea we made the VisualEditor dialog say this when the TemplateData documentation has an empty list of "params": {}: "This template has no documented parameters and may be intended for use without them." The user can proceed as before, but the option to add what we now clearly mark as "undocumented" parameters is much less prominent, and explained as well. The relevant task was T300710: Improve no parameter dialog state.

We spend quite some time on this detail and are quite happy with the result and how it performed in user tests. I suggest to leave it like that and close this task.

The user can proceed as before, but the option to add what we now clearly mark as "undocumented" parameters is much less prominent, and explained as well.

How to proceed? For {{stub}} on en.wp, I don’t achieve to add any parameter (as requested by this task).

How to proceed? For {{stub}} on en.wp, I don’t achieve to add any parameter […]

Turns out this is an unrelated bug, see T333826. As long as this is not fixed you can use the keyboard shortcut Ctrl+Shift+D to add undocumented parameters to any template, no matter how it is documented.