Page MenuHomePhabricator

Warning on repeated template parameters should use error class
Open, Needs TriagePublic

Description

When a template parameter has been repeated, e.g.

{{ttt | title=XYZ | url=http://example.org | title=ABC}}

a message is shown in source text preview

  • Warning: page is calling Template:ttt with more than one value for the "title" parameter. Only the last value provided will be used.

That message should be characterised by class="error".

  • Currently red color is inherited from .previewnote context.

Rationale:

  • Gadgets might detect errors somewhere in the preview and issue a warning next to [save] button, as remindErrorMessages already does.

BTW:

  • Is #invoke parameter list inspected, too? Same warning recommended.

Event Timeline

PerfektesChaos raised the priority of this task from to Needs Triage.
PerfektesChaos updated the task description. (Show Details)
PerfektesChaos subscribed.

That's the 'duplicate-args-warning' string in MediaWiki's Parser code.
Adding good first task and Parser projects.

I am interested in working on this bug.
I am new to MediaWiki. so it would be nice if someone could help me out.

Hi @Apollyon96! Thanks for your interest! Please see https://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker for more info and don't hesitate to ask here if you have specific questions about this task. Thank you!

Hey @Aklapper ! I have setup my local machine and am trying to recreate the error, but i am not so sure how to. Can you guide me on how to get the warning ? Also, I am trying to understand this code base along the way for further contribution.

@Apollyon96: Have you imported/set up the ttt template (see Templates Help) and searched for 'duplicate-args-warning' string in MediaWiki core? If something is unclear with the comments in this task, please explain what you have tried. Thanks for working on this!

  • There is no need to import any template definition.
    • It would be sufficient to create an empty local page Template:ttt.
  • The error message issue would be triggered even if no such template exists.
  • The foo:bar template in task description was not intended to be the real w:en:Template:ttt with real meaning.
    • Actually, the example looks more like w:en:Template:cite web.
    • You might call it ttttt as well.

"duplicate-args-warning", I found this string in Preprocessor_DOM.php Preprocessor_hash.php, I have experienced this bug on my mediawiki instance, Please help me in solving this issue.

Change 275208 had a related patch set uploaded (by Harjotsingh):
Add class error to Warning

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

This causes a font size increase and the two errors to appear on a single line like so:

Screen Shot 2016-06-14 at 4.08.26 PM.png (524×1 px, 83 KB)

We should avoid these changes in style by adding a rule .previewnote .error { font-size: inherit; } and adding newlines between the errors

Screen Shot 2016-06-14 at 4.09.13 PM.png (472×991 px, 71 KB)

This comment was removed by Harjotsingh.

@Jdlrobson @PerfektesChaos
I checked the bug on the latest code and the warning message is not showing at all even if a template parameter has been repeated.

Screenshot from 2016-11-06 04:13:20.png (718×1 px, 43 KB)

@Harjotsingh you'll need to import the template ttt - notice how it is a red link in your preview.
https://en.wikipedia.org/wiki/Template:Ttt

You may want to experiment first on English Wikipedia to understand the bug by editing and copying the wikitext code in the original description:
https://en.wikipedia.org/wiki/User:<yourusername>/sandbox

Hope that helps and good luck!

Change 320612 had a related patch set uploaded (by Harjotsingh):
Add class error to Warning

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

Change 275208 abandoned by Harjotsingh:
Add class error to Warning

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

As discussed over https://gerrit.wikimedia.org/r/320612, the class should be warning rather than error.

Change 320612 abandoned by Jdlrobson:
Add class warning to Warning

Reason:
Let's discuss this more on the phabricator ticket.

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

Aklapper added a subscriber: Harjotsingh.

This task has been assigned to the same task owner for more than two years. Resetting task assignee due to inactivity, to decrease task cookie-licking and to get a slightly more realistic overview of plans. Please feel free to assign this task to yourself again if you still realistically work or plan to work on this task - it would be welcome!

For tips how to manage individual work in Phabricator (noisy notifications, lists of task, etc.), see https://phabricator.wikimedia.org/T228575#6237124 for available options.
(For the records, two emails were sent to assignee addresses before resetting assignees. See T228575 for more info and for potential feedback. Thanks!)

Pppery subscribed.

This should be a good first task. But the carnage above shows it apparently isn't.