I created a template using templatedata and used it in my user profile page, unfortunately the page i created doesnt show the values I used for the template.
Extension talk:TemplateData
Appearance
I'm afraid there is not much we can do without knowing anything. Which wiki? Which profile page? Which template? I can only suspect that the template doesn't actually accept the parameters, despite the TemplateData documentation saying otherwise.
ok in my Template:Infobox person:
<templatedata>
{
"description": "A template to gather user information for user profile page",
"params": {
"User": {
"label": "Full Name",
"description": "User first and last name",
"type": "string",
"required": true
},
"Department": {
"label": "Department",
"description": "The department in which user currently work",
"type": "string",
"required": true
},
"Unit": {
"label": "Unit",
"description": "The unit in which a user is attached to",
"type": "string",
"required": true
}
}
}
</templatedata> and in my User:Admin I am calling the template Infobox person and specified the values. but the same chart that generated from the template data is generating on the Admin page.
This post was hidden by Thiemo Kreuz (WMDE) (history)
As said, I don't really know how I can help. Who is "User:Admin"? What "chart"? What is "generated", and where? Which wiki is this about?
TemplateData doesn't "generate" anything. It's just documentation. A template that contains nothing but documentation doesn't do anything.
Several fields of our infoboxes require new lines (for example, adding a tabbed gallery in the image section) and I've been using a ↵
symbol as an indicator for that.
My users are writers, not tecchies- so I'm trying to make our wiki as foolproof as possible. This lack of new lines in the Insert Template Wizard is proving very not foolproof.
Most users use the VE and rely on the examples provided by TemplateData. And no matter how many times, big, bolded and in caps I tell them that the ↵
symbols in descriptions and examples are meant to be replaced by an actual enter/new line. They are STILL copying the example and pasting it as it is, with the new line symbol.
Is there any way- even if I have to do elaborate things with the HTML, CSS, even JS of our wiki- to get those new lines to show in the wizard?
If not, please consider letting those through the plain text restriction
I'm curious how this would help? I mean, how should a user understand that an invisible line break is meant to tell them something? Can you link to a specific example?
I was wondering if wrapping the TemplateData in noinclude tags will result in it not being displayed within the template page, but still be included within the visual editor.
I want to have a more visually appealing documentation on the main template page while also having the template data present. Sadly, the fact that TemplateData can't render wiki text makes it not a great option for me to use here, so I would like to use this aproach, if doable.
TemplateData blocks apply to template pages they’re included in. This means that you can (and should) put it in a <noinclude>
block on the template page to avoid it appearing everywhere the template used, but you cannot put it in a <noinclude>
on the /doc subpage to avoid it appearing on the template page itself. You can, however, put it in a collapsible box or even completely hide it with style="display:none"
(but you should completely hide it only if it’s ensured that equivalent content appears, e.g. with a template like de:Vorlage:TemplateData, since otherwise people wanting to improve the documentation will have a hard time finding it and especially previewing their modifications).
Hello, in chapter TemplateData object it is stated:
- key: "params", right of this: "Param_ objects" and below Param_ object_
- key: "sets", right of this: "Set_ objects" and below Set_ object_
- key: "maps", right of this: "Maps object_" and below Maps object_
Quite confusing! Regards --W like wiki (talk) 21:44, 15 February 2024 (UTC)
I agree it's not very easy to understand, but I'm not sure what you are missing. "sets": []
is an array of set objects. A single set object is described below.
Same for "params": {}
, except it's not an array but an object that maps parameter names to param objects.
"maps": {}
is documented a little different, as a single thing. The descriptions and examples are correct, as far as I can see.
Ok Thiemo, thanks for your answer! So Params and sets end in "s" because it is the plural and can contain several parameterS and setS. The "s" in maps is not because there are several maps but because "it maps" something (3rd person), right!?
"maps" also contains a set of map objects. I updated the text a bit to hopefully make it a bit more clear.
Ok, thx Thiemo! Your edits helps, but for maps I still try to find the logic (I am not a programmer, my view is more the one of someone who tries to understand), so:
- params = Object containing param objects
- params is explained here: Help:TemplateData#params
- a single param object is explained here: Extension:TemplateData#Param object
- sets = Array containing set objects
- sets is still in development.
- a single set object is explained here: Extension:TemplateData#set object
- maps = Structure (type Object) containing map objects
- What is now explained under Extension:TemplateData#Maps structure the maps-structure (as said in the chapter title) or a single map object from where it is linked to from the description above under chapter "TemplateData object"? And what is a "structure"? MfG
Do you plan to work with Citoid or another tool that relies on maps? I find that maps are best understood when approached from that side.
No, i found here because I was working on the doc page of C:Template:TemplateBox and I am generally interested in good doc or help pages, and here for me it is still not clear. In chapter "TemplateData object" it is explained:
- "Maps (Structure) containing map objects"
so both are different but map objects links to the chapter called Maps Structure. So which of both is described there? Not so clear. Thx
I really don't know what else I could add. "maps" is a single data structure that goes multiple levels deep. The first level lists consumers by name. The next level lists parameters as they are known by the consumer and maps them to one (as a string) or more (as an array) parameters as they are named in the template.
The consensus seems to be to call the second level in this data structure a "map object".
Not really related, but if you are interested in helping others a good place to start is to convince the community that cryptic parameter names like "1d" or "1sv" are an entirely unnecessary barrier.
Ok thank you! I think thats make it clear. I posed a short introduction to the section with your point, I think that also helps others.
And yes, "1d" and "1sv" are really short, I agree with you, was not my creation and I have not the rights to make such big changes for a so widely used template. But in commons many widely used templates using very short parameter names.
My point to make it better (and not having the rights to change the parameter names) is to place comments into a second copy-paste-form (>>my work), because the auto-generated one don't offers this. So if you can help, to introduce this oportunity to TemplateData to place help comments for the parameters in the autogenerated copy-paste-template would be very helpfull! Beste Grüße!
Hello, the question is a bit provocant, I know, but
1) On Commons e.g. there is Commons:Template:TemplateBox which shows a similar table like this extension but with possible links (or wiki markup like italic or code). People like writing descriptions like they are used to (with links, wiki markup,...). Now it is a lot of work, just to write a second version of this description so that all the tags are not visible and the links too. Do we need this Sisyphus work? For Example in Commons:Template:F/doc
| 2d-en = [[#Display Name|Any text]], default is the file name (parameter #1). If there is no alternate text the parameter #2 instead can hold the first [[#option|option]]. | 2d-td-en = Any text, default is the file name (parameter #1). If there is no alternate text parameter #2 instead can hold the first "option".
2) For a good and helpful parameter description it can help a lot to state a link to another example or to a help pages with more regarding informations. This is not possible with this TemplateData Extension. (see also #How to enable wikitext within descriptions?)
PS.: I think it is the problem with the unsupported wiki markup that led to separate templateBox templates on Commons or other wikis. Normally a unified centralized solution is much better I think but when it has this important weakness, people find their own way and now on Commons the Extension:TemplateData is just collapsed (not visible first) because of the reasons above. Best Regards --W like wiki (talk) 17:20, 10 February 2024 (UTC)
These data are mostly needed for tools such as VisualEditor to provide help during inserting templates. The solution with hidden TemplateData may be good if you have another template to display parameters, and you can generate it automatically to not duplicate work.
Ok @Wargo, thank you for the answer! Yes, VisualEditor for TemplateData is fine! The Automatic generation does not work, because the templates accepting wiki mark up, template data not. What do you think, will it be possible somewhen or will it never work to integrate wiki markup? I don't like dublicate work. Best Regards --~~~~
MW version: 1.41
I have a template where I use a loop to iterate over all parameters with a certain name (opt1, opt2, ...). The opt1 is a optional parameter and is shown translated. If someone would like to add more options they just have to add an undocumented parameter with opt2,opt3, and so on. This is working without any problems. But since the update to V1.41 until there are no undocumented parameters added, the buttonlink with "add undocumented parameters" is not shown.
The hotkey for adding is working so pressing ctrl+shift+D will make the link visible. After adding a new undocumented parameter the link stays visible.
I am not sure if this is a topic related to the TemplateData Extension or the VisualEditor.
TemplateData only provides the data, i.e. parameter (and template-level) documentation. How to handle undocumented parameters is up to the data consumers like VisualEditor or TemplateWizard. This change is probably the outcome of m:WMDE Technical Wishes/VisualEditor template dialog improvements.
The doc says:
"Note that you cannot use {{#tag:templatedata}}
in lieu of <templatedata>
."
Why not? Works just fine for me, and was also the solution for a problem below.
I tried to clarify.
I have a template that I created in MW 1.31 (TemplateData 0.1.2). The TemplateData editor does not create the paramOrder object, but the order still works, because it adheres to the order in which the parameters are defined in the source code.
However, in my MW 1.35 this no longer works. The params are ordered based on their name instead. Since the editor does not create the paramOrder, I now have to manually add it in the source code for each template. I would like to avoid that and don't know if it's just an issue in my wiki that the paramOrder object is not created automatically by the editor?
I wasn't involved back then and can't tell when this broke, and where. It's potentially related to an unrelated change in Parsoid. But I'm aware of this issue. We fixed it just recently via gerrit:700350. This is part of MediaWiki 1.37, but not earlier, unfortunately. I think the best option you have (other than using 1.37) is to add a specific paramOrder to each template. The TemplateData editor isn't designed to do this automatically.
Okay, then I know what to do. Thanks for the prompt answer!
I would like to create a DPL that lists all the templates in a category, along with the description listed inside their data block. Is this possible?
What is a DPL?
Searching categories is possible with CirrusSearch, even recursively with the deepcat:
keyword. The TemplateData extension comes with its own action API called action=templatedata
. You have probably see the documentation. These APIs can be combined with the generator feature of the query API. We improved this particular feature just recently. I hope this helps.
We recently change document subpage from "/doc" to "/कागजात"; now the TemplateData seems to be not working anymore. In other wiki it seems to work but not in Newiki.
I'm afraid there is a lot of information missing. What changed? What doesn't work? Do you have an example link? One thing I can see is that ne:MediaWiki:Templatedata-doc-subpage still says "doc".
Is this still broken?
DannyS712, is this a problem that gets fixed by a config change?
It seems to be working now
No idea, sorry