Last modified: 2013-07-15 06:20:30 UTC
Templates behave differently depending on whether positional parameters are explicitly declared or not. For example, for [[Template:User]] on the English Wikipedia, {{user|1=foo=bar}} will return user links for the user "foo=bar", but {{user|foo=bar}} will generate an error, as there is no "foo" parameter. However, there does not seem to be any way of distinguishing explicit positional parameters from implicit positional parameters using TemplateData. I am guessing that this ability will be needed for the Visual Editor to properly handle existing templates - see also bug 49739.
I'm sorry, I've read this a dozen times and I still don't understand what you think we should change. Could you re-state?
Closing for now; please re-open if you can help us identify the issue here.
Here is an example I'm not sure about. For {{coord}} http://en.wikipedia.org/wiki/Template:Coord/doc the template can have two main forms Hours Minute Seconds {{Coord|57|18|22|N|4|27|32|W|display=inline}} Decimal Degrees {{coord|43.6500|-79.3800|display=inline}} In the first the Longitude degrees is the 5th parameter, in the second its the 2nd parameter. I've tried some sample template data at http://en.wikipedia.org/wiki/Template:Coord/doc#Template_Data with documentation for Longitude degrees as the 5th parameter. What I'm not sure about is how this will work with the second form. Will VE create {{coord|1=43.6500|5=-79.3800|display=inline}} which will badly mess up giving an "Coordinates: Unknown argument format" error. Or will it play nice and produce {{coord|43.6500|-79.3800|display=inline}}? Here I require the positional parameter to be silent, that is implicit, not giving the number. There are cases where if the parameter value contains a = that you need to explicitly state the position parameter. Compare the results of {{math|foo=bar}} with {{math|1=foo=bar}} (on en.wp). Here you need to explicitly give the parameter. <templatedata>{ "description": "Encodes the latitude and longitude coordinates of a location, provides a link to map of the location.", "params": { "1": { "label": "Latitude degrees", "description": "The degrees part of the latitude. This can either be a whole number in which case minutes and seconds can also be provided in subsequent parameters, or in decimal format, negative for south eg -79.38.", "type": "number", "required": true }, "2": { "label": "Latitude minutes", "description": "The minutes part of the latitude. Do not be overly precise, 1' is approximately 1.5km, Not used if decimal degrees are specified.", "type": "number", "required": false }, "3": { "label": "Latitude seconds", "description": "The minutes part of the latitude. Do not be overly precise, 1\" is approximately 30m. Not used if decimal degrees are specified.", "type": "number", "required": false }, "4": { "label": "Latitude direction", "description": "Direction part of latitude: N or S. Not used if decimal degrees are specified.", "type": "string", "required": false }, "5": { "label": "Longitude degrees", "description": "The degrees part of the longitude. This can either be a whole number in which case minutes and seconds can also be provided in subsequent parameters, or in decimal format, negative for west eg -79.38.", "type": "number", "required": true }, "6": { "label": "Longitude minutes", "description": "The minutes part of the longitude. Do not be overly precise 1' is approximately 1.5km. Not used if decimal degrees are specified.", "type": "number", "required": false }, "7": { "label": "Longitude seconds", "description": "The minutes part of the longitude. Do not be overly precise 1\" is approximately 30m. Not used if decimal degrees are specified.", "type": "number", "required": false }, "8": { "label": "Longitude direction", "description": "Direction part of longitude: E or W. Not used if decimal degrees are specified.", "type": "string", "required": false }, "9": { "label": "Coordinate parameters", "description": "Optional parameters separated by an underscore '_', dim:N (viewing diameter in metres), region:R (ISO 3166-1 alpha-2 or ISO 3166-2 code), type:T (eg landmark or city(30,000)). For example 'dim:30_region:US-WI_type:event'", "type": "string", "required": false }, "display": { "label": "Display", "description": "Where it is displayed. Can be one of: 'inline' in the body of the article (default), 'title' at the top of the article or 'inline,title' both", "type": "string", "required": false }, "name": { "label": "Name", "description": "a label to place on maps (default is PAGENAME)", "type": "string", "required": false }, "notes": { "label": "Notes", "description": "text displayed immediately following the coordinates", "type": "string", "required": false }, "format": { "label": "Format", "description": "How the coordinates are displayed, either 'dec' or 'dms'", "type": "string", "required": false } }}</templatedata>
You are right, this is a mess - because this is a template that is broken by design. The TemplateData you have written in comment 3 is wrong - most notably: "2": { "label": "Latitude minutes", "description": "The minutes part of the latitude. Do not be overly precise, 1' is approximately 1.5km, Not used if decimal degrees are specified.", "type": "number", "required": false }, This is not true. "2" is "either Latitude minutes or Longitude decimal depending on other parameters". Both meanings of the second positional parameter can be used implicitly - hence my confusion. Have re-named to "TemplateData doesn't let you have conditional meanings of parameters based on other parameters" which I think captures the issue best? In general, this is simply an example of a ridiculously-confusing template for users. I'd very strongly recommend just fixing the template (by splitting the two users into different templates; use a single parent template to implement the proper RDFa hinting equivalently). Otherwise, I can't see what resolution you'd expect us to come up with - descriptions that change depending on the phase of the moon? TemplateData does not, and will not, contain conditionality in its definitions.
Its a template used on 863,827 pages, so I guess people have been able to use it just fine. Its not broken by design its just a template which makes heavy use of http://en.wikipedia.org/wiki/Function_overloading which differs by the arity of its arguments, a well used software design practice. The problem is that the templatedata systems does not allow for this paradigm.