mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
MWReferenceNode: Ignore changes to reference list index
This means that all reference nodes are treated as comparable in the diff (provided they are in the same group) so will not show up in the article diff if their index changes. Changes to the reference list are already handled separately by the visual diff. Bug: T170235 Change-Id: I8c26686d7b2fe3bf91af7d4dcab1caf3247dbe47
This commit is contained in:
parent
d9e86c24a0
commit
c763fb5cc3
|
@ -146,7 +146,6 @@
|
||||||
"cite-ve-changedesc-reflist-group-both",
|
"cite-ve-changedesc-reflist-group-both",
|
||||||
"cite-ve-changedesc-reflist-group-from",
|
"cite-ve-changedesc-reflist-group-from",
|
||||||
"cite-ve-changedesc-reflist-group-to",
|
"cite-ve-changedesc-reflist-group-to",
|
||||||
"cite-ve-changedesc-reflist-item-id",
|
|
||||||
"cite-ve-changedesc-reflist-responsive-set",
|
"cite-ve-changedesc-reflist-responsive-set",
|
||||||
"cite-ve-changedesc-reflist-responsive-unset",
|
"cite-ve-changedesc-reflist-responsive-unset",
|
||||||
"cite-ve-citationneeded-button",
|
"cite-ve-citationneeded-button",
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
"cite-ve-changedesc-reflist-group-to": "References list group changed from the general group to \"$1\"",
|
"cite-ve-changedesc-reflist-group-to": "References list group changed from the general group to \"$1\"",
|
||||||
"cite-ve-changedesc-reflist-responsive-set": "References list changed to display in responsive columns",
|
"cite-ve-changedesc-reflist-responsive-set": "References list changed to display in responsive columns",
|
||||||
"cite-ve-changedesc-reflist-responsive-unset": "References list changed to display in only one column",
|
"cite-ve-changedesc-reflist-responsive-unset": "References list changed to display in only one column",
|
||||||
"cite-ve-changedesc-reflist-item-id": "Reference index changed",
|
|
||||||
"cite-ve-citationneeded-button": "Add a citation",
|
"cite-ve-citationneeded-button": "Add a citation",
|
||||||
"cite-ve-citationneeded-description": "An editor has indicated that this claim needs a citation to a reliable source.",
|
"cite-ve-citationneeded-description": "An editor has indicated that this claim needs a citation to a reliable source.",
|
||||||
"cite-ve-citationneeded-reason": "Reason given:",
|
"cite-ve-citationneeded-reason": "Reason given:",
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
"cite-ve-changedesc-reflist-group-to": "Description of a references list changing group from the general group\n\nParameters:\n* $1 – the name of the group it is now",
|
"cite-ve-changedesc-reflist-group-to": "Description of a references list changing group from the general group\n\nParameters:\n* $1 – the name of the group it is now",
|
||||||
"cite-ve-changedesc-reflist-responsive-set": "Description of a references list changing responsiveness to on",
|
"cite-ve-changedesc-reflist-responsive-set": "Description of a references list changing responsiveness to on",
|
||||||
"cite-ve-changedesc-reflist-responsive-unset": "Description of a references list changing responsiveness to off",
|
"cite-ve-changedesc-reflist-responsive-unset": "Description of a references list changing responsiveness to off",
|
||||||
"cite-ve-changedesc-reflist-item-id": "Description of the visible index of a reference changing",
|
|
||||||
"cite-ve-citationneeded-button": "Label for button in citation needed context, to add a citation",
|
"cite-ve-citationneeded-button": "Label for button in citation needed context, to add a citation",
|
||||||
"cite-ve-citationneeded-description": "Description in citation needed context, explaining that a citation is needed",
|
"cite-ve-citationneeded-description": "Description in citation needed context, explaining that a citation is needed",
|
||||||
"cite-ve-citationneeded-reason": "Label for reason given for citation being needed.",
|
"cite-ve-citationneeded-reason": "Label for reason given for citation being needed.",
|
||||||
|
|
|
@ -8,7 +8,7 @@ QUnit.module( 've.ui.DiffElement (Cite)' );
|
||||||
|
|
||||||
QUnit.test( 'Diffing', function ( assert ) {
|
QUnit.test( 'Diffing', function ( assert ) {
|
||||||
var i, len,
|
var i, len,
|
||||||
// spacer = '<div class="ve-ui-diffElement-spacer">⋮</div>',
|
spacer = '<div class="ve-ui-diffElement-spacer">⋮</div>',
|
||||||
ref = function ( text, num ) {
|
ref = function ( text, num ) {
|
||||||
var dataMw = {
|
var dataMw = {
|
||||||
name: 'ref',
|
name: 'ref',
|
||||||
|
@ -32,18 +32,7 @@ QUnit.test( 'Diffing', function ( assert ) {
|
||||||
'<h2>Notes</h2>' +
|
'<h2>Notes</h2>' +
|
||||||
'<div typeof="mw:Extension/references" data-mw="{"name":"references"}"></div>',
|
'<div typeof="mw:Extension/references" data-mw="{"name":"references"}"></div>',
|
||||||
expected:
|
expected:
|
||||||
'<div class="ve-ui-diffElement-doc-child-change">' +
|
spacer +
|
||||||
'<p>' +
|
|
||||||
ref( 'Foo', '1' ) +
|
|
||||||
'<span data-diff-action="change-remove">' +
|
|
||||||
ref( 'Bar', '2' ) +
|
|
||||||
'</span>' +
|
|
||||||
'<span data-diff-action="change-insert">' +
|
|
||||||
ref( 'Bar ish', '2' ) +
|
|
||||||
'</span>' +
|
|
||||||
ref( 'Baz', '3' ) +
|
|
||||||
'</p>' +
|
|
||||||
'</div>' +
|
|
||||||
'<h2 data-diff-action="none">Notes</h2>' +
|
'<h2 data-diff-action="none">Notes</h2>' +
|
||||||
'<div class="ve-ui-diffElement-doc-child-change">' +
|
'<div class="ve-ui-diffElement-doc-child-change">' +
|
||||||
'<ol start="1">' +
|
'<ol start="1">' +
|
||||||
|
|
|
@ -333,6 +333,25 @@ ve.dm.MWReferenceNode.static.cloneElement = function () {
|
||||||
return clone;
|
return clone;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
ve.dm.MWReferenceNode.static.getHashObject = function ( dataElement ) {
|
||||||
|
// Consider all references in the same group to be comparable:
|
||||||
|
// References can't be usefully compared statically, as they are mostly
|
||||||
|
// defined by the contents of their internal item, which exists
|
||||||
|
// elsewhere in the document.
|
||||||
|
// For diffing, comparing reference indexes is not useful as
|
||||||
|
// they are auto-generated, and the reference list diff is
|
||||||
|
// already handled separately, so will show moves etc.
|
||||||
|
return {
|
||||||
|
type: dataElement.type,
|
||||||
|
attributes: {
|
||||||
|
listGroup: dataElement.attributes.listGroup
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
@ -346,9 +365,6 @@ ve.dm.MWReferenceNode.static.describeChange = function ( key, change ) {
|
||||||
return ve.htmlMsg( 'cite-ve-changedesc-ref-group-both', this.wrapText( 'del', change.from ), this.wrapText( 'ins', change.to ) );
|
return ve.htmlMsg( 'cite-ve-changedesc-ref-group-both', this.wrapText( 'del', change.from ), this.wrapText( 'ins', change.to ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( key === 'refListItemId' ) {
|
|
||||||
return ve.msg( 'cite-ve-changedesc-reflist-item-id' );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
Loading…
Reference in a new issue