Page MenuHomePhabricator

Add support for aliased parameter names in source-wiki templates
Closed, ResolvedPublic3 Story Points

Description

Some templates in the source wikis allow different spellings for the same parameter. For example, the Russian information template can say |Описание= or |описание= (note the different capitalization, which is significant). Both should become |Description=. The CommonsHelper2 format we use currently does not allow this, but can, in theory. See https://www.mediawiki.org/wiki/Special:Diff/3056489 for an example that would work if the code would support it.

Some of the code is already prepared for this, but this is neither fully implemented nor carefully tested.

Requested via:

Note this is very close to T198582 (this ticket here will make the other one easier), but not the same.

Event Timeline

Change 484747 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Allow multiple source parameters map to same target parameter

https://gerrit.wikimedia.org/r/484747

stjn added a subscriber: stjn.Jan 16 2019, 8:08 PM

Change 484747 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Allow multiple source parameters map to same target parameter

https://gerrit.wikimedia.org/r/484747

thiemowmde triaged this task as Normal priority.Apr 26 2019, 11:26 AM
thiemowmde updated the task description. (Show Details)
4nn1l2 added a subscriber: 4nn1l2.Apr 26 2019, 12:03 PM

Change 484747 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Allow multiple source parameters map to same target parameter

https://gerrit.wikimedia.org/r/484747

thiemowmde set the point value for this task to 3.
thiemowmde moved this task from Sprint Backlog to Doing on the WMDE-QWERTY-Sprint-2019-04-30 board.
thiemowmde added a subscriber: awight.

I noticed this feature is currently only tested at the data source (CommonsHelperConfigParser), not at the sink that uses the data (WikitextContentCleaner). I will add a unit test for the later.

This is also not covered by any integration test (the …Cleaner actually using the output from the …ConfigParser). But I feel this is acceptable and not strictly needed.

Change 508797 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Add WikitextContentCleaner test for multiple source parameters

https://gerrit.wikimedia.org/r/508797

Change 508797 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Add WikitextContentCleaner test for multiple source parameters

https://gerrit.wikimedia.org/r/508797

Could you just quickly remind me how I can test this outside of production?

Not super easy, I'm afraid, but possible.

  • You need a source wiki with a file page that contains a template with one or more parameter aliases, e.g. {{Information|desc=1|also desc=2}}. Note this is only an example. In reality, only one of the aliases would be present. But it's easier to test when they are all listed.
  • The config page for this source wiki must mention all aliases in the "Transfer" section, e.g. Information|Description=desc|Description=also desc.
  • After import, the template on the file page should now read {{Information|Description=1|Description=2}}.
awight added a comment.May 9 2019, 1:14 PM

I'm not sure how to get into the file importer on commonswiki to test this, but I did find an example file on dewiki which uses a template with parameter mapping:
https://de.wikipedia.org/wiki/Datei:GermanyDemRepPFX1-50Pfennig-1979-donatedmjd_b.jpg

According to this mapping, the Quelle parameter should become @Source, for example.

stjn added a comment.May 9 2019, 2:10 PM

If you need an example of a file for which conversion currently doesn’t work in production and should work with the patch, here:

https://ru.wikipedia.org/wiki/Файл:Портал_коми_news_inta.png (mapping for ruwiki)

(don’t upload the file on Commons, though, it’s useless)

Lea_WMDE closed this task as Resolved.May 15 2019, 12:50 PM
Lea_WMDE moved this task from Demo to Done on the WMDE-QWERTY-Sprint-2019-04-30 board.