Page MenuHomePhabricator

VE should not assume that duplicated arguments to parser functions can be removed
Open, MediumPublic

Description

I was encouraged to file this at https://www.mediawiki.org/w/index.php?title=Topic:Uncadir1bpkjnnbz&topic_showPostId=v6e6trz47cdcxs54&fromnotif=1#flow-post-v6e6trz47cdcxs54

Unlike templates, duplicate named arguments to parser functions do not mask each other. This is particular important to some extensions like (third party) DPL, but also can happen with some core parser funcs.

Steps to reproduce (A bit of a contrived example. It is much less contrived if using Extension:DynamicPageList_(Third_Party)):

  • Add {{gender:Bawolff|user = male|user = female|user = neutral|random third arg=5}} to a page. Note how the result is user = male [Since my user pref is set to male on enwiki currently]
  • Edit page with VE
  • Edit the template with VE, change random third arg to a new value
  • Save page

Expected behaviour:

  • VE would change the third argument, but leave the rest alone, since this is a parser function, so these aren't really named arguments but numbered arguments
  • The template dialog box would show all of these args

Actual behaviour:

At the very least, parser funcs using hashes should be recognized as not normal templates.

Event Timeline

ppelberg moved this task from To Triage to External and Administrivia on the VisualEditor board.
ppelberg subscribed.

Thank you for taking the time to report this as thoroughly and clearly as you have, @Bawolff.

This seems to be a Parsoid-related issue. For now, we're going to hand this task over them to investigate.

LGoto triaged this task as Medium priority.May 1 2020, 4:18 PM
LGoto moved this task from Backlog to Needs Investigation on the Parsoid board.

Probably a VE bug, I believe Parsoid output can correctly represent the duplicated argument, but we'll check it out.

Arlolra subscribed.

Probably a VE bug, I believe Parsoid output can correctly represent the duplicated argument, but we'll check it out.

Maybe you're thinking about media options?

> echo "{{gender:Bawolff|user = male|user = female|user = neutral|random third arg=5}}" | php bin/parse.php --domain www.mediawiki.org --wt2wt
{{gender:Bawolff|user = neutral|random third arg=5}}

> echo "{{gender:Bawolff|user = male|user = female|user = neutral|random third arg=5}}" | php bin/parse.php --domain www.mediawiki.org
<p data-parsoid='{"dsr":[0,78,0,0]}'><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"user","named":true,"spc":[""," "," ",""]},{"k":"random third arg","named":true}]],"dsr":[0,78,null,null]}' data-mw='{"parts":[{"template":{"target":{"wt":"gender:Bawolff","function":"gender"},"params":{"user":{"wt":"neutral"},"random third arg":{"wt":"5"}},"i":0}}]}'>user = female</span></p>

Funny that it roundtrips user = neutral but displays user = female, meaning even that is mismatched with the legacy parser.