Extension talk:TemplateData

Jump to navigation Jump to search

About this board

Proposal for new data type

Summary by Tacsipacsi
片割れ靴下 (talkcontribs)

Dear everyone:

I'd like this to be provided list type. For example, first parameter of en:Template:Medal or ja:Template:Medal can be set following string:

  • Gold, G
  • Silver, S
  • Bronze, B
  • Winner, W
  • Runner-up, Runnerup, RU
  • First, 1st
  • Second, 2nd
  • Third, 3rd
  • Disqualified, DQ
  • TrueSpirit, PdC
  • Olympics, Olympic
  • WorldChampionships
  • EuropeanChampionships
  • Competition, Comp, Sport
  • Team
  • Country
  • Independent

It will be convenient to be fill in with pull down menu. It will be more convenient if display string value to be set and its description together.

Best regards, unpaired sock.

Tacsipacsi (talkcontribs)

List has already been proposed at phab:T53375, but now I mentioned your suggestion of labels over there.

片割れ靴下 (talkcontribs)

Thank you for your information! We wait new awesome feature!

Reply to "Proposal for new data type"
Amire80 (talkcontribs)

What is the difference between the "string" type and the "line" type?

Thiemo Kreuz (WMDE) (talkcontribs)

In VisualEditor, "line" will create a single line OO.ui.TextInputWidget that doesn't allow line breaks, while "string" will create an OO.ui.MultilineTextInputWidget. However, if a value already contains a line break, the type "line" will be ignored to not destroy the value.

Does this help?

Amire80 (talkcontribs)

Yep! Thank you!

Tacsipacsi (talkcontribs)

@Thiemo Kreuz (WMDE): I recall VE destroying line breaks of a parameter. Maybe I recall it incorrectly, maybe it’s a bug fixed a long time ago, but it’s worth using line only when it’s absolutely sure it won’t contain line break ever (e.g. usually one-line infobox fields can contain multiple values separated by line breaks or multi-line references).

Reply to "String vs line"

The Description fields are all expanded in my TemplateData views

WikimeSteve (talkcontribs)

The Description fields are all expanded in my TemplateData views. The whole thing works fine so I think this is just cosmetic but the way they look on Wikipedia is nicer. The pages are generally exported from Wikipedia and imported so the same source. All pages everywhere that this is used show the empty fields.

This is how the same TemplateData shown on Template:TemplateData header appears on MediaWiki:

I would like to have the same appearance and suspect I have missed some CSS or a setting somewhere since the page content is identical.

Whatamidoing (WMF) (talkcontribs)

I think you're on the right track, but I can't remember the details. Let's see: @TheDJ, @Izno: do either of you remember something about hiding the empty fields a while ago (maybe earlier this calendar year)? I'm pretty sure that we changed something to make it more compact, but I'm not sure if the fix was CSS or a change to the software.

Izno (talkcontribs)

A little searching found phab:T125333 which appears to be a PHP change. It was deployed in 1.32/wmf.24 and presumably in the 1.32 release.

Reply to "The Description fields are all expanded in my TemplateData views"
Tinker Bell (talkcontribs)

Hi. I want to know if there's any way to assign a category to a parameter in TemplateData, or if there are plans to support it in the future. It would allow to generate tables like w:es:Plantilla:Ficha de persona, with sections.

Whatamidoing (WMF) (talkcontribs)
Tinker Bell (talkcontribs)

No, I'm not talking about MediaWiki categories: I said if there's a way to group parameters with common features, e.g., for Infobox person, there would be sections like 'Personal info', 'Education', 'Career', and so on. It would allow including sections in TemplateData tables.

Whatamidoing (WMF) (talkcontribs)

There was some talk about having parameters "connected" – so, if I insert "author first name", then it will automatically know that "author last name" is wanted, too. That hasn't been built, and I don't know when it might happen.

Reply to "Categorizing parameters"

Not seeing any benefit with Visual Editor though I hope to

WikimeSteve (talkcontribs)

We have this extension deployed. The tags on template pages are consumed and displaying the parameters and such correctly. We also have the button and link on the edit template view and the parameter editor pops up. We have the Extension:VisualEditor installed and it works fine. It integrates with Extension:WikiEditor.

Maybe I am expecting something that I should not. When I go to a page and I chose to add a template I get the same old dialog box. I open the options and see nothing. I am expecting that I will see a list of the parameters feeding into this and helping prompt me for choices. I tried Template:Lorem_ipsum which we imported from Wikipedia.

