Page MenuHomePhabricator

Add support for aliased parameter names in source-wiki templates
Closed, ResolvedPublic3 Estimated 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

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 updated the task description. (Show Details)

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

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.

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 moved this task from Demo to Done on the WMDE-QWERTY-Sprint-2019-04-30 board.