Page MenuHomePhabricator

VisualEditor ignores autogenerated parameter info for templates without TemplateData
Closed, ResolvedPublic

Description

When a template does not have user-provided TemplateData documentation, the TemplateData API falls back to extracting possible parameters from the raw wikitext to generate an API response, which looks like this:

{
	"batchcomplete": true,
	"warnings": {
		"main": {
			"warnings": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
		},
		"templatedata": {
			"warnings": "The parameter \"doNotIgnoreMissingTitles\" has been deprecated."
		}
	},
	"pages": {
		"1182": {
			"title": "Template:Planet infobox",
			"notemplatedata": true,
			"params": {
				"width": [],
				"imageBG": [],
				"BG1": [],
				"image": [],
				"css": [],
				"2": [],
				"hidep": [],
				"BG2": [],
				"sun": [],
				"3": [],
				"moons": [],
				"terraformed": [],
				"diameter": [],
				"mass": [],
				"gravity": [],
				"orbital position": [],
				"orbital distance": [],
				"orbital periods": [],
				"region": [],
				"cities": [],
				"population": [],
				"affiliation": [],
				"srclink": []
			}
		}
	}
}

However, VisualEditor ignores this parameter info—so if you try to insert this template via the template insertion tool, no parameter info or hints are shown.

It would be useful if VisualEditor used this data to display a list of parameters if the template has no user-provided TemplateData documentation, to help out wikis that are still getting started out with TemplateData and might not yet have docs for every template.

Event Timeline

TK-999 created this task.Jan 28 2020, 11:08 PM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptJan 28 2020, 11:08 PM

I think this is an un-intended side-effect of rEVED8fd621a. We could change the check on line 337 to only ignore the response if no param docs were returned.

Sounds good to me.

Change 569103 had a related patch set uploaded (by TK-999; owner: TK-999):
[mediawiki/extensions/VisualEditor@master] Use autogenerated parameter info for templates without TemplateData

https://gerrit.wikimedia.org/r/569103

Change 569103 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Use autogenerated parameter info for templates without TemplateData

https://gerrit.wikimedia.org/r/569103

matmarex removed a project: Patch-For-Review.
Restricted Application added a project: VisualEditor. · View Herald TranscriptFeb 4 2020, 11:14 PM
matmarex moved this task from To Triage to Triaged on the VisualEditor board.Feb 12 2020, 5:21 PM
Esanders assigned this task to TK-999.Jun 4 2020, 2:49 PM
JTannerWMF removed a project: Editing QA.
JTannerWMF added subscribers: ppelberg, JTannerWMF.

@ppelberg will take a look and determine to close this out

ppelberg closed this task as Resolved.Oct 24 2020, 1:02 AM
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptOct 24 2020, 1:02 AM