Additionally when I tried this Template:Lorem_ipsum on my user page at Wikipedia I get an icon that allows me to insert a template in Extension:WikiEditor which I do not have in my Extension:WikiEditor view. That opens a dialog that is clearly showing the parameters which is what I would like to have on our Wiki. I realize that this paragraph may be referring to a different issue.

I see nothing about this in the configuration but at the very bottom I see the link to Extension:VisualEditor. Is there a setting I missed? Can you suggest anything else that might be blocking this use?


Whatamidoing (WMF) (talkcontribs)

The 2010 WikiEditor does not use TemplateData. The effects of TemplateData should be visible to you in the visual editor (e.g., here) but not in the old WikiEditor (here).

WikimeSteve (talkcontribs)

I see the same result on the sandbox page you provided. Maybe I am not doing something right. I go to the Insert menu and select template. I then see the plain dialog result but I see no prompting. Or is it just that there is a link to the pages view of the paraments but no menu items added? Is that all the integration I should expect?

Our Wiki:

MediaWiki 1.31.0
WikiEditor 0.5.1
TemplateData 0.1.2 (0cffe4a) 11:36, 15 October 2018
VisualEditor 0.1.0 (13a585a) 15:14, 30 May 2018

Additional info. Just found out the Template:Lorem Ipsum on Wikipedia is quite different than on Medaiwiki. So I tried Template:Banner. This one does show a prompting fields for Image and Title. This is what I would expect and do not see on our Wiki. For reference the https://en.wikipedia.org/wiki/Template:Lorem_ipsum is the one I have been trying and which we have on our wiki. It has several parameters.

The left shows my Wiki. The right shows the MediaWiki sandbox page you sent. I imported the Template:Banner to my staging so I could better compare.

Jeblad (talkcontribs)

The message at the top clearly says the description is missing, thus something is not correctly configured or you did not import the part of the template with template data.

WikimeSteve (talkcontribs)

I do see the same code in source view but the display of the template has one difference. This image shows my instance above original., I am not sure why I see this Title with 3 curly brackets:

Also I just clicked on the Manage Template in edit mode and I see the Description field does have "Template for full-width images with inset text." in it.

Yes I think this is a configuration issue but what. The instructions look pretty straight forward and we did nothing beyond what is in the installation part. Any ideas what other settings we might check for?

WikimeSteve (talkcontribs)
More images for troubleshooting disconnect between VisualEditor and TemplateData

Been trying to figure out why TemplateData seems 100% within itself. It is only when VisualEditor tries to consume it I see no connection. As Jeblad pointed out above, VisualEditor says there is no description but the TemplateData editor shows that there in one. Is there some configuration I should check in the on VisualEditor? https://www.mediawiki.org/wiki/Extension:VisualEditor#Complete_list_of_configuration_options shows some items that might be required but I see nothing documented.

Here is a screen shot that shows the Collapsible List template in the TemplateData editor view looking fine. When I try to call it from VisualEditor it shows no parameters and says there is no description.

Jeblad (talkcontribs)

Use the console and try to check whether VE hits the correct API endpoint, and that the API responds as it should do.

WikimeSteve (talkcontribs)

First I am not at all sure what you mean. Will see if I can sort that out.

In the meantime a weird update. If I go to a clean spot on the page and try to use the drop down to add the new reference to the template I still get no prompting and it says no description. There is the link to the template though. In playing with it I decided to add a sample conversion from the doc page {{convert|2|and|5|km|mi|sigfig=3|abbr=off}} to a page using source view. I saved the page and the template ran as expected giving me the conversion.

I then clicked on Visual editor. The screen shot shows that the prompting showed up fine. This is in my staging environment. We do not have the Extension:Templatedata in production yet. We do have the templates. I tried the same and get the prompting there when editing a template call that is first saved with at least some parameters.

So both environments fail to allow us to initiate the template call from VE with parameters but both allow the prompting of the parameters with their labels if they exist when the call is made from Source view first. One environment has the templatedata extension and the other does not so prod templates show the raw xml stuff not the nice box.

Whatamidoing (WMF) (talkcontribs)

On the Wikipedias, because of job queue limits, sometimes you have to purge the template page (not the /doc page or article – the "Template:Whatever" page itself) to make the TemplateData visible to the visual editor. I don't really expect this to be a problem on a smaller system, but perhaps it's worth a try, since it's so easy to do?

WikimeSteve (talkcontribs)

Tried this per your suggestion with no help. Thank you for the suggestion. I was hopeful.

It does make me wonder if I should have the box admin get on and make sure all queued jobs are clear and then run maintenance like rebuildall.

