Page MenuHomePhabricator

The error normally shown if a named <ref> is defined multiple times doesn't appear if the page is missing <references/> tag
Closed, ResolvedPublic

Description

The error normally shown if a named <ref> is defined multiple times doesn't appear if the page is missing <references/> tag. Spotted by @IKhitron at T85386.

Works: https://www.mediawiki.org/w/index.php?title=User:IKhitron/draft&oldid=1910206
Doesn't work: https://www.mediawiki.org/w/index.php?title=User:IKhitron/draft&oldid=1910205

Event Timeline

matmarex created this task.Oct 7 2015, 3:24 PM
matmarex claimed this task.
matmarex raised the priority of this task from to Normal.
matmarex updated the task description. (Show Details)
matmarex added a project: Cite.
matmarex added subscribers: matmarex, eranroz, IKhitron.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 7 2015, 3:24 PM

I haven't noticed before, but it seems that mReferencesErrors was previously only used for errors that appeared from <ref> tags inside a <references> tag, and the errors stored there were only rendered when the <references> tag was being rendered. Since we used that in this patch, the error doesn't appear if <references> is missing.

There's also another interesting effect: when using grouped refs (<ref group>), the error message will appear after the first <references> tag (regardless of its group), and not the one where the duplicate ref belongs.

It should be possible to move the error message to be displayed next to the text of the problematic reference, rather than at the end of <references> block.

Change 244194 had a related patch set uploaded (by Bartosz Dziewoński):
Display 'cite_error_references_duplicate_key' next to the affected ref

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

I copied the contents of https://www.mediawiki.org/wiki/User:IKhitron/draft to my local wiki, here's a screenshot of what my change does:

The wikitext of this is:

<ref group=q name=a>gjgjjhgh</ref>

<ref group=q name=a>gjjjhgh</ref>

<ref name=c/>

<ref name=a>jkgkgkgkg</ref>

<ref name=a>jkgkgkggkg</ref>

<ref name=a>jkgkggkg</ref>

<ref name=a>jkgkggkgfgh</ref>
<references/>
jhgkgh
<references group=q/>

Looks good.

Change 244194 merged by jenkins-bot:
Display 'cite_error_references_duplicate_key' next to the affected ref

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

Jdforrester-WMF closed this task as Resolved.Oct 19 2015, 1:26 AM
Jdforrester-WMF edited projects, added User-notice; removed Patch-For-Review.
Jdforrester-WMF set Security to None.

I don't think this needs a User-notice, T85386 had one and this is just a follow-up. I'll propose it for backporting.

Change 247255 had a related patch set uploaded (by Bartosz Dziewoński):
Display 'cite_error_references_duplicate_key' next to the affected ref

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

Change 247256 had a related patch set uploaded (by Bartosz Dziewoński):
Display 'cite_error_references_duplicate_key' next to the affected ref

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

Change 247256 merged by jenkins-bot:
Display 'cite_error_references_duplicate_key' next to the affected ref

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

Change 247255 merged by jenkins-bot:
Display 'cite_error_references_duplicate_key' next to the affected ref

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