Wikipedia talk:TemplateData/Tutorial
If there is a discrete set of valid values for a parameter, e.g. collapse="yes"/"no", where do we tell the user which choices they've got? The "string" doesn't give them many pointers. --99of9 (talk) 21:58, 28 June 2013 (UTC)
- The description, ideally :). Okeyes (WMF) (talk) 22:29, 28 June 2013 (UTC)
"default" tag
I discovered that there is an additional tag, "default
", that shows the default value for the template parameter. Example:
<templatedata> { "description": "Description of the template", "params": { "1": { "label": "Label of the parameter", "description": "Description of the parameter", "type": "string", "required": true, "default": "Default text of this parameter" } } } </templatedata>
It is not mentioned in this tutorial, but it is listed in the TemplateData table that is produced. Are we supposed to be using it yet? The Anonymouse (talk) 13:58, 29 June 2013 (UTC)
- Yeah, using it is fine - it's just not necessary, so I tried to strip the tutorial down to "things that are required", basically :). Okeyes (WMF) (talk) 15:08, 29 June 2013 (UTC)
- OK, thanks! The Anonymouse (talk) 04:32, 30 June 2013 (UTC)
More useful debugging output needed
This system is really not usable without better debugging. I just spent over an hour creating 200 lines of TemplateData for Template:Infobox disease, and when I try to save it, all I get is "JSON syntax error". I'm not going to use this system until it does a better job of pinpointing errors, or at least giving some clue about the type of error. (If anybody is interested in trying to spot the syntax error, I saved my work as a comment in Template:Infobox disease/doc.) Looie496 (talk) 16:27, 1 July 2013 (UTC)
- I agree we need better debugging commentary; actually, I'm unable to find a bug with that. @Adavidb:? Okeyes (WMF) (talk) 17:14, 1 July 2013 (UTC)
- There was a double-quote symbol missing from the end of the "label" entry for the "eMedicineSubj" parameter. Such syntax errors are very difficult to catch with visual review alone. I commented out various parts of the code to narrow down where the error was. The corrected version remains commented, for any additional changes before activation. —ADavidB 18:05, 1 July 2013 (UTC)
- Thanks. I've uncommented it and saved it -- appears to work. I still think I'm going to wait until there are more informative error messages before making further use of this system. Regards, Looie496 (talk) 18:26, 1 July 2013 (UTC)
- Seems reasonable; I've added a bug for it. Okeyes (WMF) (talk) 18:42, 1 July 2013 (UTC)
- Thanks. I've uncommented it and saved it -- appears to work. I still think I'm going to wait until there are more informative error messages before making further use of this system. Regards, Looie496 (talk) 18:26, 1 July 2013 (UTC)
- There was a double-quote symbol missing from the end of the "label" entry for the "eMedicineSubj" parameter. Such syntax errors are very difficult to catch with visual review alone. I commented out various parts of the code to narrow down where the error was. The corrected version remains commented, for any additional changes before activation. —ADavidB 18:05, 1 July 2013 (UTC)
Should be hidden when empty, and always link to documentation
I just discovered the existence of this after an IP editor added it to Template:Colon/doc. I have two observations: firstly, the displayed output needs to link to the TemplateData documentation (perhaps link "Template parameters"), otherwise it's virtually inexplicable - I had to perform a help namespace search to find it. Secondly, if empty it should either be hidden or a message along the lines of "this template does not take any parameters" should be shown. At present it just produces a clumsy-looking empty table, as in the example above.
This isn't meant to be negatively critical of the implementation, I know it's very early days yet. — Scott • talk 12:07, 2 July 2013 (UTC)
- Good points, both :). I'm not sure how we'd handle the first one - what do we do with localisation, for example? - but we can look into it. Okeyes (WMF) (talk) 12:58, 2 July 2013 (UTC)
Placement
The section Wikipedia:VisualEditor/TemplateData tutorial#TemplateData implies that it doesn't matter if <TemplateData>...</TemplateData>
is added to the /doc page or to the main template page. I would suggest that the <TemplateData>...</TemplateData>
should be placed on the /doc page wherever possible, since if it's put on the template, it'll add pages to the job queue unnecessarily (see bugzilla:50372 and WP:VPT#TemplateData: Is it working?). --Redrose64 (talk) 16:25, 3 July 2013 (UTC)
- Fair point; I'll make sure it's tweaked when we update the documentation (being written now). Okeyes (WMF) (talk) 15:09, 5 July 2013 (UTC)
Parameters in example
The order of parameters in the "Str left"-example is reversed. In Templatedata (and the step by step instruction) "string" should come first, then "count". They are unnamed parameters, the current order won't work or would return wrong results. GermanJoe (talk) 14:43, 5 July 2013 (UTC)
- Oh, darn :(. We're actually about to update the tutorial :). Okeyes (WMF) (talk) 15:09, 5 July 2013 (UTC)
- Fixed the template Template:Str_left for now ;). GermanJoe (talk) 07:45, 9 July 2013 (UTC)
- Thanks! :D. I need to start making a list of names (in a "free cookies" way, not in a PRISM way) Okeyes (WMF) (talk) 08:13, 9 July 2013 (UTC)
- Fixed the template Template:Str_left for now ;). GermanJoe (talk) 07:45, 9 July 2013 (UTC)
Editor for TemplateData ?
Hi, is there any editor tool for TemplateData on enwiki ? On frwiki, a user made a script which allows creating/updating the <templatedata>...</templatedata>
visually and very easily. Anyone willing to make the same for enwiki ? --NicoV (Talk on frwiki) 08:42, 16 July 2013 (UTC)