Page MenuHomePhabricator

Templatedata API includes parameters that only exist within comments (for templates mising templatedata)
Open, Needs TriagePublic

Description

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).

Example:
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).

Details

Related Gerrit Patches:

Event Timeline

Evad37 created this task.Nov 3 2019, 2:01 PM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptNov 3 2019, 2:01 PM
JTannerWMF moved this task from To Triage to Freezer on the VisualEditor board.Nov 6 2019, 5:40 PM
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

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

SD0001 added a subscriber: SD0001.Mon, Dec 9, 6:33 PM

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