Page MenuHomePhabricator

Templatedata API includes parameters that only exist within comments (for templates mising templatedata)
Closed, ResolvedPublic


The action=templatedata API can be used with the includeMissingTitles parameter to get parameters for templates missing templatedata. The returned list should not include parameters that only exist within comments (<!-- ... -->), but it currently does.

End users of gadgets, scripts, extensions etc. which use the templatedata API should not be presented with these commented-out parameters, which do not affect the template, and are not helpful to offer as parameter suggestions (which is my use case for my Rater script).

If you look at the source of w:en:Template:WikiProject Medicinal botany (which does not have templatedata) you will see two parameters, {{{**PARAMETER**}}} and {{{needs-photo}}}, that exist only as comments. However, when using the action=templatedata API with includeMissingTitles parameter, those 'parameters' are included in the list of params: The result of an API call with action=templatedata&includeMissingTitles=1&titles=Template%3AWikiProject%20Medicinal%20botany is

    "batchcomplete": "",
    "pages": {
        "38388509": {
            "title": "Template:WikiProject Medicinal botany",
            "notemplatedata": "",
            "params": {
                "small": [],
                "category": [],
                "listas": [],
                "class": [],
                "importance": [],
                "**PARAMETER**": [],
                "needs-taxobox": [],
                "needs-cultivar-infobox": [],
                "needs-photo": []

Searching en.Wikipedia for insource:/\<!\-\-[^\>]*\{\{\{/ in template namespace shows ~850 results (some may have actual templatedata -- but out of the first 5 that I looked at, there was only one).

Event Timeline

JTannerWMF added a subscriber: JTannerWMF.

Template data work is not being prioritized by the Editing-team at this time.

Change 556011 had a related patch set uploaded (by SD0001; owner: SD0001):
[mediawiki/extensions/TemplateData@master] Make getRawParams() ignore parameters in comments and nowiki tags

@JTannerWMF I have written a patch for this. It is fairly simple. Could you review it?

Change 556011 merged by jenkins-bot:
[mediawiki/extensions/TemplateData@master] Make getRawParams() ignore parameters in comments and nowiki tags

Ammarpad assigned this task to SD0001.