WikimeSteve (talkcontribs)

Appears to be solved. We had 5900+ jobs queued and got those cleared out. We then ran Rebuildall which took an hour. I had imported and set up a good number of the templates. After those two tasks, so I cannot say for sure which one but I suspect Rebuildall, I went to my blank page and tried inserting a template. Noticed right away that the description was now showing up in the search window as the results came back. After selecting it I saw all the fields as expected.

Thanks for the responses and help.

Whatamidoing (WMF) (talkcontribs)

Thanks for coming back here to tell everyone what happened. I hope someone else will find this note and be saved a lot of frustration.

Reply to "Not seeing any benefit with Visual Editor though I hope to"
Czech.Fox (talkcontribs)

Hi, I use SQLite version of MediaWiki. I've noticed that since upgrade to 1.31, and also in 1.32, the TemplateData info is not saved to [page_props] table, and thus VisualEditor will not show any hints and list of properties.

It's possible to test it with fresh install of 1.32 with SQLite and TemplateData and VisualEditor extension (or even without VisualEditor).

Any idea?

Thank you

Czech.Fox (talkcontribs)

I resolved the problem by migrating to portable MariaDB and running the maintenance script rebuildall.php

Reply to "No data saved to [page_props]" (talkcontribs)

When I put data with type "page name", they paste without double brackets, but I need with. What to do?

Tacsipacsi (talkcontribs)

Don’t use this data type. It’s for templates requiring the raw page name for further processing. (talkcontribs)

And how to do that one parametr will be changed only from three variants?

Tacsipacsi (talkcontribs)

Currently “line” is the best choice (and explain it in the parameter description), enumerators are not supported at this time.

Reply to "Page names into links"

inserting images/files in templates in the new wikipedia editor

Elastano (talkcontribs)

is shit. the software should recognize when file names have to be wrapped inside some wiki markup in order to be shown correctly. for example, if i try to insert the filename of a screenshot into a page that is using an infobox with a "screenshot=" field, it should at least alert me that this field expects something like File:Xy.png and maybe offer text completion instead of just saving the wrong string that just shows text after saving.

Tacsipacsi (talkcontribs)

This is neither the responsibility of TemplateData nor of the visual editor. These are just tools for storing and presenting template documentation; the on-wiki template documentation should make it clear what format the parameters should use (and stop using “file” data type if it does now, as that‘s clearly for bare-filename parameters).

Elastano (talkcontribs)

interesting. so you think it can be made to show all the wished behaviour i described above with just the right code in the template documentation?

Tacsipacsi (talkcontribs)

Of course it’s possible to say in the human-readable description field something like “The screenshot using the normal ‘[[File:filename.jpg|250px]]’ image embed syntax.” It’s not possible, however, to convert just the file name automatically into a file link, as that contains arbitrary options in addition to the file name, like the desired width. (By the way, if you save the page without checking the preview, that’s your problem.)

Reply to "inserting images/files in templates in the new wikipedia editor"
Zackmann08 (talkcontribs)

Is there any way to edit this information basically in a spreadsheet? It would just be really nice to basically go down the list updating fields. So I know that I want to set the type for fields. Rather than opening each param individually and setting the type, I could just work my way down the rows setting the values. Even an option to export/import to a CSV would be wonderful!

Whatamidoing (WMF) (talkcontribs)

I'm not aware of any existing script for this, but the end result is standard JSON, so it is theoretically possible.

Reply to "Edit in table format"

Options to select different date formats

George Ho (talkcontribs)

I was given a suggestion at Topic:Unpy3y332x9rk1ji that I request some change on TemplateData to allow users to select different date formats. Here I am suggesting this especially for consistency with Wikipedia articles.

The current default format is "YYYY-MM-DD". I hope that the calendar feature would allow "DD Mon Year" and "Mon DD, Year" someday. If that is too complicated, alternatively, I made a suggestion there that an editor should have an option to manually type a date in a date parameter, similar to UploadWizard's.

Whatamidoing (WMF) (talkcontribs)

This function already exists at the English Wikipedia, and some other wikis that have up-to-date copies of the CS1 modules. If you combine |date=2018-11-20 with |df=dmy, then it will automagically display the specified date format to the reader. Better still, this parameter is something that could be added via AWB or bot to every citation template in every article that has the {{use dmy dates}} template in it, and the corresponding codes could be added for other date formats. Then editors wouldn't need to switch back and forth between formats when editing different articles, or to specify anything manually.

George Ho (talkcontribs)

