Jump to content

Extension talk:TemplateData/2013

Add topic

Status of this api

[edit]

Hi,

I would like to know whether this api is available for wikipedia. I would like to get information about existing templates to know the display values of keys. If any programming effort is necessary I would love to work on this.

Thanks 203.83.248.37 06:55, 18 June 2013 (UTC)Reply

The extension is installed on all public Wikimedia wikis (but yes, we need to document the API). However, it relies on templates having data written about them by hand, which is not yet done except for a very small number of demonstration templates. We're going to recommend that people start writing these very soon, but it may take some time, depending on how popular and well-maintained the templates you're interested in are. Jdforrester (WMF) (talk) 16:10, 18 June 2013 (UTC)Reply

Output table alignment

[edit]

Wouldn't the the display of the finished table be better more appealing to the eye when combined with the typical template documentation if it was centered by default regardless of the length of the table-cell contents?

Currently, your .php generates a table with: <table class="wikitable mw-templatedata-doc-params">

And I understand we could adjust this on a wiki-by-wiki basis by fiddling with the class definitions in the local .CSS but I figured I mention it here anyway with the hope that option becomes a last resort.

Fwiw... <table class="wikitable mw-templatedata-doc-params" style="margin:0 auto 0 auto;"> seems to do the centering just as well as making the style part of the default CSS class definitions would. -- George Orwell III (talk) 23:18, 29 June 2013 (UTC)Reply

Default values

[edit]

when a parameter defaults to {{PAGENAME}}, what should be put into the <templatedata> tag? the string "{{PAGENAME}}" or an English description such as "current page name"? If we add "{{PAGENAME}}", shouldn't it show the page name in the VisualEditor popup (instead of the magic word)? Will the template field be filled with that value for the user? Helder 02:22, 11 July 2013 (UTC)

The "default" value isn't for being filled-in by a user (or user's application); it's the value that the template will use if you don't set a value. Thus, in this case, a natural-language description would make more sense (note that these fields are not wikitext and entering it will not be evaluated, and so confuse users). Jdforrester (WMF) (talk) 15:31, 12 July 2013 (UTC)Reply

Parameter translation/mapping

[edit]

It would be particularly useful to map templatedata between templates, especially between different wikis (and specifically language versions of the same project).

Apart from giving a picture of the different features of a template in various versions (and saving work on adding templatedata), it would make it possible to "translate" a template from a language/version to another. Adjusting template calls is probably the most tedious part of article translation; usually templates are just left as they are (in English), whether fully working or not, or removed. Nemo 09:00, 12 July 2013 (UTC)Reply

We briefly discussed this during the development process, and decided that it was better to wait for the perennial proposal for cross-wiki templates to be implemented (and have TemplateData work seamlessly from that) rather than try to hack it in locally. Jdforrester (WMF) (talk) 15:39, 12 July 2013 (UTC)Reply
Ah. I never thought of cross-wiki templates this way, it's even more complex. Thanks for answering, one hope/wish less floating in my mind. Nemo 11:07, 14 July 2013 (UTC)Reply
Relevant links:
That's very tangential, in fact it doesn't even mention bugzilla:9890. Cross-wiki transclusion for all and global templates are two different use cases, though the latter depends on the former. Nemo 07:54, 15 July 2013 (UTC)Reply

Template without parameters ?

[edit]

Hi,

I'm trying to create a TemplateData for a template without parameters. I struggled to find a syntax that works, but I end up with an empty table for parameters (just a title line). Wouldn't it be better to simply not display the parameters table when there is no parameter ?

Example:

{
	"description": "Ce modèle permet d’avertir que l’article oriente le lecteur vers des articles homonymes.",
	"params": {
	}
}

Result:

Ce modèle permet d’avertir que l’article oriente le lecteur vers des articles homonymes.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
No parameters specified

NicoV (talk) 09:25, 13 July 2013 (UTC)Reply

Created report in bugzilla: 51429. NicoV (talk) 07:37, 16 July 2013 (UTC)Reply

Adding a second default value for each parameter ?

[edit]

Hi,

If I understand correctly, the current "default" property for a parameter means "the value that will be used by the template for this parameter if the parameter is not specified". Would it be possible to also have an other parameter for indicating that when inserting a template in a article with VE, some parameters should be created automatically with a given value ? I think for example of some templates that have a date parameter to be filled with the date at which the template was inserted. NicoV (talk) 09:42, 13 July 2013 (UTC)Reply

I like the idea of having an "autofill" parameter.
See also: #Default values. Helder 12:31, 14 July 2013 (UTC)
"autofill" seems a good name for this, I hope it will make its way to TD. NicoV (talk) 14:19, 14 July 2013 (UTC)Reply
Created a report in bugzilla : 51428. NicoV (talk) 07:32, 16 July 2013 (UTC)Reply

HowTo add a VisualEditor's TemplateData for a Magic Word ?

[edit]

Hi I want insert a TemplateData for a Magic Word but there is not template/subpage for the Magic Words. Have you for the extension an example of code to insert a TemplateData in the BDD ? or an idea ? Thanks Karima Rafes (talk) 14:42, 28 July 2013 (UTC)Reply

This is not possible yet. However, there is an open bug for allowing documentation of parser functions, one type of magic word. Legoktm has an in-progress patchset. Superm401 - Talk 21:34, 16 August 2013 (UTC)Reply

TemplateData expansion to Data

[edit]

It's a pity IMHO that this interesting implementation of JSON objects into wikicode has - apparently - so a limited scope; I hope, that it can be generalyzed to any JSON data structure and that the resulting extension is merged with the Scribunto function mw.loadData() so that the same data could be read by extension, by js and by Lua. Perhaps, a dedicated Data namespace could be useful in future. Alex brollo (talk) 14:02, 12 August 2013 (UTC)Reply

About the new namespace, see bugzilla:50512. Helder 12:34, 17 August 2013 (UTC)

Translation of table contents for columns Type, Default and Status

[edit]

Hi,

Is there a way to have the values in the Type, Default and Status columns translated in the language of the wiki ? This is a request of a user on the French wikipedia. For example, "required" should be translated as "obligatoire", "optional" as "optionnel", ... I have checked in the system messages and only found messages for translating the titles of the columns, not the actual values. NicoV (talk) 08:21, 25 September 2013 (UTC)Reply

Yes, this is bugzilla:50370. Superm401 - Talk 12:04, 27 September 2013 (UTC)Reply