mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 14:36:51 +00:00
Show specific error message in reflist when parent is missing
Bug: T372871 Change-Id: Idce84adc0100dfd73f02611f2825f3be1d2da223
This commit is contained in:
parent
e9d2aecb5f
commit
ab7d60ca05
|
@ -90,6 +90,7 @@
|
||||||
"messages": [
|
"messages": [
|
||||||
"cite-ve-referenceslist-isempty",
|
"cite-ve-referenceslist-isempty",
|
||||||
"cite-ve-referenceslist-isempty-default",
|
"cite-ve-referenceslist-isempty-default",
|
||||||
|
"cite-ve-referenceslist-missing-parent",
|
||||||
"cite-ve-referenceslist-missingref",
|
"cite-ve-referenceslist-missingref",
|
||||||
"cite-ve-referenceslist-missingref-in-list",
|
"cite-ve-referenceslist-missingref-in-list",
|
||||||
"cite-ve-referenceslist-missingreflist"
|
"cite-ve-referenceslist-missingreflist"
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
"cite-ve-reference-input-placeholder": "Search within current citations",
|
"cite-ve-reference-input-placeholder": "Search within current citations",
|
||||||
"cite-ve-referenceslist-isempty": "There are no references with the group \"$1\" on this page to include in this list.",
|
"cite-ve-referenceslist-isempty": "There are no references with the group \"$1\" on this page to include in this list.",
|
||||||
"cite-ve-referenceslist-isempty-default": "There are no references on this page to include in this list.",
|
"cite-ve-referenceslist-isempty-default": "There are no references on this page to include in this list.",
|
||||||
|
"cite-ve-referenceslist-missing-parent": "There are subreferences with a missing parent reference.",
|
||||||
"cite-ve-referenceslist-missingref": "This reference is defined in a template or other generated block, and for now can only be edited in source mode.",
|
"cite-ve-referenceslist-missingref": "This reference is defined in a template or other generated block, and for now can only be edited in source mode.",
|
||||||
"cite-ve-referenceslist-missingref-in-list": "This reference is defined in a template or other generated block, and for now can only be previewed in source mode.",
|
"cite-ve-referenceslist-missingref-in-list": "This reference is defined in a template or other generated block, and for now can only be previewed in source mode.",
|
||||||
"cite-ve-referenceslist-missingreflist": "This reference list is generated by a template.",
|
"cite-ve-referenceslist-missingreflist": "This reference list is generated by a template.",
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
"cite-ve-reference-input-placeholder": "Placeholder text for reference search field: searches existing on-page references.",
|
"cite-ve-reference-input-placeholder": "Placeholder text for reference search field: searches existing on-page references.",
|
||||||
"cite-ve-referenceslist-isempty": "Message that appears in the references list when there are no references on the page of that group.\n\nParameters:\n* $1 - reference-group name",
|
"cite-ve-referenceslist-isempty": "Message that appears in the references list when there are no references on the page of that group.\n\nParameters:\n* $1 - reference-group name",
|
||||||
"cite-ve-referenceslist-isempty-default": "Message that appears in the references list when there are no references on the page in the default group.",
|
"cite-ve-referenceslist-isempty-default": "Message that appears in the references list when there are no references on the page in the default group.",
|
||||||
|
"cite-ve-referenceslist-missing-parent": "Message that appears in place of the parent reference in the reference list, when a subreference has no corresponding parent.",
|
||||||
"cite-ve-referenceslist-missingref": "Message that appears as a tooltip on the reference, for references that are generated by a template or are otherwise uneditable.\n\nSee also:\n* {{msg-mw|visualeditor-dialog-meta-languages-readonlynote}}",
|
"cite-ve-referenceslist-missingref": "Message that appears as a tooltip on the reference, for references that are generated by a template or are otherwise uneditable.\n\nSee also:\n* {{msg-mw|visualeditor-dialog-meta-languages-readonlynote}}",
|
||||||
"cite-ve-referenceslist-missingref-in-list": "Message that appears in the references list for references that are generated by a template or are otherwise uneditable.\n\nSee also:\n* {{msg-mw|visualeditor-dialog-meta-languages-readonlynote}}",
|
"cite-ve-referenceslist-missingref-in-list": "Message that appears in the references list for references that are generated by a template or are otherwise uneditable.\n\nSee also:\n* {{msg-mw|visualeditor-dialog-meta-languages-readonlynote}}",
|
||||||
"cite-ve-referenceslist-missingreflist": "Message that appears as a tooltip on the reference list for lists that are generated by a template.",
|
"cite-ve-referenceslist-missingreflist": "Message that appears as a tooltip on the reference list for lists that are generated by a template.",
|
||||||
|
|
|
@ -275,6 +275,7 @@ ve.ce.MWReferencesListNode.prototype.renderListItem = function ( nodes, internal
|
||||||
// Exclude placeholders and references defined inside the references list node
|
// Exclude placeholders and references defined inside the references list node
|
||||||
( backRefNode ) => !backRefNode.getAttribute( 'placeholder' ) && !backRefNode.findParent( ve.dm.MWReferencesListNode )
|
( backRefNode ) => !backRefNode.getAttribute( 'placeholder' ) && !backRefNode.findParent( ve.dm.MWReferencesListNode )
|
||||||
);
|
);
|
||||||
|
const subrefs = groupRefs.subRefsByParent[ key ] || [];
|
||||||
|
|
||||||
const $li = $( '<li>' )
|
const $li = $( '<li>' )
|
||||||
.css( '--footnote-number', `"${ groupRefs.getIndexLabel( key ) }."` )
|
.css( '--footnote-number', `"${ groupRefs.getIndexLabel( key ) }."` )
|
||||||
|
@ -323,15 +324,14 @@ ve.ce.MWReferencesListNode.prototype.renderListItem = function ( nodes, internal
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: Special rendering for missing parent of orphaned subrefs?
|
|
||||||
$li.append(
|
$li.append(
|
||||||
$( '<span>' )
|
$( '<span>' )
|
||||||
.addClass( 've-ce-mwReferencesListNode-muted' )
|
.addClass( 've-ce-mwReferencesListNode-muted' )
|
||||||
.text( ve.msg( 'cite-ve-referenceslist-missingref-in-list' ) )
|
.text( subrefs.length ? ve.msg( 'cite-ve-referenceslist-missing-parent' ) :
|
||||||
|
ve.msg( 'cite-ve-referenceslist-missingref-in-list' ) )
|
||||||
).addClass( 've-ce-mwReferencesListNode-missingRef' );
|
).addClass( 've-ce-mwReferencesListNode-missingRef' );
|
||||||
}
|
}
|
||||||
|
|
||||||
const subrefs = groupRefs.getSubrefs( key );
|
|
||||||
if ( subrefs.length ) {
|
if ( subrefs.length ) {
|
||||||
$li.append(
|
$li.append(
|
||||||
$( '<ol>' ).append(
|
$( '<ol>' ).append(
|
||||||
|
|
Loading…
Reference in a new issue