Page MenuHomePhabricator

Bad numbering of reused sub-references
Closed, ResolvedPublic2 Estimated Story Points

Description

Split from T239788:

<ref name="a">Named book</ref>
<ref name="a">Named book</ref>
<ref name="b" extends="a">Named page</ref>
<ref name="b" extends="a">Named page</ref>

Result: [1] [1] [1.1] [1.2].

Both the duplicate "a" reference as well as the reused "b" sub-references are merged, as they should. But some of the numbers are wrong:

  • In the text, it should not be [1.2] but [1.1].
  • In the <references> list, it should not be 1.2.0 1.2.1 but 1.1.0 1.1.1.

The same happens here:

<ref name="a">Named book</ref>
<ref name="b" extends="a">Named page</ref>
<ref name="b" extends="a" />

But not here:

<ref name="a">Named book</ref>
<ref name="b" extends="a">Named page</ref>
<ref name="b" />

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 7 2020, 1:59 PM
awight renamed this task from Bad numbering of identical sub-references with the same content to Bad numbering of reused sub-references.Jan 7 2020, 2:18 PM
awight updated the task description. (Show Details)

I changed the title and description because this seems to be about reused refs, the "with the same content" part is irrelevant.

Change 562533 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Cite@master] Fix bad numbering when reusing sub-references

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

Change 562536 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Cite@master] Report conflicting extends="…" with an error message

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

Change 562533 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] Fix bad numbering when reusing sub-references

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

Izno moved this task from Unsorted backlog to Defect backlog on the Cite board.Jan 7 2020, 10:54 PM
WMDE-Fisch set the point value for this task to 2.Jan 8 2020, 12:49 PM
WMDE-Fisch moved this task from Sprint Backlog to Review on the WMDE-QWERTY-Sprint-2020-01-08 board.

Change 562536 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] Report conflicting extends="…" with an error message

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

Should we consider the task done now with the patch merged? Or what about the comment on the last patch? Should this go into an extra ticket?

We're still not catching this edge case, but the patch makes our feature more complete nonetheless.

  <ref name="a">First</ref>
  <ref name="b"></ref>
  <ref extends="a" name="b">Second</ref>
awight added a comment.EditedJan 9 2020, 12:19 PM

Should we consider the task done now with the patch merged? Or what about the comment on the last patch? Should this go into an extra ticket?

Let's say this is part of completing the task, since the numbering will be incorrect in the example I gave. It will render as [1] [2] [1.1].

Isn't this the same example as the one in T242141: Bad numbering when reusing a sub-reference before it's defined? To me the example looks more like it is specifically about reusing a sub-ref before it is defined, while this ticket here is about conflicting definitions.

Which means this ticket here is done, doesn't it?

My mistake, what I meant to show was this case:

<ref name="a">First</ref>
<ref name="b">Second</ref>
<ref extends="a" name="b">Second</ref>

This is a conflicting definition in the reverse order.

I'm not sure I understand what the difference is.

<ref name="a">First</ref>
<ref name="b"></ref>
<ref extends="a" name="b">Second</ref>
<ref name="a">First</ref>
<ref name="b">Second</ref>
<ref extends="a" name="b">Second</ref>

In both cases the conflict is the same: The second line creates a top-level ref named "b". The third line attempts to change "b" to be a sub-ref. This is impossible without some kind of multi-pass, which we decided not to do for now. So all we can do at the moment is raise an error when processing the third line. Both should be covered by T242141.

WMDE-Fisch closed this task as Resolved.Jan 16 2020, 10:47 AM
WMDE-Fisch claimed this task.
WMDE-Fisch moved this task from Demo to Done on the WMDE-QWERTY-Sprint-2020-01-08 board.

I tested the examples form the description on beta and these cases seem to be fixed. So I'll close the ticket. If there are any remaining issues. Please create a new ticket.