I see that it works on "date" parameter but not "accessdate" parameter; see this diff. BTW, scrolling down to see the "Date format" parameter amongst the "Optional parameters" column can be a pain; the column is very long.

EDIT: I re-tested the "URL access date" parameter; I realize that the auto date formatting is not supported for that parameter.

George Ho (talkcontribs)

I'm becoming annoyed that the calendar sub-feature won't allow inserting of month and year without day for monthly magazines. (talkcontribs)

Whatamidoing: It won't solve the underlying problem. The issue is that it relies on ISO date which is deliberately limited. For instance it can't record any historical dates before the 1800s. The primary concern is that for a tool that is meant to serve multilingual wikis it fails to address the fact that there are several calendars (e.g. arabic, etc) currently in use around the world. It would be perfect if there was a single unambiguous calendar to denote all existing dates (both ancient and current), but such a convenient system doesn't exist. Dates are really complicated concepts.

George Ho: This extension is a bit like a documentation manual, it only specifies how things must work but it can't do anything to actually require that tools that implement it work that way. So while it certainly needs a way to determine how to format dates, or even specify different calendars it is up to each editing tool to implement it properly.

However, the request for adding just month and year needs to be logged in the specific extension talk page or the bug tracker because the ISO standard already supports it.

George Ho (talkcontribs)

You mean separate "Topic", right? (talkcontribs)

Yes, either that or by following Bugreport, and reporting it to phabricator.

Whatamidoing (WMF) (talkcontribs)
Whatamidoing (WMF) (talkcontribs)

> it relies on ISO date which is deliberately limited. For instance it can't record any historical dates before the 1800s.

True, but it's unlikely that websites, magazines, and news articles from the 1700s or earlier will be commonly cited on Wikipedia, right? ;-) (talkcontribs)

Err, the principle of an encyclopedia is documenting historical events. Wikipedia has distorted that and basically become triviapedia as well as futurepedia, but even if one wants to talk about current events, it is easy to find cases that don't neatly fit into the Gregorian calendar, e.g. this article (https://bn.wikipedia.org/wiki/%E0%A6%AC%E0%A7%8D%E0%A6%AF%E0%A6%BE%E0%A6%B8%E0%A6%A8%E0%A6%97%E0%A6%B0).

Feel free to try and explain how one would go about adding that date using the inflexible ISO. The same applies to historical dates on pages like https://lrc.wikipedia.org/wiki/%D8%B5%D9%84%D8%A7%D8%AD_%D8%A7%D9%84%D8%AF%DB%8C%D9%86_%D8%A3%DB%8C%DB%88%D8%A8%D9%8A.

Also, while the gregorian calendar is in the year 2018, the arabic calendar is current somewhere around 1441 (according to google). So recent news articles can demonstrably contain dates earlier than 1700.

The suggestion here is legitimate even if developers don't have the time or interest to implement it.

Whatamidoing (WMF) (talkcontribs)

Even if you managed to find a website from the 1700s, most Wikipedias would discourage citing it. (talkcontribs)

Either you're wildly confused or you simply don't understand what's being asked here. Some views seem to include:

  1. Emphasis on citations. Dates aren't only used in citations, they can be used in descriptions boxes containing a person born 1000 years ago, or in a quote template or in any number of near infinite use-cases.
  2. The notion that most Wikipedias use the gregorian calendar when citing current events. It is mostly irrelevant. A template can express dates using any calendar or even using localized digits.

The world doesn't revolve around English or even latin based calendars. To give a concrete example, today's date is 2018-11-13 (gregorian) === Rabiʻ I 5, 1440 (arabic calendar). There is nothing wrong with citing an event today, and state that it happened in 1440 nor is there anything wrong in citing the date using localized digits or calendars.

Introducing extra calendars to templatedata would resolve most problems remaining problems.

Whatamidoing (WMF) (talkcontribs)

This feature is almost never used outside of a particular set of citation templates. (talkcontribs)

The fact is the parameter was about as useful as bullets without a gun, all it did was document that a particular parameter accepts dates. Only recently, did it get some use by way of templatewizard. There are also more than 300000 templates (see https://en.wikipedia.org/wiki/Template:Infobox_product/doc) currently using dates, along with a similar a hacky {{xxx|month|year|date}} format, that's without even counting uses outside the bigger wikis.

There was simply no motivation for anyone aside from bored users to add that templatedata definition to templates. The notion that it won't get used because it wasn't used before makes no sense. Guns didn't get used before they became available, now some people have gone as far as claiming that it is some sort of human right to wield such things.

Reply to "Options to select different date formats"