Page MenuHomePhabricator

Add template parameters when requested via `+` syntax in the configuration
Closed, ResolvedPublic5 Story Points

Description

Example:

  • Files from the German Wikipedia contain {{Bild-GFDL-Neu}}.
  • This should become {{GFDL|migration=not-eligible}}.
  • The instruction for this is ;Bild-GFDL-Neu:GFDL|+migration=not-eligible.

Acceptance Criteria
The + changes the meaning of what comes behind the =. It's not a source parameter name any more, but a static value. This means:

  • CommonsHelperConfigParser already understands the + and turns it into a addIfMissing flag.
  • Change CommonsHelperConfigParser so it does not use localParameters if a + was present, but remembers a value instead.
  • Teach WikiTextContentCleaner to properly work with parameters that have a value:
    • Make sure parameters marked with addIfMissing are added to the template, if missing. For an MVP it's ok to add such parameters either before or after all other, previously existing parameters.
    • Make sure a parameter that already exists is not duplicated.

Possible follow up tickets:

  • Make sure a new parameter is added at a position that closely matches the position in the configuration file. E.g. a configuration like a=…|+b=…|c=… and a source like |a=…|c=… should result in a=…|b=…|c=….
  • T198582: Allow a configuration like a=source_parameter|+a=fallback value where a target parameter appears twice, one time with the name of a source parameter, and a second time with a static value. The static value should only be used if the source parameter was missing or empty.

Event Timeline

Change 443437 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Properly parse required parameters in CommonsHelperConfigParser

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

Change 443438 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Add template parameters when requested via + syntax in config

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

Change 443459 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Reuse existing wikitext formatting when adding parameters

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

Lea_WMDE triaged this task as Normal priority.Jul 3 2018, 1:20 PM
Lea_WMDE updated the task description. (Show Details)
Lea_WMDE set the point value for this task to 5.
Stefan2 added a subscriber: Stefan2.Jul 3 2018, 3:31 PM

On Commons, {{GFDL|migration=not-eligible}} can be produced by using {{subst:Bild-GFDL-Neu}}.

If the file also is licensed under CC-BY-SA 3.0, then {{GFDL|migration=redundant}} may be better than {{GFDL|migration=not-eligible}}.

thiemowmde moved this task from Sprint Backlog to Doing on the WMDE-QWERTY-Sprint-2018-07-03 board.

Change 443437 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Properly parse required parameters in CommonsHelperConfigParser

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

Change 443438 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Add template parameters when requested via + syntax in config

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

Change 443459 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Reuse existing wikitext formatting when adding parameters

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

Change 443898 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Add missing test cases for WikiTextConversions & …ContentCleaner

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

Change 443911 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Add missing test cases for new WikiTextConversions features

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

Change 443898 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Add missing test cases for WikiTextConversions & …ContentCleaner

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

Change 443911 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Add missing test cases for new WikiTextConversions features

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

WMDE-Fisch updated the task description. (Show Details)Jul 11 2018, 8:47 AM
Lea_WMDE closed this task as Resolved.Jul 18 2018, 3:51 PM
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMay 14 2019, 10:11 AM