Extension talk:TemplateData

Jump to navigation Jump to search

About this board

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

12
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?

Thanks

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]"
46.211.53.195 (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.

46.211.53.195 (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

4
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

14
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.

197.218.93.56 (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?

197.218.93.56 (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? ;-)

197.218.89.48 (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.

197.218.88.14 (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.

197.218.88.14 (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"

Partial dates should be supported

5
Summary by Jdforrester (WMF)
George Ho (talkcontribs)

A monthly magazine, like Vibe and Men's Health, uses just month and year. Some, if not many, academic journals don't use full date, e.g. this one, that one, and another source that uses season and year (but can't think an example at the moment). However, the TemplateWizard currently wouldn't allow insertion of partial date; instead, either inserting full date and leaving a "date" parameter blank are the only available options to me.

If partial dates, e.g. month-year or season-year, are to be supported, I would appreciate it. Thanks.

Ciencia Al Poder (talkcontribs)

How about marking that parameter as plain text instead of date?

George Ho (talkcontribs)

Either I think I almost forgot that, or I've not clarified well. Either way, I should say that there's an option to insert the parameter without filling in anything in the TemplateWizard but then filling the paramater manually.

197.218.93.56 (talkcontribs)

Err, partial dates are already supported by Templatedata because it supports ISO_8601. TemplateWizard, and the related mediawiki widget would have to support it if deemed useful. See the linked wikipedia page for examples.

Of course if this is fully implemented in templatewizard or visualeditor then editors must prepare themselves for very weird dates. Stuff like --11-09 and 2018-313 or 2018-W45 is perfectly acceptable with iso, according to that page.

George Ho (talkcontribs)

Confusing, could use an overview and links to examples

2
Summary by 197.218.80.205
Skierpage (talkcontribs)

(Hi!) I was struggling over on Lyrics.wikia with all the MediaWiki markup in their page skeletons when all you really want is to enter some data {{band: "Corduroy", album: "Out of Here", song:"Mini"}} and have a song template produce the markup. It seems like TemplateData could really help, so I came here to remind myself about it. Alas the extension page lacks a simple explanation of how TemplateData interacts with actual templates, nor does nor does it give examples of it in use. The page says "This information is available as a nicely-formatted table for end-users", but my recollection is the stuff you put in the template data is somehow made available to other templates for them to output in their chosen wiki markup. There's a conceptual piece missing (or a screw loose in the reader...).

Whatamidoing (WMF) (talkcontribs)

TemplateData doesn't affect how the template behaves. It only tells VisualEditor which boxes to show when you insert a template.

Reply to "Confusing, could use an overview and links to examples"
קיפודנחש (talkcontribs)

one of the oldest, and widely used parser function is #switch

when a template uses a parameter as feeder to #switch, templatedata should be able to list the "legal" values, and also allow indication whether the #switch expression has #default clause, so a wizard will be able to provide a drop-down with the values, and optionally make it a "drop down combobox" which allows the user to feed a value not in the list.

if such syntax already exists, and it's only my ignorance speaking, please teach me. otherwise, please add switch property (call it whatever - html uses "select" and "options" i think), e.g.

"params": {
  "bla": {
    "description": "bla bla bla",
    "switch": ["preset value 1", "preset value 2" ...],
    "other": true
  }
}

peace.

Whatamidoing (WMF) (talkcontribs)
קיפודנחש (talkcontribs)

no. i'd like to see phab:T144155 also solved, but it's not the same issue.

in hewiki, we have "template wizard" since circa 2012, so it predates templatedata. we created our own "metadata" spec, which supported both the "boolean" attribute in the ticket, and a "select" attribute. the UI would present a checkbox for "boolean -like" parameters - selecting it would set the parameter to the prescribed value defined by the metadata. we had a separate "select" attribute, with "options" values, which behaved much like html "select" - the input field for such parameter was a drop-down listbox, so the editor would select one of predefined values, instead of a free text field as is with "normal" parameters.

some time after the introduction of templatedata, we modified our wizard to use templatedata instead of our "proprietary" metadata format, but we are missing the lost functionality, as described above.

peace.

Whatamidoing (WMF) (talkcontribs)
קיפודנחש (talkcontribs)

I am. I even left him a love letter on his talk page on enwiki a while ago. Twisi, his wizard is crippled by not being able to digest an existing template on the page, so it's a one-shot thing: get it right the first time, or you're on your own. My old wizard is ugly, but better behaved. Peace.

Reply to "select"